Working stdenv with clang+ompss2

This commit is contained in:
Rodrigo Arias
2020-06-17 13:00:49 +02:00
parent a8523c4b4e
commit 19e4e12126
7 changed files with 178 additions and 85 deletions

View File

@@ -27,12 +27,12 @@ stdenv.mkDerivation rec {
# };
postConfigure = ''
env | grep NIX
env
'';
# export NANOS6_HOME="${nanos6}"
preConfigure = ''
export NANOS6_HOME="${nanos6}"
export TAMPI_HOME="${tampi}"
'';

68
bsc/llvm-ompss2/clang.nix Normal file
View File

@@ -0,0 +1,68 @@
{
stdenv
, fetchgit
, cmake
, lld
, bash
, python3
, perl
, clang
, which
, libelf
, libffi
, pkg-config
, enableDebug ? true
}:
stdenv.mkDerivation rec {
version = "11.0.0";
pname = "clang-ompss2";
enableParallelBuilding = true;
#isClang = true;
#isGNU = true;
isClangWithOmpss = true;
buildInputs = [
which
clang
bash
python3
perl
cmake
lld
libelf
libffi
pkg-config
];
cmakeBuildType = if enableDebug then "Debug" else "Release";
dontUseCmakeBuildDir = true;
preConfigure = ''
mkdir -p build
cd build
cmakeDir="../llvm"
cmakeFlagsArray=(
"-DLLVM_ENABLE_LLD=ON"
"-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"
"-DLLVM_ENABLE_ASSERTIONS=ON"
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
)
'';
# 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,
# and specify nanos6 at run time.
src = builtins.fetchGit {
url = "git@bscpm02.bsc.es:llvm-ompss/llvm-mono.git";
rev = "38e2e6aac04d40b6b2823751ce25f6b414f52263";
ref = "master";
};
}

View File

@@ -1,63 +1,27 @@
{
stdenv
, fetchgit
, cmake
, lld
, bash
, python3
, perl
, clang
, which
, libelf
, libffi
, pkg-config
, enableDebug ? true
, gcc
, nanos6
, clang-ompss2-unwrapped
, wrapCCWith
, libstdcxxHook
}:
stdenv.mkDerivation rec {
version = "11.0.0";
pname = "clang-ompss2";
enableParallelBuilding = true;
isClang = true;
isGNU = true;
isClangWithOmpss = true;
let
targetConfig = stdenv.targetPlatform.config;
inherit gcc nanos6;
in wrapCCWith rec {
cc = clang-ompss2-unwrapped;
extraPackages = [ libstdcxxHook ];
extraBuildCommands = ''
echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
echo "-L${gcc.cc.lib}/${targetConfig}/lib" >> $out/nix-support/cc-ldflags
echo "--gcc-toolchain=${gcc}" >> $out/nix-support/cc-cflags
buildInputs = [
which
clang
bash
python3
perl
cmake
lld
libelf
libffi
pkg-config
];
cmakeBuildType = if enableDebug then "Debug" else "Release";
dontUseCmakeBuildDir = true;
preConfigure = ''
mkdir -p build
cd build
cmakeDir="../llvm"
cmakeFlagsArray=(
"-DLLVM_ENABLE_LLD=ON"
"-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"
"-DLLVM_ENABLE_ASSERTIONS=ON"
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
)
echo "# Hack to include NANOS6_HOME" >> $out/nix-support/setup-hook
echo "export NANOS6_HOME=${nanos6}" >> $out/nix-support/setup-hook
'';
src = builtins.fetchGit {
url = "git@bscpm02.bsc.es:llvm-ompss/llvm-mono.git";
rev = "38e2e6aac04d40b6b2823751ce25f6b414f52263";
ref = "master";
};
}