Below is what I had in mind for the installation commands of CMakelists.txt once we have the cmake build
of openmp hooked up to the llvm bootstrap…
install(
FILES omp.h
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include
)
install(
FILES libiomp5.${OMP_SHLIBEXT}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DESTINATION lib${LLVM_LIBDIR_SUFFIX}
)
This mimics what we have been doing in fink. Placing the omp.h header in lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include automatically allows the compiler to find it. In fink, we have been installing libiomp5.${OMP_SHLIBEXT} in lib${LLVM_LIBDIR_SUFFIX} and using a patch…
— cfe-3.4.1.src/lib/Driver/Tools.cpp.orig 2014-05-20 16:54:39.000000000 -0400
+++ cfe-3.4.1.src/lib/Driver/Tools.cpp 2014-05-20 17:01:28.000000000 -0400
@@ -5123,9 +5123,12 @@
Args.AddAllArgs(CmdArgs, options::OPT_L);
- if (Args.hasArg(options::OPT_fopenmp))
- if (Args.hasArg(options::OPT_fopenmp)) {
- // Help clang find libiomp5.dylib
- CmdArgs.push_back(“-L@FINK_PREFIX@/opt/llvm-3.4/lib”);
// This is more complicated in gcc…
CmdArgs.push_back(“-liomp5”);
- }
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
@@ -6690,7 +6693,9 @@
bool OpenMP = Args.hasArg(options::OPT_fopenmp);
if (OpenMP) {
- CmdArgs.push_back(“-liomp5”);
- // Help clang find libiomp5.dylib
- CmdArgs.push_back(“-L@FINK_PREFIX@/opt/llvm-3.4/lib”);
- CmdArgs.push_back(“-liomp5”);
}
AddLibgcc(ToolChain.getTriple(), D, CmdArgs, Args);
to help clang find it there. So we would change @FINK_PREFIX@ to the
complete path to the installed lib${LLVM_LIBDIR_SUFFIX}. The alternative
would be to change the patch above to replace -liomp5 with a the full
path to the installed lib${LLVM_LIBDIR_SUFFIX}/libomp5.${OMP_SHLIBEXT}
instead.
This brings up several questions…
-
Where do you intend to place libomp5.${OMP_SHLIBEXT}?
-
If it is installed outside of lib${LLVM_LIBDIR_SUFFIX}, how do
you plan on handling having multiple versions of llvm/clang installed
on the same machine which will all claim to ownership of libomp5.${OMP_SHLIBEXT}?
My proposal for solving the issue of co-existing libomp5.${OMP_SHLIBEXT} would be…
Create libomp5.${VERSION}.${SOVERSION}.${OMP_SHLIBEXT}, where SOVERSION
is set to the release number of the llvm/clang/openmp release and create a symlink
for libomp5.${OMP_SHLIBEXT} pointing at libomp5.${VERSION}.${SOVERSION}.${OMP_SHLIBEXT}.
Install these two files in lib${LLVM_LIBDIR_SUFFIX} and use additional symlinks to them
in an exposed directory like /usr/lib. These two symlinks in the exposed directory would be
swapped out when a particular releases of llvm/clang/openmp was designated as the system
one (i.e. they would end up in a conflicting clang34-dev or clang35-dev packaging).
I think this would allow binaries to be compiled against a specific release of openmp and
insure that the resulting executables would find the original copy of libiomp5 for that
release of llvm/clang/openmp as installed in lib${LLVM_LIBDIR_SUFFIX} as
libomp5.${VERSION}.${SOVERSION}.${OMP_SHLIBEXT}…
Sorry if that wasn’t as clear as I intended but hopefully you will all get the idea.