From 4340a5addb0c9da67b1f68dc00ba2a3fc80436cb Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 15 Oct 2024 09:04:42 -0400 Subject: [PATCH 1/2] bintools-wrapper: ensure Swift auto-linked libraries can be found While the Swift wrapper should take care of this, not everything that links these libraries goes through the wrapper. --- .../bintools-wrapper/add-darwin-ldflags-before.sh | 6 ++++++ 1 file changed, 6 insertions(+) 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 79f0546403f7..0a2961bbe46e 100644 --- a/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh +++ b/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh @@ -89,3 +89,9 @@ 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 From 7cbf599edc7d5064d18585da8b78777e2cc4497a Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 15 Oct 2024 09:05:03 -0400 Subject: [PATCH 2/2] Revert "dotnetCorePackages.dotnet_{8,9}: ensure build can find the Swift overlay" This reverts commit 86412523f5fa23646f82647bd6e2b9f3d72d4863. --- pkgs/development/compilers/dotnet/patch-nupkgs.nix | 1 - pkgs/development/compilers/dotnet/vmr.nix | 9 --------- 2 files changed, 10 deletions(-) diff --git a/pkgs/development/compilers/dotnet/patch-nupkgs.nix b/pkgs/development/compilers/dotnet/patch-nupkgs.nix index 09fd8342368a..6885d8df71f3 100644 --- a/pkgs/development/compilers/dotnet/patch-nupkgs.nix +++ b/pkgs/development/compilers/dotnet/patch-nupkgs.nix @@ -85,7 +85,6 @@ writeShellScriptBin "patch-nupkgs" ( pushd "$x" sed -i 's: -no_code_signature_warning::g' build/Microsoft.NETCore.Native.targets sed -i 's:Include="-ld_classic"::g' build/Microsoft.NETCore.Native.Unix.targets - sed -i 's:-L/usr/lib/swift:-L$(SDKROOT)/usr/lib/swift:g' build/Microsoft.NETCore.Native.Unix.targets touch .nix-patched-ilcompiler popd done diff --git a/pkgs/development/compilers/dotnet/vmr.nix b/pkgs/development/compilers/dotnet/vmr.nix index d1385b4c3cac..2c95d7d6ee6b 100644 --- a/pkgs/development/compilers/dotnet/vmr.nix +++ b/pkgs/development/compilers/dotnet/vmr.nix @@ -293,15 +293,6 @@ stdenv.mkDerivation rec { -s \$prev -t elem -n SkipInstallerBuild -v true \ src/runtime/Directory.Build.props - # Make sure .NET uses the Swift overlay for the SDK active in the build environment. - substituteInPlace \ - src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets \ - --replace-fail '-L/usr/lib/swift' '-L$(SDKROOT)/usr/lib/swift' - - substituteInPlace \ - src/runtime/src/native/libs/System.Security.Cryptography.Native.Apple/extra_libs.cmake \ - --replace-fail '-L/usr/lib/swift' '-L''${CMAKE_OSX_SYSROOT}/usr/lib/swift' - # stop passing -sdk without a path # stop using xcrun # add -module-cache-path to fix swift errors, see sandboxProfile