Hi,
I am trying to compile GHC using stack
installed via my nix-darwin
configuration file.
I see these messages in the error logs:
2022-01-07 10:07:17.240214: [warn] hashable > /run/current-system/sw/bin/ld: line 254: /nix/store/8fpyhncn4m4x1kifzjizy0h8s2696ibk-binutils-2.35.2/bin/ld: No such file or directory
2022-01-07 10:07:17.242092: [warn] hashable > `ld' failed in phase `Merge objects'. (Exit code: 127)
Upon a closer look, it looks as if there is no ld
binary supplied by binutils
on nix-darwin
.
> readlink /run/current-system/sw/bin/ld
> /nix/store/6dg7m90fvbm69knws1mhix5q5bmfq13k-binutils-wrapper-2.35.2/bin/ld
which calls /nix/store/8fpyhncn4m4x1kifzjizy0h8s2696ibk-binutils-2.35.2/bin/ld
, which does not exist on nix-darwin
: nixpkgs/default.nix at 2320573b696600fc868e3cc35ce7fb4b56a10f8e · NixOS/nixpkgs · GitHub.
However, when I execute nix-shell -p --pure which binutils
, ld
is found:
> which ld
> /nix/store/a2sz5pfcilnp7hw9hhqipvs3rvq3s59v-clang-wrapper-11.1.0/bin/ld
Therefore, I assume that if I can get ld
callable from my default shell, then it will work for the stack
build.
How can I get my default system ld
pointing to the binary in clang-wrapper
as is done by nix-shell
?
Additional details (from nix-shell -p nix-info --run "nix-info -m"
):
- system: `"x86_64-darwin"`
- host os: `Darwin 19.6.0, macOS 10.15.7`
- multi-user?: `no`
- sandbox: `no`
- version: `nix-env (Nix) 2.3.7`
- channels(user): `"darwin, home-manager, nixpkgs-22.05pre343831.77fda7f6727"`
- channels(root): `"darwin, nixpkgs-22.05pre343436.0432195a4b8"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs
and stack info:
2.7.3 x86_64 hpack-0.34.6
Output of find / -name ld
:
/usr/bin/ld
/nix/var/log/nix/drvs/ld
/nix/store/s7bxbn7aw9rzndmslb1hi8h2daai8076-system-path/bin/ld
/nix/store/33xrfsvf08lmps2m53wd2dmms38fm2sa-system-path/bin/ld
/nix/store/xw1fr2bcyrb345gyymd884hsrc5cbq6d-system-path/bin/ld
/nix/store/bb64lgvd32fzbfhxribri0cpyyrcrg7a-cctools-binutils-darwin-wrapper-949.0.1/bin/ld
/nix/store/6xdzry1904imzascysl4xv1l80w73fah-system-path/bin/ld
/nix/store/zkn8c6529cmds0c6vp4f1x4wrfs53csl-gfortran-wrapper-9.3.0/bin/ld
/nix/store/6dg7m90fvbm69knws1mhix5q5bmfq13k-binutils-wrapper-2.35.2/bin/ld
/nix/store/a2sz5pfcilnp7hw9hhqipvs3rvq3s59v-clang-wrapper-11.1.0/bin/ld
/nix/store/smlqklbkz6byzabiha76zfl6s1ii90x6-cctools-port-949.0.1/bin/ld
/nix/store/lark52dswbrjdfvb26qwm320fgrdy71k-cctools-binutils-darwin-949.0.1/bin/ld