I have the following Nix derivation:
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "scipoptsuite-${version}";
version = "4.0.0";
src = fetchurl {
url = "http://scip.zib.de/download/release/scipoptsuite-${version}.tgz";
sha256 = "087535760eae3d633e2515d942a9b22e1f16332c022be8d093372bdc68e8a661";
};
buildInputs = [ zlib gmp readline ];
}
Strangely, when running nix-build scipoptsuite.nix, some files are compiling just fine but then I get:
/nix/store/x9v0yxy5iybp2m2ccqwqkvxgjy7zrw8f-binutils-2.28/bin/ld: cannot find -lgmp
/nix/store/x9v0yxy5iybp2m2ccqwqkvxgjy7zrw8f-binutils-2.28/bin/ld: cannot find -lm
/nix/store/x9v0yxy5iybp2m2ccqwqkvxgjy7zrw8f-binutils-2.28/bin/ld: cannot find -lz
/nix/store/x9v0yxy5iybp2m2ccqwqkvxgjy7zrw8f-binutils-2.28/bin/ld: cannot find -lc
The bad command is:
gcc -O3 -m64 -mtune=native obj/O.linux.x86_64.gnu.static.opt/zimpl.o obj/O.linux.x86_64.gnu.static.opt/xlpglue.o obj/O.linux.x86_64.gnu.static.opt/zlpglue.o obj/O.linux.x86_64.gnu.static.opt/ratlpstore.o obj/O.linux.x86_64.gnu.static.opt/ratlpfwrite.o obj/O.linux.x86_64.gnu.static.opt/ratmpswrite.o obj/O.linux.x86_64.gnu.static.opt/ratmstwrite.o obj/O.linux.x86_64.gnu.static.opt/ratordwrite.o obj/O.linux.x86_64.gnu.static.opt/ratpresolve.o -Llib -lzimpl-3.3.4.linux.x86_64.gnu.opt -lgmp -lm -lz -static -o bin/zimpl-3.3.4.linux.x86_64.gnu.static.opt
Does anybody have an idea why this error occurs?
preBuild = "set -x"to themkDerivationarguments, to bring bash to dump all its executed commands from before the build.-staticoption is used. Why is this a problem?preBuild = "set -x", I had to use amakeFlagsArray. See the question for the command that is executed.