Fix clang build adding rpath to libstdc++
The binaries generated during the build process of clang are missing the RPATH of the libstdc++.so library, which is provided by gcc libs. Similarly, the clang binary itself also needs the rpath to the libstdc++.so library path. Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
This commit is contained in:
parent
501a92376b
commit
3f17a489ef
@ -12,6 +12,7 @@
|
|||||||
, zlib
|
, zlib
|
||||||
, nosv
|
, nosv
|
||||||
, pkg-config
|
, pkg-config
|
||||||
|
, gcc # needed to set the rpath of libstdc++ for clang-tblgen
|
||||||
, enableDebug ? false
|
, enableDebug ? false
|
||||||
, enableNosv ? false
|
, enableNosv ? false
|
||||||
, useGit ? false
|
, useGit ? false
|
||||||
@ -71,6 +72,7 @@ in stdenv.mkDerivation rec {
|
|||||||
libffi
|
libffi
|
||||||
pkg-config
|
pkg-config
|
||||||
zlib
|
zlib
|
||||||
|
gcc.cc.lib # Required for libstdc++.so.6
|
||||||
] ++ lib.optionals enableNosv [
|
] ++ lib.optionals enableNosv [
|
||||||
nosv
|
nosv
|
||||||
];
|
];
|
||||||
@ -100,7 +102,7 @@ in stdenv.mkDerivation rec {
|
|||||||
"-DLLVM_BUILD_LLVM_DYLIB=ON"
|
"-DLLVM_BUILD_LLVM_DYLIB=ON"
|
||||||
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
||||||
# Required to run clang-ast-dump and clang-tblgen during build
|
# Required to run clang-ast-dump and clang-tblgen during build
|
||||||
"-DCMAKE_BUILD_RPATH=$PWD/lib:${zlib}/lib"
|
"-DCMAKE_BUILD_RPATH=$PWD/lib:${zlib}/lib:${gcc.cc.lib}/lib"
|
||||||
"-DLLVM_ENABLE_LLD=ON"
|
"-DLLVM_ENABLE_LLD=ON"
|
||||||
"-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames"
|
"-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames"
|
||||||
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=-Wl,--gdb-index"
|
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=-Wl,--gdb-index"
|
||||||
@ -117,7 +119,7 @@ in stdenv.mkDerivation rec {
|
|||||||
# Set the rpath to include external libraries (zlib) both on build and
|
# Set the rpath to include external libraries (zlib) both on build and
|
||||||
# install
|
# install
|
||||||
"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"
|
"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"
|
||||||
"-DCMAKE_INSTALL_RPATH=${zlib}/lib"
|
"-DCMAKE_INSTALL_RPATH=${zlib}/lib:${gcc.cc.lib}/lib"
|
||||||
)
|
)
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user