pmeunier / carnix

#16 Problem: when `crate-type = ["staticlib", "cdylib", "dylib" ]` *.so files are not generated

Opened by sjmackenzie, on October 25, 2018
Closed
sjmackenzie commented on October 25, 2018

Steps to reproduce 1:

  • git clone https://github.com/input-output-hk/rust-cardano
  • ensure you have carnix 0.8.10
  • edit rust-cardano/cardano-c/Cargo.toml so that crate-type = ["cdylib", "dylib"]
  • $ carnix generate-nix --src ./. --standalone
  • $ nix-build Cargo.nix -A cardano_c -I nixpkgs=/path/to/nixpkgs-with-carnix-0.8.10
  • $ ls result/lib/

Expected behaviour

$ ls result/lib/
cardano_c-0581f418ea.d  libcardano_c-0581f418ea.so  libcardano_c.so  link

Actual behaviour

Actual behaviour matches expected behaviour - GREAT!

------------- next ---------------

Steps to reproduce 2:

  • edit rust-cardano/cardano-c/Cargo.toml so that crate-type = ["staticlib", "cdylib", "dylib"]
  • $ carnix generate-nix --src ./. --standalone
  • $ nix-build Cargo.nix -A cardano_c -I nixpkgs=/path/to/nixpkgs-with-carnix-0.8.10
  • $ ls result/lib/

Expected behaviour

the contents of result/lib should contain *.so files

Actual behaviour

$ ls result/lib/
cardano_c-0581f418ea.d  libcardano_c-0581f418ea.a  link

(Context: My patch here: https://github.com/input-output-hk/rust-cardano/pull/301/files wants to generate a shared object so I can run SWIG to generate racket bindings with https://github.com/sjmackenzie/rkt-cardano/tree/swig )

pmeunier commented on October 26, 2018

Thanks for reporting, I just fixed this.

sjmackenzie commented on October 26, 2018

Hi @pmeunier,

I just ran your patch, here's the error:

$ nix-shell -p carnix cargo -I nixpkgs=/home/stewart/dev/fractalide/nixpkgs
error: value is a string while a list was expected, at /home/stewart/dev/fractalide/nixpkgs/pkgs/build-support/rust/build-rust-crate/build-crate.nix:47:39