Skip to content

stdenv/darwin: set NIX_COREFOUNDATION_RPATH via hook#111385

Closed
veprbl wants to merge 1 commit intoNixOS:stagingfrom
veprbl:pr/CF_rpath_hook
Closed

stdenv/darwin: set NIX_COREFOUNDATION_RPATH via hook#111385
veprbl wants to merge 1 commit intoNixOS:stagingfrom
veprbl:pr/CF_rpath_hook

Conversation

@veprbl
Copy link
Member

@veprbl veprbl commented Jan 31, 2021

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
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

cc @Gaelan

@veprbl veprbl added 6.topic: darwin Running or building packages on Darwin 6.topic: cross-compilation Building packages on a different platform than they will be used on labels Jan 31, 2021
@veprbl veprbl requested review from LnL7 and siraben January 31, 2021 03:35
@ofborg ofborg bot added the 6.topic: stdenv Standard environment label Jan 31, 2021
Copy link
Member

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.

Copy link
Member Author

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.
@veprbl veprbl added the 2.status: merge conflict This PR has merge conflicts with the target branch label May 31, 2021
@stale
Copy link

stale bot commented Jan 9, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 9, 2022
@eliasnaur
Copy link
Contributor

As mentioned in #226048 I'd like to get rid of NIX_COREFOUNDATION_RPATH for darwin cross, and this PR seems like a better way of achieving that without losing the pure frameworks.

How to proceed? @veprbl would you like to update your PR or want me to pick it up?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label May 6, 2023
@veprbl
Copy link
Member Author

veprbl commented May 9, 2023

@eliasnaur Yes, please, use the contents of this PR as you see fit.

@eliasnaur
Copy link
Contributor

Thanks, see #230870.

@veprbl
Copy link
Member Author

veprbl commented May 9, 2023

Great. Let's close this then.

@veprbl veprbl closed this May 9, 2023
reckenrode added a commit to reckenrode/nixpkgs that referenced this pull request May 26, 2023
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.
reckenrode added a commit to reckenrode/nixpkgs that referenced this pull request May 29, 2023
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.
reckenrode added a commit to reckenrode/nixpkgs that referenced this pull request May 31, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: darwin Running or building packages on Darwin 6.topic: stdenv Standard environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants