about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2023-04-12 09:34:40 +0200
committerVladimír Čunát <v@cunat.cz>2023-04-12 09:37:24 +0200
commitac3acd956f730fa9870d4488c91699c8e2892a39 (patch)
tree2cdaadbabe8567b02c20066ab8fde403e0fffff2
parent4d4fee11d0e324f25df68d2fc195c581381149be (diff)
cc-wrapper: add optional temporary hack for -B
This fixes parts in llvmPackages_{13,rocm}
e.g. build .clang for testing.
Longterm mass-rebuild fix should come in PR #225846
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix5
-rw-r--r--pkgs/development/compilers/llvm/13/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/rocm/default.nix3
-rw-r--r--pkgs/top-level/all-packages.nix3
4 files changed, 12 insertions, 2 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index 24680754c8d5d..1f1d7489a988d 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -52,6 +52,7 @@
 
 # the derivation at which the `-B` and `-L` flags added by `useCcForLibs` will point
 , gccForLibs ? if useCcForLibs then cc else null
+, tmpDropB ? false # temporary hack; see PR #225846
 }:
 
 with lib;
@@ -335,9 +336,11 @@ stdenv.mkDerivation {
     ##
     ## GCC libs for non-GCC support
     ##
-    + optionalString useGccForLibs ''
+    + optionalString (useGccForLibs && !tmpDropB) ''
 
       echo "-B${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-cflags
+    ''
+    + optionalString useGccForLibs ''
       echo "-L${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-ldflags
       echo "-L${gccForLibs.lib}/${targetPlatform.config}/lib" >> $out/nix-support/cc-ldflags
     ''
diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix
index 0bc17119125b7..a51cfc001e0b7 100644
--- a/pkgs/development/compilers/llvm/13/default.nix
+++ b/pkgs/development/compilers/llvm/13/default.nix
@@ -1,4 +1,5 @@
 { lowPrio, newScope, pkgs, lib, stdenv, cmake
+, stdenv-tmpDropB
 , gccForLibs, preLibcCrossHeaders
 , libxml2, python3, isl, fetchFromGitHub, overrideCC, wrapCCWith, wrapBintoolsWith
 , buildLlvmTools # tools, but from the previous stage, for cross
@@ -243,7 +244,7 @@ let
       inherit llvm_meta;
       stdenv = if stdenv.hostPlatform.useLLVM or false
                then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
-               else stdenv;
+               else stdenv-tmpDropB;
     };
 
     # N.B. condition is safe because without useLLVM both are the same.
diff --git a/pkgs/development/compilers/llvm/rocm/default.nix b/pkgs/development/compilers/llvm/rocm/default.nix
index 7c82cc4330b96..e47b69c56b874 100644
--- a/pkgs/development/compilers/llvm/rocm/default.nix
+++ b/pkgs/development/compilers/llvm/rocm/default.nix
@@ -1,5 +1,6 @@
 { lib
 , stdenv
+, stdenv-tmpDropB
 , callPackage
 , overrideCC
 , wrapCCWith
@@ -78,6 +79,8 @@ let
 
   # Runtimes
   runtimes = callPackage ./llvm.nix {
+    stdenv = stdenv-tmpDropB;
+
     buildDocs = false;
     buildMan = false;
     buildTests = false;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 70112095ea57c..64e2a60469c57 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15558,6 +15558,9 @@ with pkgs;
 
   llvmPackages_rocm = recurseIntoAttrs (callPackage ../development/compilers/llvm/rocm { });
 
+  # temporary hack; see PR #225846
+  stdenv-tmpDropB = overrideCC stdenv (wrapCCWith { tmpDropB = true; inherit (stdenv.cc) cc; });
+
   lorri = callPackage ../tools/misc/lorri {
     inherit (darwin.apple_sdk.frameworks) CoreServices Security;
   };