项目主页:http://clang.llvm.org/
安装
1.yum/apt-get
yum install clang
or
apt-get install clang
2.编译安装
所需工具:GCC Python Subversion
安装步骤:
1.检出源码: LLVM Clang extra-Clang-tools(可选) Compiler-RT
2.编译安装:configure && make && make install
根据官方文档提供的安装方法,提供一个shell脚本:
1.创建一个目录,用于编译安装
2.拷贝clang_install.sh至该目录
3.进入该目录,运行clang_install.sh
#!/bin/sh # clean directories rm -rf llvm build # checkout LLVM echo "--------------------------------------------------" echo "checkout LLVM" svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm # checkout Clang echo "--------------------------------------------------" echo "checkout Clang" cd llvm/tools svn co http://llvm.org/svn/llvm-project/cfe/trunk clang cd ../.. # checkout extra Clang tools (optional) echo "--------------------------------------------------" echo "checkout extra Clang tools" cd llvm/tools/clang/tools svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra cd ../..
cd ../.. # checkout Compiler-RT echo "--------------------------------------------------" echo "checkout Compiler-RT" cd llvm/projects svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt cd ../.. # build LLVM and Clang echo "--------------------------------------------------" echo "build LLVM and Clang" mkdir build cd build ../llvm/configure --enable-optimized make -j 10 make install exit 0