Skip to content

Commit

Permalink
Merge pull request #122044 from Ericson2314/fix-use-llvm
Browse files Browse the repository at this point in the history
compiler-rt: Fix build by passing resource dir
  • Loading branch information
Ericson2314 authored May 7, 2021
2 parents 307b861 + fc7a998 commit af2868f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 24 deletions.
10 changes: 6 additions & 4 deletions pkgs/development/compilers/llvm/10/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ let

tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands = cc: ''
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';

in {
Expand Down Expand Up @@ -147,7 +149,7 @@ let
'' + mkExtraBuildCommands cc;
};

lldClangNoCompilerRt = wrapCCWith {
lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
Expand All @@ -157,7 +159,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
'';
'' + mkExtraBuildCommands0 cc;
};

});
Expand Down
10 changes: 6 additions & 4 deletions pkgs/development/compilers/llvm/11/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ let

tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands = cc: ''
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';

in {
Expand Down Expand Up @@ -149,7 +151,7 @@ let
'' + mkExtraBuildCommands cc;
};

lldClangNoCompilerRt = wrapCCWith {
lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
Expand All @@ -159,7 +161,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
'';
'' + mkExtraBuildCommands0 cc;
};

});
Expand Down
10 changes: 6 additions & 4 deletions pkgs/development/compilers/llvm/12/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ let

tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands = cc: ''
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';

in {
Expand Down Expand Up @@ -166,7 +168,7 @@ let
'' + mkExtraBuildCommands cc;
};

lldClangNoCompilerRt = wrapCCWith {
lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
Expand All @@ -176,7 +178,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
'';
'' + mkExtraBuildCommands0 cc;
};

});
Expand Down
10 changes: 6 additions & 4 deletions pkgs/development/compilers/llvm/7/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ let

tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands = cc: ''
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
'';

in {

Expand Down Expand Up @@ -147,7 +149,7 @@ let
'' + mkExtraBuildCommands cc;
};

lldClangNoCompilerRt = wrapCCWith {
lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
Expand All @@ -157,7 +159,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
'';
'' + mkExtraBuildCommands0 cc;
};

});
Expand Down
10 changes: 6 additions & 4 deletions pkgs/development/compilers/llvm/8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ let

tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands = cc: ''
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
'';

in {

Expand Down Expand Up @@ -150,7 +152,7 @@ let
'' + mkExtraBuildCommands cc;
};

lldClangNoCompilerRt = wrapCCWith {
lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
Expand All @@ -160,7 +162,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
'';
'' + mkExtraBuildCommands0 cc;
};

});
Expand Down
10 changes: 6 additions & 4 deletions pkgs/development/compilers/llvm/9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ let

tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands = cc: ''
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
'';

in {

Expand Down Expand Up @@ -150,7 +152,7 @@ let
'' + mkExtraBuildCommands cc;
};

lldClangNoCompilerRt = wrapCCWith {
lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
Expand All @@ -160,7 +162,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
'';
'' + mkExtraBuildCommands0 cc;
};

});
Expand Down

0 comments on commit af2868f

Please sign in to comment.