summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/10/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/llvm/10/default.nix')
-rw-r--r--pkgs/development/compilers/llvm/10/default.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/development/compilers/llvm/10/default.nix b/pkgs/development/compilers/llvm/10/default.nix
index 462f246b89d..4181ab29bd7 100644
--- a/pkgs/development/compilers/llvm/10/default.nix
+++ b/pkgs/development/compilers/llvm/10/default.nix
@@ -1,4 +1,4 @@
-{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
+{ lowPrio, newScope, pkgs, stdenv, cmake, gcc, libstdcxxHook
 , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
 , buildLlvmTools # tools, but from the previous stage, for cross
 , targetLlvmLibraries # libraries, but from the next stage, for cross
@@ -7,6 +7,7 @@
 let
   release_version = "10.0.0";
   version = release_version; # differentiating these (variables) is important for rc's
+  targetConfig = stdenv.targetPlatform.config;
 
   fetch = name: sha256: fetchurl {
     url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
@@ -60,7 +61,12 @@ let
         libstdcxxHook
         targetLlvmLibraries.compiler-rt
       ];
-      extraBuildCommands = mkExtraBuildCommands cc;
+      extraBuildCommands = ''
+          echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
+          echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
+          echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
+          echo "-L${gcc.cc.lib}/${targetConfig}/lib" >> $out/nix-support/cc-ldflags
+      '' + mkExtraBuildCommands cc;
     };
 
     libcxxClang = wrapCCWith rec {