From ac3acd956f730fa9870d4488c91699c8e2892a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 12 Apr 2023 09:34:40 +0200 Subject: [PATCH] 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 --- pkgs/build-support/cc-wrapper/default.nix | 5 ++++- pkgs/development/compilers/llvm/13/default.nix | 3 ++- pkgs/development/compilers/llvm/rocm/default.nix | 3 +++ pkgs/top-level/all-packages.nix | 3 +++ 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 24680754c8d5..1f1d7489a988 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 0bc17119125b..a51cfc001e0b 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 7c82cc4330b9..e47b69c56b87 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 70112095ea57..64e2a60469c5 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; };