-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NIX_LIB64_IN_SELF_RPATH leaks through to cross-builds #221350
Comments
I believe this is the offending line: nixpkgs/pkgs/stdenv/linux/default.nix Line 118 in 4700c7a
but I'm not sure whether the |
The NIX_LIB64|32_IN_SELF_RPATH environment variables control whether to add lib64 and lib32 to rpaths. However, they're set depending on the build paltform, not the target platform and thus their values are incorrect for for cross-builds. On the other hand, setting them according to the build platform introduce pointless differences in build outputs; see NixOS#221350 for details. This change fixes the issues by boldly removes the NIX_LIB*_IN_SELF_RPATH facility altogether, in the hope that it is no longer necessary. They were introduced in 2009, long before nixpkgs had good support for cross-builds. Fixes NixOS#221350
The check should definitely be using |
The NIX_LIB64|32_IN_SELF_RPATH environment variables control whether to add lib64 and lib32 to rpaths. However, they're set depending on the build paltform, not the target platform and thus their values are incorrect for for cross-builds. On the other hand, setting them according to the build platform introduce pointless differences in build outputs; see NixOS#221350 for details. This change fixes the issues by boldly removes the NIX_LIB*_IN_SELF_RPATH facility altogether, in the hope that it is no longer necessary. They were introduced in 2009, long before nixpkgs had good support for cross-builds. Fixes NixOS#221350
Similar to PR NixOS#223861 and the issue NixOS#221350, NIX_COREFOUNDATION_RPATH is set unconditionally in the darwin stdenv. This is wrong for cross- compiles and results in `rpaths` depending on the builder platform. This change makes another bold move and deletes the NIX_COREFOUNDATION_RPATH facility completely, in the hope it is no longer needed, or that any breakage is manageable. As an added bonus we can delete a darwin specific hack in glibc.
Closing since it sounds like the merge of #223861 resolved this. Happy to reopen if I'm mistaken. |
Describe the bug
lib64
directories are added to linker rpath flags for cross-compilation to platforms that don't need them.Steps To Reproduce
Steps to reproduce the behavior:
nix build -L github:eliasnaur/nix-lib64-rpath
on a x86_64-linux systemoutput:
Note the
lib64
directory added toNIX_LDFLAGS
.See full build log at https://github.com/eliasnaur/nix-lib64-rpath/actions/runs/4428890865/jobs/7768605092.
Running the same command on a aarch64-darwin configuration (with a aarch64-linux builder configured):
Note that
NIX_LDFLAGS
doesn't contain alib64
directory.Expected behavior
NIX_LDFLAGS
should not containlib64
directories when cross-compiling for non-x86_64-linux platforms.Additional context
Adding
lib64
to NIX_LDFLAGS is generally benign, except that I'm trying to achieve bit-for-bit reproducible builds. The extralib64
entries end up in slightly larger ELF sections that can't be saved by careful use ofpatchelf
.The text was updated successfully, but these errors were encountered: