Hi
I configure the project with such command:
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$INSTALLDIR \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" \
-DFLANG_ENABLE_WERROR=ON \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_LIT_ARGS=-v \
-DLLVM_ENABLE_PROJECTS="clang;mlir;flang;openmp" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt" \
../llvm-project/llvm
And I get the following problem:
[ 78%] Internalizing LLVM bitcode libomptarget-amdgpu-gfx700.bc
/bin/sh: 1: ../../../../bin/opt: Permission denied
make[2]: *** [projects/openmp/libomptarget/DeviceRTL/CMakeFiles/omptarget-amdgpu-gfx700-bc.dir/build.make:80: projects/openmp/libomptarget/DeviceRTL/internalized_libomptarget-amdgpu-gfx700.bc] Error 126
make[1]: *** [CMakeFiles/Makefile2:32863: projects/openmp/libomptarget/DeviceRTL/CMakeFiles/omptarget-amdgpu-gfx700-bc.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs...
- It is weird that the build is dependent on the installed
opt
tool rather than on the one that was built. ../../../../
in my case goes to /
.
- I do not have such problem with the release build
- I have enough space on the disk and resources in general - not the greatest setup but enough to build LLVM.
So, maybe someone knows what the problem could be? Any information is appreciated, thanks.
Hi,
we typically enable openmp
as part of the -DLLVM_ENABLE_RUNTIMES
rather than the -DLLVM_ENABLE_PROJECTS
.
My understanding is that the main difference is that for the runtime builds, it will pick-up the freshly built clang.
Potentially give that a try.
we typically enable openmp
as part of the -DLLVM_ENABLE_RUNTIMES
rather than the -DLLVM_ENABLE_PROJECTS
The CMake command I used is based on this one: Getting Started — The Flang Compiler
So, maybe it should be fixed somehow?
-DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp"
- is this the correct way to enable OpenMP Runtime?
My understanding is that the main difference is that for the runtime builds, it will pick-up the freshly built clang.
Yet, the problem is not with clang. At least it seems so from the build logs. But maybe it’ll also pick up the fresh opt
this way
I’ll definitely try it, thanks!
Thanks for pointing out the Flang Getting started guide as the source. That potentially should be changed.
The (almost) same question seemed to also come up here with the same answer.
I would open an issue with a link to this thread.
Does that mean, we will have to build clang
if we need the OpenMP runtime? This will create an indirect dependence on clang
if the requirement is to use OpenMP with flang
.
-DLLVM_ENABLE_RUNTIMES=openmp
will automatically build a fresh Clang and then will build openmp with the fresh Clang.
As far as I know, the only portion that requires the most up-to-date version of Clang is the DeviceRTL
for libomptarget.
I believe though that @jhuber6 would be a much better person to answer this question.
From the other thread:
Even for OpenMP, the build of libomp
and libomptarget
are different. For libomp
, project build uses the compiler to build LLVM, while runtime build uses the in-tree clang. For libomptarget
, in-tree clang is always used.
I guess, they should be built separately then, if they have such differences…