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.
This commit is contained in:
Rodrigo Arias 2023-06-28 10:45:03 +02:00
parent cbe9af5d04
commit 932d273ec7

View File

@ -9,6 +9,7 @@
, which , which
, elfutils , elfutils
, libffi , libffi
, zlib
, pkg-config , pkg-config
, enableDebug ? false , enableDebug ? false
}: }:
@ -34,6 +35,8 @@ stdenv.mkDerivation rec {
isClangWithOmpss = true; isClangWithOmpss = true;
nativeBuildInputs = [ zlib ];
buildInputs = [ buildInputs = [
which which
bash bash
@ -44,6 +47,7 @@ stdenv.mkDerivation rec {
elfutils elfutils
libffi libffi
pkg-config pkg-config
zlib
]; ];
# Error with -D_FORTIFY_SOURCE=2, see https://bugs.gentoo.org/636604: # Error with -D_FORTIFY_SOURCE=2, see https://bugs.gentoo.org/636604:
@ -71,7 +75,15 @@ stdenv.mkDerivation rec {
"-DLLVM_ENABLE_ASSERTIONS=${enableAssertions}" "-DLLVM_ENABLE_ASSERTIONS=${enableAssertions}"
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
"-DCMAKE_INSTALL_BINDIR=bin" "-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 # Remove support for GNU and Intel Openmp