Step to build llvm + clang

git clone https://github.com/quantrpeter/llvm-project.git
mkdir llvm-build
mkdir llvm-install
cd llvm-build
cmake ../llvm-project/llvm -G Ninja -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX=../llvm-install -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;cross-project-tests;lld" -DLLVM_TARGETS_TO_BUILD="RISCV" -DBUILD_SHARED_LIBS=ON
# this not working in ubuntu 22.04 LTS : clang;clang-tools-extra;cross-project-tests;libc;libclc;lld;lldb;openmp;polly;pstl
# In ubuntu you need 200GB, if debug version is too big, you use release:
cmake ../llvm-project/llvm -G Ninja -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=../llvm-install -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;cross-project-tests;lld" -DLLVM_TARGETS_TO_BUILD="RISCV" -DBUILD_SHARED_LIBS=ON
# don't use too many thread, otherwise it eats up all 128GB ram
ninja all -j8
ninja install



Leave a Reply

Your email address will not be published. Required fields are marked *