How rpath works (or doesn't) on NixOS

Spend couple of hours today trying to make lld work on NixOS. Didn’t succeed due to LLD linker does not have required nixpkgs wrapper script and flags · Issue #24744 · NixOS/nixpkgs · GitHub, but learned a bunch of stuff in the process and decided to write it up as a blog post:

https://matklad.github.io/2022/03/14/rpath-or-why-lld-doesnt-work-on-nixos.html

Maybe someone will find this useful or just interesting!

6 Likes

Oof, this looks like a real exercise in hair-pulling… I hope it gets resolved soon!

I don’t know… it seems you missed some bits mentioned in the nixpkgs issue. There apparently are ways of getting wrapped lld, e.g. llvmPackages.bintools. So I’d try with that.

1 Like

Indeed! Apparently, was too tired yesterday to figure out what comments on the issue actually mean :sweat:

It turns out that there’s more than one lld available in nixpkgs. What I was using was pkgs.lld_14, and that is indeed an “unwrapped” lld. However, the lld is also provided by the llvmPackages_14.bintools, and that one is wrapped and does set up rpath.

Hosted by Flying Circus.