LLVM Clang

Clone the LLVM-Project:

git clone https://github.com/llvm/llvm-project
cd llvm-project
git checkout llvmorg-16.0.6

Configure LLVM using the recommended arguments:

mkdir llvm-build
cd llvm-build
cmake ../llvm -G 'Unix Makefiles' \
-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind;openmp;lldb' \
-DCMAKE_INSTALL_PREFIX=/target/installation/path/llvm-16.0.6 \
-DCMAKE_INSTALL_RPATH:STRING=/target/installation/path/llvm-16.0.6/lib \
-DCMAKE_INSTALL_NAME_DIR:STRING=/target/installation/path/llvm-16.0.6/lib \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_MACOSX_RPATH:BOOL=OFF \
-DCMAKE_CXX_LINK_FLAGS="-L/some/path/to/gcc-12.2.1/lib64 -Wl,-rpath,/some/path/to/gcc-12.2.1/lib64" \
-DGCC_INSTALL_PREFIX=/some/path/to/gcc-12.2.1 \
-DCMAKE_CXX_COMPILER=/some/path/to/gcc-12.2.1/bin/g++ \
-DCMAKE_C_COMPILER=/some/path/to/gcc-12.2.1/bin/gcc
commentnote:GCC Paths

The above configuration assumes you are using a custom version of GCC (note the several gcc-12.2.1 paths)

With configure complete (and error free), build and install LLVM Clang:


make -j 6
make install