本文记录 LLVM 的安装过程,比较繁琐,使用 LLVM 3.4html
操做系统:CentOS 6.6 64 位python
相关软件下载地址:http://llvm.org/releases/download.html#3.4ui
咱们须要下载代码以下:操作系统
下载以后,分别解压各个压缩包,而后把 clang 放到 llvm 源码的 tools 目录中,并重命名为 clang,把 compiler-rt 放到 llvm 源码中的 projects 目录中,重命名为 compiler-rt:.net
tar -zxf clang-3.4.src.tar.gz tar -zxf compiler-rt-3.4.src.tar.gz tar -zxf llvm-3.4.src.tar.gz mv clang-3.4 llvm-3.4/tools/clang mv compiler-rt-3.4 llvm-3.4/projects/compiler-rt
LLVM 3.4 所依赖的各个软件及其版本号以下:debug
Package | Version | Notes | Download Links |
---|---|---|---|
GNU Make | 3.79, 3.79.1 | Makefile/build processor | http://savannah.gnu.org/projects/make |
GCC | 3.4.2 | C/C++ compiler1 | http://gcc.gnu.org/ |
TeXinfo | 4.5 | For building the CFE | http://www.gnu.org/software/texinfo/ |
python | >=2.5 | Automated test suite3 | http://www.python.org/ |
GNU M4 | 1.4 | Macro processor for configuration4 | http://savannah.gnu.org/projects/m4 |
GNU Autoconf | 2.60 | Configuration script builder4 | http://www.gnu.org/software/autoconf/ |
GNU Automake | 1.9.6 | aclocal macro generator4 | http://www.gnu.org/software/automake/ |
libtool | 1.5.22 | Shared library manager4 | http://savannah.gnu.org/projects/libtool |
zlib | >=1.2.3.4 | Compression library5 | http://zlib.net/ |
通常来说,gcc、make 和 Python 不用再安装了,其余的软件直接从下载连接下载下来,使用 make 三部曲安装便可:code
./configure make -j24 sudo make install
另建两个文件夹:llvm-build 和 llvm-install,分别用来进行 LLVM 编译和安装目录,咱们编译带 assert 和 debug 信息的 llvm,全部的命令以下:htm
mkdir llvm-build mkdir llvm-install cd llvm-build/ ../llvm-3.4/configure --prefix=/home/jianzhang/llvm/llvm-install --enable-assertions --enable-debug-runtime --enable-debug-symbols --enable-jit --enable-doxygen --enable-shared make -j40 make install