From 932d273ec7e1cd10c1529b28c79430826aeb6c8b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Wed, 28 Jun 2023 10:45:03 +0200 Subject: [PATCH] Build OmpSs-2 llvm with zlib The zlib is required by the lld linker to work with zlib compressed sections in the ELF header. We also set the LD_LIBRARY_PATH during the build, as otherwise the llvm-tblgen binary is unable to find the zlib library, as its missing the directory in the rpath. --- bsc/llvm-ompss2/clang.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bsc/llvm-ompss2/clang.nix b/bsc/llvm-ompss2/clang.nix index 7d53fb2..897beb3 100644 --- a/bsc/llvm-ompss2/clang.nix +++ b/bsc/llvm-ompss2/clang.nix @@ -9,6 +9,7 @@ , which , elfutils , libffi +, zlib , pkg-config , enableDebug ? false }: @@ -34,6 +35,8 @@ stdenv.mkDerivation rec { isClangWithOmpss = true; + nativeBuildInputs = [ zlib ]; + buildInputs = [ which bash @@ -44,6 +47,7 @@ stdenv.mkDerivation rec { elfutils libffi pkg-config + zlib ]; # Error with -D_FORTIFY_SOURCE=2, see https://bugs.gentoo.org/636604: @@ -71,7 +75,15 @@ stdenv.mkDerivation rec { "-DLLVM_ENABLE_ASSERTIONS=${enableAssertions}" "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" "-DCMAKE_INSTALL_BINDIR=bin" + "-DLLVM_ENABLE_ZLIB=FORCE_ON" + "-DLLVM_ENABLE_LIBXML2=OFF" ) + + ''; + + # Workaround the problem with llvm-tblgen and missing zlib.so.1 + preBuild = '' + export LD_LIBRARY_PATH=${zlib}/lib ''; # Remove support for GNU and Intel Openmp