diff --git a/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh b/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh index 0a2961bbe46e..127f83e303a3 100644 --- a/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh +++ b/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh @@ -85,13 +85,3 @@ mangleVarSingle DEVELOPER_DIR ${role_suffixes[@]+"${role_suffixes[@]}"} # Allow wrapped bintools to do something useful when no `DEVELOPER_DIR` is set, which can happen when # the compiler is run outside of a stdenv or intentionally in an environment with no environment variables set. DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@:-@fallback_sdk@} - -# Darwin looks for frameworks in the SDK located at `DEVELOPER_DIR`. -extraBefore+=("-F$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks") -extraBefore+=("-L$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib") - -# While the Swift wrapper should take care of this, anything that needs to link Swift auto-linked frameworks -# also needs these paths. Note: Test and conditionally add it because the path may not exist in older SDKs. -if [ -d "$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/swift" ]; then - extraBefore+=("-L$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/swift") -fi diff --git a/pkgs/by-name/ld/ld64/0008-Disable-searching-in-standard-library-locations.patch b/pkgs/by-name/ld/ld64/0008-Disable-searching-in-standard-library-locations.patch deleted file mode 100644 index ddda588c6aaf..000000000000 --- a/pkgs/by-name/ld/ld64/0008-Disable-searching-in-standard-library-locations.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 3e80d438e2a3ec50d666f2b6e32007c275d4a08a Mon Sep 17 00:00:00 2001 -From: Randy Eckenrode -Date: Thu, 11 Apr 2024 23:13:29 -0400 -Subject: [PATCH 8/8] Disable searching in standard library locations - ---- - src/ld/Options.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/ld/Options.cpp b/src/ld/Options.cpp -index 67a9f53..611b583 100644 ---- a/src/ld/Options.cpp -+++ b/src/ld/Options.cpp -@@ -4320,7 +4320,7 @@ bool Options::shouldUseBuildVersion(ld::Platform plat, uint32_t minOSvers) const - - void Options::buildSearchPaths(int argc, const char* argv[]) - { -- bool addStandardLibraryDirectories = true; -+ bool addStandardLibraryDirectories = false; - ld::Platform platform = ld::Platform::unknown; - std::vector libraryPaths; - std::vector frameworkPaths; --- -2.45.1 - diff --git a/pkgs/by-name/ld/ld64/package.nix b/pkgs/by-name/ld/ld64/package.nix index b5900f3576ac..d3dfe3b8b7e6 100644 --- a/pkgs/by-name/ld/ld64/package.nix +++ b/pkgs/by-name/ld/ld64/package.nix @@ -128,8 +128,6 @@ stdenv.mkDerivation (finalAttrs: { ./0006-Add-libcd_is_blob_a_linker_signature-implementation.patch # Add OpenSSL implementation of CoreCrypto digest functions. Avoids use of private and non-free APIs. ./0007-Add-OpenSSL-based-CoreCrypto-digest-functions.patch - # ld64 will search `/usr/lib`, `/Library/Frameworks`, etc by default. Disable that. - ./0008-Disable-searching-in-standard-library-locations.patch ]; postPatch = '' diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 070d5ec23851..0fb0f27f23ba 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -449,9 +449,15 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check bintools = selfDarwin.binutils-unwrapped; - # Bootstrap tools cctools needs the hook and wrappers to make sure things are signed properly. + # Bootstrap tools cctools needs the hook and wrappers to make sure things are signed properly, + # and additional linker flags to work around a sinceā€removed patch. # This can be dropped once the bootstrap tools cctools has been updated to 1010.6. extraBuildCommands = '' + printf %s ${lib.escapeShellArg '' + extraBefore+=("-F$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks") + extraBefore+=("-L$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib") + ''} >> $out/nix-support/add-local-ldflags-before.sh + echo 'source ${selfDarwin.postLinkSignHook}' >> $out/nix-support/post-link-hook export signingUtils=${selfDarwin.signingUtils} @@ -694,6 +700,11 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check # Bootstrap tools cctools needs the hook and wrappers to make sure things are signed properly. # This can be dropped once the bootstrap tools cctools has been updated to 1010.6. extraBuildCommands = '' + printf %s ${lib.escapeShellArg '' + extraBefore+=("-F$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks") + extraBefore+=("-L$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib") + ''} >> $out/nix-support/add-local-ldflags-before.sh + echo 'source ${selfDarwin.postLinkSignHook}' >> $out/nix-support/post-link-hook export signingUtils=${selfDarwin.signingUtils}