From b0b0a06788d5a7b3a3b35063b058f1326f10e983 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 23 Mar 2020 00:25:34 -0400 Subject: [PATCH] bintools: only add macos flags when targeting macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can’t set this for cross-compiling since we use the GNU linker. Instead, set these flags only when targetPlatform is macOS. Fixes #80754 Fixes #83141 --- pkgs/build-support/bintools-wrapper/default.nix | 5 +++++ pkgs/stdenv/darwin/default.nix | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 84020505a635..74feeece230f 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -248,6 +248,11 @@ stdenv.mkDerivation { printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before '') + + optionalString stdenv.targetPlatform.isMacOS '' + # Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID. + echo "-macosx_version_min 10.12 -sdk_version 10.12 -no_uuid" >> $out/nix-support/libc-ldflags-before + '' + + optionalString (!nativeTools) '' ## ## User env support diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index ef1ebfc32c1b..2d5a191fc32b 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -36,9 +36,7 @@ in rec { export NIX_IGNORE_LD_THROUGH_GCC=1 export SDKROOT= - # Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID. export MACOSX_DEPLOYMENT_TARGET=${macosVersionMin} - export NIX_LDFLAGS+=" -macosx_version_min ${macosVersionMin} -sdk_version ${appleSdkVersion} -no_uuid" # Workaround for https://openradar.appspot.com/22671534 on 10.11. export gl_cv_func_getcwd_abort_bug=no