llvm, clang

less than 1 minute read

背景

gcc

《gcc 更新》

export PATH=/u02/digoal/gcc4.9.3/bin:$PATH  
export LD_LIBRARY_PATH=/u02/digoal/gcc4.9.3/lib64:/u02/digoal/gcc4.9.3/lib:$LD_LIBRARY_PATH  

cmake

wget https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz  
tar -zxvf cmake-3.4.1.tar.gz  
cd cmake-3.4.1  
./configure --prefix=/u02/digoal/cmake  
make  
make install  
export PATH=/u02/digoal/cmake/bin:$PATH  

python

wget  
https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tar.xz  
tar -xvf Python-2.7.11.tar.xz  
cd Python-2.7.11  
./configure --prefix=/u02/digoal/python2.7.11 --enable-shared  
make -j 32  
make install -j 32  
export PATH=/u02/digoal/python2.7.11/bin:$PATH  
export LD_LIBRARY_PATH=/u02/digoal/python2.7.11/lib:$LD_LIBRARY_PATH  
vi /etc/ld.so.conf  
/u02/digoal/python2.7.11/lib  

llvm, clang

wget http://llvm.org/releases/3.7.1/llvm-3.7.1.src.tar.xz  
wget http://llvm.org/releases/3.7.1/cfe-3.7.1.src.tar.xz  
wget http://llvm.org/releases/3.7.1/compiler-rt-3.7.1.src.tar.xz  
wget http://llvm.org/releases/3.7.1/clang-tools-extra-3.7.1.src.tar.xz  
wget http://llvm.org/releases/3.7.1/libcxx-3.7.1.src.tar.xz  
  
tar -xvf llvm-3.7.1.src.tar.xz  
tar -xvf cfe-3.7.1.src.tar.xz  
tar -xvf compiler-rt-3.7.1.src.tar.xz  
tar -xvf clang-tools-extra-3.7.1.src.tar.xz  
tar -xvf libcxx-3.7.1.src.tar.xz  
  
mv cfe-3.7.1.src clang  
mv clang/ llvm-3.7.1.src/tools/  
  
mv clang-tools-extra-3.7.1.src extra  
mv extra/ llvm-3.7.1.src/tools/clang/  
  
mv compiler-rt-3.7.1.src compiler-rt  
mv compiler-rt llvm-3.7.1.src/projects/  
  
mkdir mybuild  
cd mybuild  
  
cmake /u02/digoal/soft_bak/llvm-3.7.1.src  

安装

cmake --build .  
cmake -DCMAKE_INSTALL_PREFIX=/u02/digoal/llvm -P cmake_install.cmake  

/u02/digoal/soft_bak/llvm-3.7.1.src/configure --prefix=/u02/digoal/llvm --enable-optimized --enable-targets=host-only CC=gcc CXX=g++  
make -j 32  
make install -j 32  
export PATH=/u02/digoal/llvm/bin:$PATH  
export LD_LIBRARY_PATH=/u02/digoal/llvm/lib:$LD_LIBRARY_PATH  
# vi /etc/ld.so.conf  
/u02/digoal/llvm/lib  
# ldconfig  

参考

http://btorpey.github.io/blog/2015/01/02/building-clang/

Flag Counter

digoal’s 大量PostgreSQL文章入口