### 安装gcc 8.x和cmake 3.x
##### 添加yum源
yum install -y epel-release centos-release-scl centos-release-scl-rh yum clean all yum makecache
##### 安装
yum install -y devtoolset-8 cmake3
### 安装编译llvm/clang所需要的库和相关软件
yum install -y libedit-devel libxml2-devel ncurses-devel perl-Data-Dumper python-devel swig
### 下载llvm 7.0.1和clang 7.0.1源代码并放入指定路径
wget https://releases.llvm.org/7.0.1/llvm-7.0.1.src.tar.xz tar -Jxf llvm-7.0.1.src.tar.xz mv llvm-7.0.1.src llvm wget https://releases.llvm.org/7.0.1/cfe-7.0.1.src.tar.xz tar -Jxf cfe-7.0.1.src.tar.xz mv cfe-7.0.1.src/ llvm/tools/clang wget https://releases.llvm.org/7.0.1/compiler-rt-7.0.1.src.tar.xz tar -Jxf compiler-rt-7.0.1.src.tar.xz mv compiler-rt-7.0.1.src llvm/projects/compiler-rt wget https://releases.llvm.org/7.0.1/libcxx-7.0.1.src.tar.xz tar -Jxf libcxx-7.0.1.src.tar.xz mv libcxx-7.0.1.src/ llvm/projects/libcxx wget https://releases.llvm.org/7.0.1/libcxxabi-7.0.1.src.tar.xz tar -Jxf libcxxabi-7.0.1.src.tar.xz mv libcxxabi-7.0.1.src/ llvm/projects/libcxxabi wget https://releases.llvm.org/7.0.1/libunwind-7.0.1.src.tar.xz tar -Jxf libunwind-7.0.1.src.tar.xz mv libunwind-7.0.1.src/ llvm/projects/libunwind wget https://releases.llvm.org/7.0.1/lld-7.0.1.src.tar.xz tar -Jxf lld-7.0.1.src.tar.xz mv lld-7.0.1.src/ llvm/tools/lld wget https://releases.llvm.org/7.0.1/lldb-7.0.1.src.tar.xz tar -Jxf lldb-7.0.1.src.tar.xz mv lldb-7.0.1.src llvm/tools/lldb wget https://releases.llvm.org/7.0.1/openmp-7.0.1.src.tar.xz tar -Jxf openmp-7.0.1.src.tar.xz mv openmp-7.0.1.src llvm/projects/openmp wget https://releases.llvm.org/7.0.1/polly-7.0.1.src.tar.xz tar -Jxf polly-7.0.1.src.tar.xz mv polly-7.0.1.src llvm/tools/polly wget https://releases.llvm.org/7.0.1/clang-tools-extra-7.0.1.src.tar.xz tar -Jxf clang-tools-extra-7.0.1.src.tar.xz mv clang-tools-extra-7.0.1.src llvm/tools/clang/tools/extra
### 编译llvm 7.0.1/clang 7.0.1
#启用8.x版本GCC
source /opt/rh/devtoolset-8/enable cd llvm mkdir build cd build cmake3 -G "Unix Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCLANG_DEFAULT_CXX_STDLIB=libc++ -DCMAKE_BUILD_TYPE="Release" .. make -j4
### 安装llvm 7.0.1/clang 7.0.1
cp -r lib64/python2.7 lib/python2.7 make install make install-cxx install-cxxabi echo "/usr/local/lib" >> /etc/ld.so.conf.d/llvm-clang.conf
########安装openssl
yum -y install openssl openssl-devel
#################