-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
stdenv/darwin: set NIX_COREFOUNDATION_RPATH via hook #111385
Conversation
@@ -503,7 +506,6 @@ in rec { | |||
targetPlatform = localSystem; | |||
|
|||
preHook = commonPreHook + '' | |||
export NIX_COREFOUNDATION_RPATH=${pkgs.darwin.CF}/Library/Frameworks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason this is set directly in the stdenv is to ensure that any usage of frameworks takes priority. The goal here is to link against the pure version as much as possible, but system frameworks also link against the CoreFoundation framework in which case also linking against the pure build causes problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the ordering might be enforced by extraBuildInputs
, but just in case there is a simple bash logic in corefoundation-setup-hook.sh to avoid overriding NIX_COREFOUNDATION_RPATH
.
This will unset the variable in the cross stdenv where CF is taken out of extraBuildInputs. This is useful for cross compilation to linux where setting RPATH on glibc will break it in runtime. The hook needs to be turned off during the bootstrapping to prevent unwanted references between the stages.
bc46d34
to
cb5cb29
Compare
I marked this as stale due to inactivity. → More info |
@eliasnaur Yes, please, use the contents of this PR as you see fit. |
Thanks, see #230870. |
Great. Let's close this then. |
Closes NixOS#230870. Thanks to @eliasnaur for the test case and for rasining awareness and to @veprbl for the work done on NixOS#111385. This takes a slightly different approach from those two PRs. The hook is set unconditionally. The stdenv bootstrap doesn’t really need CF at all, so setting the hook is harmless. This simplifies things.
Closes NixOS#230870. Thanks to @eliasnaur for the test case and for rasining awareness and to @veprbl for the work done on NixOS#111385. This takes a slightly different approach from those two PRs. The hook is set unconditionally. The stdenv bootstrap doesn’t really need CF at all, so setting the hook is harmless. This simplifies things.
Closes NixOS#230870. Thanks to @eliasnaur for the test case and for rasining awareness and to @veprbl for the work done on NixOS#111385. This takes a slightly different approach from those two PRs. The hook is set unconditionally. The stdenv bootstrap doesn’t really need CF at all, so setting the hook is harmless. This simplifies things.
This will unset the variable in the cross stdenv where CF is taken out
of extraBuildInputs. This is useful for cross compilation to linux
where setting RPATH on glibc will break it in runtime.
The hook needs to be turned off during the bootstrapping to prevent
unwanted references between the stages.
Motivation for this change
Fixes darwin -> gnu64 cross compilation
Closes: #103517
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)cc @Gaelan