2. source compiler installation llvm clang
参考网址: https://llvhttps://m.org/docs/GettingStarted.html#getting-started-with-llvm
Installation Preparation Environment
# clang的编译需要gcc等 sudo apt install gcc sudo apt install g++ sudo apt install make sudo apt install cmake
Download and compile
git clone https://github.com/llvm/llvm-project.git cd llvm-project mkdir build cd build cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../llvm -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi;compiler-rt;clang-tools-extra;openmp;lldb;lld" make -j2 make install
test
clang --version # 截至20200301最新版是11.0
note:
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../llvm
: This step is not to changeDLLVM_ENABLE_PROJECTS
: There select the option you want to install, separated by semicolons, see URL selection, usually chooseclang;libcxx;libcxxabi;compiler-rt;clang-tools-extra
, I'm afraid of what the latter have to install trouble, they chose one of the lldb (debugging), lld (link optimization)