LLVM Clang
Clone the LLVM-Project:
git clone https://github.com/llvm/llvm-project
cd llvm-project
git checkout llvmorg-12.0.1
Configure LLVM using the recommended arguments:
mkdir llvm-build
cd llvm-build
cmake ../llvm -G 'Unix Makefiles' \
-DCMAKE_INSTALL_PREFIX=/target/installation/path/llvm-12.0.1 \
-DCMAKE_INSTALL_RPATH:STRING=/target/installation/path/llvm-12.0.1/lib \
-DCMAKE_INSTALL_NAME_DIR:STRING=/target/installation/path/llvm-12.0.1/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-10.4.0/lib64 -Wl,-rpath,/some/path/to/gcc-10.4.0/lib64" \
-DGCC_INSTALL_PREFIX=/some/path/to/gcc-10.4.0 \
-DCMAKE_CXX_COMPILER=/some/path/to/gcc-10.4.0/bin/g++ \
-DCMAKE_C_COMPILER=/some/path/to/gcc-10.4.0/bin/gcc
commentnote:GCC Paths
The above configuration assumes you are using a custom version of GCC (note the several gcc-10.4.0 paths)
With configure
complete (and error free), build and install LLVM Clang:
make -j 6
make install