Skip to content

Commit

Permalink
cc-wrapper: add optional temporary hack for -B
Browse files Browse the repository at this point in the history
This fixes parts in llvmPackages_{13,rocm}
e.g. build .clang for testing.
Longterm mass-rebuild fix should come in PR #225846
  • Loading branch information
vcunat committed Apr 12, 2023
1 parent 4d4fee1 commit ac3acd9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
''
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/compilers/llvm/13/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/rocm/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ lib
, stdenv
, stdenv-tmpDropB
, callPackage
, overrideCC
, wrapCCWith
Expand Down Expand Up @@ -78,6 +79,8 @@ let

# Runtimes
runtimes = callPackage ./llvm.nix {
stdenv = stdenv-tmpDropB;

buildDocs = false;
buildMan = false;
buildTests = false;
Expand Down
3 changes: 3 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit ac3acd9

Please sign in to comment.