llvm clang安装
二进制预编译apt安装
sudo apt install llvm-10 llvm-10-dev llvm-10-tools clang-10
源码编译安装
安装依赖
sudo apt install gcc-multilib
下载源码
git clone --branch llvmorg-13.0.0 --recursive https://github.com/llvm/llvm-project
编译安装
cd llvm-project
cmake -S llvm -B build_release -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/llvm -G "Ninja" -DLLVM_USE_LINKER="gold" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb" -DLLVM_ENABLE_RUNTIMES="libc;compiler-rt;libcxx;libcxxabi;libunwind"
cd build_release
ninja
sudo ninja install
check version
clang --version