Skip to content

Commit

Permalink
stdenv: remove the NIX_COREFOUNDATION_RPATH sledgehammer
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eliasnaur committed May 4, 2023
1 parent 29339c1 commit 4f103fb
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 21 deletions.
6 changes: 0 additions & 6 deletions pkgs/build-support/bintools-wrapper/ld-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,6 @@ if [[ "$NIX_DONT_SET_RPATH_@suffixSalt@" != 1 && "$linkType" != static-pie ]]; t

fi

# This is outside the DONT_SET_RPATH branch because it's more targeted and we
# usually want it (on Darwin) even if DONT_SET_RPATH is set.
if [ -n "${NIX_COREFOUNDATION_RPATH:-}" ]; then
extraAfter+=(-rpath $NIX_COREFOUNDATION_RPATH)
fi

# Only add --build-id if this is a final link. FIXME: should build gcc
# with --enable-linker-build-id instead?
#
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/libraries/glibc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ in
# Apparently --bindir is not respected.
makeFlagsArray+=("bindir=$bin/bin" "sbindir=$bin/sbin" "rootsbindir=$bin/sbin")
'' + lib.optionalString stdenv.buildPlatform.isDarwin ''
# ld-wrapper will otherwise attempt to inject CoreFoundation into ld-linux's RUNPATH
export NIX_COREFOUNDATION_RPATH=
'';

# The pie, stackprotector and fortify hardening flags are autodetected by
Expand Down
11 changes: 0 additions & 11 deletions pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,3 @@ fixDarwinFrameworksIn() {
local dir="$1"
fixDarwinFrameworks $(find "$dir" -name "*.dylib")
}


# This configures the stdenv to use /System/Library/Frameworks/CoreFoundation.framework
# instead of the nix version by including the system frameworks path
# as an rpath entry when creating binaries.

useSystemCoreFoundationFramework () {
export NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks
}

addEnvHooks "$hostOffset" useSystemCoreFoundationFramework
1 change: 0 additions & 1 deletion pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,6 @@ rec {
targetPlatform = localSystem;

preHook = commonPreHook + ''
export NIX_COREFOUNDATION_RPATH=${pkgs.darwin.CF}/Library/Frameworks
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
'';

Expand Down

0 comments on commit 4f103fb

Please sign in to comment.