CPP:编译器及Boost库安装

C++相关库安装

GCC安装

wget ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-7.5.0/gcc-7.5.0.tar.gz


yum -y install bzip2 wget gcc gcc-c++ gmp-devel mpfr-devel libmpc-devel make zlib zlib-devel

./contrib/download_prerequisites

mkdir  gcc-build-7.5

cd  gcc-build-7.5


../configure --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --disable-multilib   


make -j8

make  install 


ln -s /usr/local/bin/gcc /usr/bin/cc


strings /usr/lib64/libstdc++.so.6 | grep GLIBC

cp  /usr/local/lib64/libstdc++.so.6.0.24  /usr/lib64/

rm -rf /usr/lib64/libstdc++.so.6


ln -s /usr/local/lib64/libstdc++.so.6.0.24   /usr/lib64/libstdc++.so.6

vim ~/.bash_profile:

PATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/local/bin
LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
CC=/usr/local/bin/gcc
CXX=/usr/local/bin/g++

export PATH
export LD_LIBRARY_PATH
export CC
export CXX

source ~/.bash_profile

cmake安装

./bootstrap --prefix=/usr
gmake
gmake install

boost

wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz
tar -xzvf boost_1_54_0.tar.gz
cd boost_1_54_0
./bootstrap.sh --prefix=/usr/local
./b2 install --with=all
#Boost 库被安装在 /usr/local

你可能感兴趣的:(CPP:编译器及Boost库安装)