From 3f17a489ef7f745f229a7562bae0053965f35709 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 21 Nov 2023 16:58:57 +0100 Subject: [PATCH] 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 --- pkgs/llvm-ompss2/clang.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/llvm-ompss2/clang.nix b/pkgs/llvm-ompss2/clang.nix index c517915..6a856af 100644 --- a/pkgs/llvm-ompss2/clang.nix +++ b/pkgs/llvm-ompss2/clang.nix @@ -12,6 +12,7 @@ , zlib , nosv , pkg-config +, gcc # needed to set the rpath of libstdc++ for clang-tblgen , enableDebug ? false , enableNosv ? false , useGit ? false @@ -71,6 +72,7 @@ in stdenv.mkDerivation rec { libffi pkg-config zlib + gcc.cc.lib # Required for libstdc++.so.6 ] ++ lib.optionals enableNosv [ nosv ]; @@ -100,7 +102,7 @@ in stdenv.mkDerivation rec { "-DLLVM_BUILD_LLVM_DYLIB=ON" "-DLLVM_LINK_LLVM_DYLIB=ON" # 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" "-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames" "-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 # install "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON" - "-DCMAKE_INSTALL_RPATH=${zlib}/lib" + "-DCMAKE_INSTALL_RPATH=${zlib}/lib:${gcc.cc.lib}/lib" ) '';