Skip to content

Commit

Permalink
bintools: only add macos flags when targeting macOS
Browse files Browse the repository at this point in the history
We can’t set this for cross-compiling since we use the GNU linker.
Instead, set these flags only when targetPlatform is macOS.

Fixes NixOS#80754

Fixes NixOS#83141
  • Loading branch information
matthewbauer authored and Gabriella439 committed May 6, 2021
1 parent 1da40c7 commit b9cc29e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,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
Expand Down

0 comments on commit b9cc29e

Please sign in to comment.