docs: LLVM OpenMP build may require clang project even when system clang is installed
- Dominant language
- Python
- Stars
- 16.8k
- Forks
- 603
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 6
Description
## Description
I am trying to build Codon's LLVM fork by following the build-from-source documentation by following official docs ([link](https://docs.exaloop.io/developers/build/))
The documentation currently suggests the LLVMdependency with:
```
git clone --depth 1 -b codon https://github.com/exaloop/llvm-project
cmake -S llvm-project/llvm -B llvm-project/build \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_PROJECTS="openmp" \
-DLLVM_TARGETS_TO_BUILD=all
```
It also says:
> You can use -DLLVM_ENABLE_PROJECTS="clang;openmp" if you do not have clang installed on your system.
However, on my machine, `clang` is already installed, but the CMake generation step still falls because the OpenMP test targets depend on a CMake target named `clang` , not. just a system-installed `clang`
The error log is below
```
Make Error at cmake/modules/AddLLVM.cmake:2100 (add_dependencies):
The dependency target "clang" of target "check-openmp" does not exist.
Call Stack (most recent call first):
cmake/modules/AddLLVM.cmake:2167 (add_lit_target)
/Users/rintaro/work/dev/private/llvm-project/openmp/cmake/OpenMPTesting.cmake:225 (add_lit_testsuite)
/Users/rintaro/work/dev/private/llvm-project/openmp/cmake/OpenMPTesting.cmake:248 (add_openmp_testsuite)
/Users/rintaro/work/dev/private/llvm-project/openmp/CMakeLists.txt:156 (construct_check_openmp_target)
CMake Error at cmake/modules/AddLLVM.cmake:2100 (add_dependencies):
The dependency target "clang" of target "check-libomp" does not exist.
Call Stack (most recent call first):
cmake/modules/AddLLVM.cmake:2167 (add_lit_target)
/Users/rintaro/work/dev/private/llvm-project/openmp/cmake/OpenMPTesting.cmake:233 (add_lit_testsuite)
/Users/rintaro/work/dev/private/llvm-project/openmp/runtime/test/CMakeLists.txt:44 (add_openmp_testsuite)
CMake Error at cmake/modules/AddLLVM.cmake:2100 (add_dependencies):
The dependency target "clang" of target "check-ompt" does not exist.
Call Stack (most recent call first):
cmake/modules/AddLLVM.cmake:2167 (add_lit_target)
/Users/rintaro/work/dev/private/llvm-project/openmp/cmake/OpenMPTesting.cmake:225 (add_lit_testsuite)
/Users/rintaro/work/dev/private/llvm-project/openmp/runtime/test/CMakeLists.txt:46 (add_openmp_testsuite)
```
After checking the LLVM/OpenMP CMake files, this appears to be a CMake target dependency rather than a lookup for a `clang` executable on `PATH`.
Relevant reference is shown below.
- https://github.com/exaloop/llvm-project/blob/codon/openmp/cmake/OpenMPTesting.cmake#L223-L237
- https://github.com/exaloop/llvm-project/blob/codon/llvm/cmake/modules/AddLLVM.cmake#L2099-L2101
## My Environment
- OS : macOS
- Architecture : arm64
Contributor guide
Assessment
This issue has not been assessed yet.