From 55dfed83c07faaa7aa9d279af787ec41b8baed9a Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 27 Oct 2024 17:44:56 +0000 Subject: [PATCH] {bintools-wrapper,cc-wrapper}: export Darwin SDK variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 514b00cf08702b31cdf873a798f1ff100d4f2cf7 exposed another bug in the existing wrapper logic: Darwin SDK variables are only exported by the SDK package hook, so if those variables aren’t already exported inside the wrappers, the modified versions are not passed down to the compiler tools, breaking the fallback SDK logic. This was previously partially masked by passing down a normally‐redundant `-isysroot` to the compiler, but now we fix it at the source. This broke e.g. running `clang(1)` without any environment, something the GHC binary package `installCheckPhase` does indirectly to verify that there’s nothing missing from the wrapped GHC `$PATH`. It may also have caused issues building for the build platform inside a Darwin‐to‐non‐Darwin cross‐compilation build. --- pkgs/build-support/wrapper-common/darwin-sdk-setup.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/wrapper-common/darwin-sdk-setup.bash b/pkgs/build-support/wrapper-common/darwin-sdk-setup.bash index 8c6a337a8fca..3b31a4aa6981 100644 --- a/pkgs/build-support/wrapper-common/darwin-sdk-setup.bash +++ b/pkgs/build-support/wrapper-common/darwin-sdk-setup.bash @@ -8,9 +8,9 @@ if [[ "@darwinMinVersion@" ]]; then # Allow wrapped compilers 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@} + export DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@:-@fallback_sdk@} # xcbuild needs `SDKROOT` to be the name of the SDK, which it sets in its own wrapper, # but compilers expect it to point to the absolute path. - SDKROOT="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" + export SDKROOT="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" fi