Nix build failing on MacOS Big Sur
nix-build nix -A ligo-bin --show-trace
gives:
building '/nix/store/1wvrks54cbnlhppyix2026nsryf1hx6x-opam-nix.drv'...
building
Linking /nix/store/f99msg3mvmm2wsrqvvx2xvpfhhxlnl6r-opam-nix ...
ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
builder for '/nix/store/1wvrks54cbnlhppyix2026nsryf1hx6x-opam-nix.drv' failed with exit code 1
cannot build derivation '/nix/store/1wl1cb54wapd6d007iljdfv4id13nv13-ligo.drv': 1 dependencies couldn't be built
error: while evaluating the attribute 'ligo-out.bin' at /Users/steve/Projects/tweag/nomadiclabs/ligo/nix/pkgs.nix:27:31:
while evaluating the attribute 'ligo-out' at /Users/steve/Projects/tweag/nomadiclabs/ligo/nix/ocaml-overlay.nix:87:9:
while evaluating the attribute 'ligo-dune.overrideAttrs' at /Users/steve/Projects/tweag/nomadiclabs/ligo/nix/ocaml-overlay.nix:84:9:
while evaluating the attribute 'ligo.override' at /nix/store/iyv3n1hxb84bzp0b0z17p1dzc1pjhcnh-source/default.nix:110:9:
while evaluating 'callPackageWith' at /nix/store/qk5fy3j82jyic25gk436mq44zrkppxp3-source/lib/customisation.nix:117:35, called from /nix/store/iyv3n1hxb84bzp0b0z17p1dzc1pjhcnh-source/default.nix:110:18:
while evaluating 'makeOverridable' at /nix/store/qk5fy3j82jyic25gk436mq44zrkppxp3-source/lib/customisation.nix:67:24, called from /nix/store/qk5fy3j82jyic25gk436mq44zrkppxp3-source/lib/customisation.nix:121:8:
build of '/nix/store/1wl1cb54wapd6d007iljdfv4id13nv13-ligo.drv' failed
So this appears to be a failure in opam-nix. Let's try updating that:
niv update opam-nix
Now we get essentially the same:
nix-build nix -A ligo-bin
unpacking 'https://github.com/balsoft/opam-nix/archive/3d619a4c9f759e8ee13f428faac0d13938f087ee.tar.gz'...
building '/nix/store/fshcajysr0ayapizdzc604b7rrxs6g6p-opam-nix.drv'...
building
[1 of 1] Compiling Main ( /nix/store/lgsx328cmpd0ksfdqj40fb1zfcfwc2am-opam-nix.hs, /nix/store/lgsx328cmpd0ksfdqj40fb1zfcfwc2am-opam-nix.o )
Linking /nix/store/2rwk3agcnbkc0qlfad9zg79xhdykm12h-opam-nix ...
ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
builder for '/nix/store/fshcajysr0ayapizdzc604b7rrxs6g6p-opam-nix.drv' failed with exit code 1
cannot build derivation '/nix/store/83w0q0p72k4nbim029h31q8jnl5pdn4y-ligo.drv': 1 dependencies couldn't be built
error: build of '/nix/store/83w0q0p72k4nbim029h31q8jnl5pdn4y-ligo.drv' failed
(use '--show-trace' to show detailed location information)
So I clone opam-nix
and build that locally with the latest nixpkgs master: that works.
I try updating the nixpkgs in nix/sources.json to the same latest nixpkgs version, then try building ligo-bin again. Now I get the same error, but while building bisect_ppx
:
building '/nix/store/1wvrks54cbnlhppyix2026nsryf1hx6x-opam-nix.drv'...
building
Linking /nix/store/f99msg3mvmm2wsrqvvx2xvpfhhxlnl6r-opam-nix ...
ld: file not found: /usr/lib/system/libcache.dylib for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
builder for '/nix/store/1wvrks54cbnlhppyix2026nsryf1hx6x-opam-nix.drv' failed with exit code 1
cannot build derivation '/nix/store/5gwp0x83dc44lwqhq5k2q5ylgnb2frzj-bisect_ppx.nix.drv': 1 dependencies couldn't be built
error: while evaluating the attribute 'buildCommand' of the derivation 'ligo-out-bin' at /nix/store/1dyfj33brvpg5i39nnh8wvylrgrhqhag-source/pkgs/build-support/trivial-builders.nix:7:7:
while evaluating the attribute 'buildInputs' of the derivation 'ligo-out' at /Users/steve/Projects/tweag/nomadiclabs/ligo/nix/ocaml-overlay.nix:88:11:
while evaluating 'getOutput' at /nix/store/1dyfj33brvpg5i39nnh8wvylrgrhqhag-source/lib/attrsets.nix:464:23, called from undefined position:
while evaluating anonymous function at /nix/store/1dyfj33brvpg5i39nnh8wvylrgrhqhag-source/pkgs/stdenv/generic/make-derivation.nix:143:17, called from undefined position:
while evaluating the attribute 'bisect_ppx.versions."2.0.0".overrideAttrs' at /nix/store/iyv3n1hxb84bzp0b0z17p1dzc1pjhcnh-source/default.nix:102:16:
while evaluating the attribute 'bisect_ppx.versions' at undefined position:
while evaluating anonymous function at /nix/store/iyv3n1hxb84bzp0b0z17p1dzc1pjhcnh-source/default.nix:72:43, called from undefined position:
while evaluating 'package' at /nix/store/iyv3n1hxb84bzp0b0z17p1dzc1pjhcnh-source/default.nix:80:21, called from /nix/store/iyv3n1hxb84bzp0b0z17p1dzc1pjhcnh-source/default.nix:87:20:
while evaluating 'callPackageWith' at /nix/store/1dyfj33brvpg5i39nnh8wvylrgrhqhag-source/lib/customisation.nix:117:35, called from /nix/store/iyv3n1hxb84bzp0b0z17p1dzc1pjhcnh-source/default.nix:81:13:
while evaluating 'makeOverridable' at /nix/store/1dyfj33brvpg5i39nnh8wvylrgrhqhag-source/lib/customisation.nix:67:24, called from /nix/store/1dyfj33brvpg5i39nnh8wvylrgrhqhag-source/lib/customisation.nix:121:8:
build of '/nix/store/5gwp0x83dc44lwqhq5k2q5ylgnb2frzj-bisect_ppx.nix.drv' failed
I guess that opam2nix is generating derivations that don't have the correct build flags or other incantations in order to build on Big Sur, but honestly I have very little idea what's going on here.
Edited by Steve Purcell