summary refs log tree commit diff
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2022-06-23 09:36:08 -0400
committerShea Levy <shea@shealevy.com>2022-06-23 10:42:39 -0400
commit8e6206f9c9324d0a4ae151d1ed1d099ba76cc5ee (patch)
tree40abc94956a19a0d55ac71fe89de5381ad59a17c
parent68c94a2786f071f7671cf86668954cfb57123b60 (diff)
downloadnixpkgs-8e6206f9c9324d0a4ae151d1ed1d099ba76cc5ee.tar
nixpkgs-8e6206f9c9324d0a4ae151d1ed1d099ba76cc5ee.tar.gz
nixpkgs-8e6206f9c9324d0a4ae151d1ed1d099ba76cc5ee.tar.bz2
nixpkgs-8e6206f9c9324d0a4ae151d1ed1d099ba76cc5ee.tar.lz
nixpkgs-8e6206f9c9324d0a4ae151d1ed1d099ba76cc5ee.tar.xz
nixpkgs-8e6206f9c9324d0a4ae151d1ed1d099ba76cc5ee.tar.zst
nixpkgs-8e6206f9c9324d0a4ae151d1ed1d099ba76cc5ee.zip
gcc49: Fix build on darwin
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix6
-rw-r--r--pkgs/development/compilers/gcc/common/pre-configure.nix10
-rw-r--r--pkgs/top-level/all-packages.nix3
3 files changed, 13 insertions, 6 deletions
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index b3d0f8d5d50..571d0b02312 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -154,7 +154,10 @@ stdenv.mkDerivation ({
 
   hardeningDisable = [ "format" "pie" ];
 
-  outputs = if langJava || langGo then ["out" "man" "info"]
+  # When targetting darwin, libgcc_ext.10.{4,5}.dylib are created as
+  # MH_DYLIB_STUB files, which install_name_tool can't change, so we
+  # get a cycle between $out and $lib.
+  outputs = if langJava || langGo || targetPlatform.isDarwin then ["out" "man" "info"]
     else [ "out" "lib" "man" "info" ];
   setOutputFlags = false;
   NIX_NO_SELF_RPATH = true;
@@ -328,7 +331,6 @@ stdenv.mkDerivation ({
     maintainers = with lib.maintainers; [ veprbl ];
 
     platforms = lib.platforms.unix;
-    badPlatforms = lib.platforms.darwin;
   };
 }
 
diff --git a/pkgs/development/compilers/gcc/common/pre-configure.nix b/pkgs/development/compilers/gcc/common/pre-configure.nix
index d9977e0ba2f..310e7f8b574 100644
--- a/pkgs/development/compilers/gcc/common/pre-configure.nix
+++ b/pkgs/development/compilers/gcc/common/pre-configure.nix
@@ -6,14 +6,16 @@
 , langGo }:
 
 assert langJava -> lib.versionOlder version "7";
-assert langAda -> gnatboot != null;
-
-lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
+assert langAda -> gnatboot != null; let
+  needsLib
+    =  (lib.versionOlder version "7" && (langJava || langGo))
+    || (lib.versions.major version == "4" && lib.versions.minor version == "9" && targetPlatform.isDarwin);
+in lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
   export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
   export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
   export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
   export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET"
-'' + lib.optionalString (lib.versionOlder version "7" && (langJava || langGo)) ''
+'' + lib.optionalString needsLib ''
   export lib=$out;
 '' + lib.optionalString langAda ''
   export PATH=${gnatboot}/bin:$PATH
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index daa41e5e4db..f57ddc35858 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -12812,6 +12812,9 @@ with pkgs;
     isl = if !stdenv.isDarwin then isl_0_11 else null;
 
     cloog = if !stdenv.isDarwin then cloog_0_18_0 else null;
+
+    # Build fails on Darwin with clang
+    stdenv = if stdenv.isDarwin then gccStdenv else stdenv;
   }));
 
   gcc6 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/6 {