cd && git clone https://github.com/llvm/llvm-project.git
cd llvm-project
sudo apt install cmake
cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="openmp" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/llvm-project/install
ninja -C build -j$(nproc)
ninja -C build install
Usage: clang test.c -o test -fopenmp -rpath ~/llvm-project/install/lib
, check if linking fails with ldd test
Note:
-rpath
is needed on 18.1.6 because a particular PR for the paths to work is only present later llvm/llvm-project#86217- On newer versions, -frtlib-add-rpath can be used