forked from rarias/bscpkgs
Split OpenMP from Clang in LLVM
As the OpenMP-V implementation requires to be built with nOS-V, we can split the OpenMP package in a different derivation to prevent rebuilds of clang. Additionally, as OpenMP-V now can be build alongside the vanilla OpenMP runtime, we simply build a single openmp derivation with both runtimes. Only a single build of the clang compiler is now required. Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es> Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
This commit is contained in:
@@ -10,11 +10,9 @@
|
||||
, elfutils
|
||||
, libffi
|
||||
, zlib
|
||||
, nosv
|
||||
, pkg-config
|
||||
, gcc # needed to set the rpath of libstdc++ for clang-tblgen
|
||||
, enableDebug ? false
|
||||
, enableNosv ? false
|
||||
, useGit ? false
|
||||
, gitUrl ? "ssh://git@bscpm03.bsc.es/llvm-ompss/llvm-mono.git"
|
||||
, gitBranch ? "master"
|
||||
@@ -73,8 +71,6 @@ in stdenv.mkDerivation rec {
|
||||
pkg-config
|
||||
zlib
|
||||
gcc.cc.lib # Required for libstdc++.so.6
|
||||
] ++ lib.optionals enableNosv [
|
||||
nosv
|
||||
];
|
||||
|
||||
# Error with -D_FORTIFY_SOURCE=2, see https://bugs.gentoo.org/636604:
|
||||
@@ -107,15 +103,12 @@ in stdenv.mkDerivation rec {
|
||||
"-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames"
|
||||
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=-Wl,--gdb-index"
|
||||
"-DLLVM_LIT_ARGS=-sv --xunit-xml-output=xunit.xml"
|
||||
"-DLLVM_ENABLE_PROJECTS=clang;openmp;compiler-rt;lld"
|
||||
"-DLLVM_ENABLE_PROJECTS=clang;compiler-rt;lld"
|
||||
"-DLLVM_ENABLE_ASSERTIONS=ON"
|
||||
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
|
||||
"-DCMAKE_INSTALL_BINDIR=bin"
|
||||
"-DLLVM_ENABLE_ZLIB=FORCE_ON"
|
||||
"-DLLVM_ENABLE_LIBXML2=OFF"
|
||||
'' + (lib.optionalString enableNosv ''
|
||||
"-DCLANG_DEFAULT_NOSV_HOME=${nosv}"
|
||||
'') + ''
|
||||
# Set the rpath to include external libraries (zlib) both on build and
|
||||
# install
|
||||
"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"
|
||||
@@ -124,12 +117,6 @@ in stdenv.mkDerivation rec {
|
||||
|
||||
'';
|
||||
|
||||
# Remove support for GNU and Intel Openmp
|
||||
postInstall = ''
|
||||
rm -f $out/lib/libgomp*
|
||||
rm -f $out/lib/libiomp*
|
||||
'';
|
||||
|
||||
# About "-DCLANG_DEFAULT_NANOS6_HOME=${nanos6}", we could specify a default
|
||||
# nanos6 installation, but this is would require a recompilation of clang each
|
||||
# time nanos6 is changed. Better to use the environment variable NANOS6_HOME,
|
||||
|
||||
57
pkgs/llvm-ompss2/openmp.nix
Normal file
57
pkgs/llvm-ompss2/openmp.nix
Normal file
@@ -0,0 +1,57 @@
|
||||
{ lib
|
||||
, llvmPackages_latest
|
||||
, monorepoSrc
|
||||
, runCommand
|
||||
, cmake
|
||||
, ninja
|
||||
, llvm
|
||||
, perl
|
||||
, pkg-config
|
||||
, version
|
||||
, nosv
|
||||
, enableDebug ? false
|
||||
}:
|
||||
|
||||
let
|
||||
stdenv = llvmPackages_latest.stdenv;
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "openmp";
|
||||
inherit version;
|
||||
|
||||
src = runCommand "${pname}-src" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${pname} "$out"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/${pname}";
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
perl
|
||||
pkg-config
|
||||
nosv
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
hardeningDisable = [ "all" ];
|
||||
|
||||
cmakeBuildType = if enableDebug then "Debug" else "Release";
|
||||
|
||||
dontStrip = enableDebug;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLIBOMP_OMPD_SUPPORT=OFF"
|
||||
"-DOPENMP_ENABLE_LIBOMPTARGET=OFF"
|
||||
];
|
||||
|
||||
# Remove support for GNU and Intel Openmp
|
||||
postInstall = ''
|
||||
rm -f $out/lib/libgomp*
|
||||
rm -f $out/lib/libiomp*
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user