GCC
http://ftp.gnu.org/gnu/gcc/gcc-11.2.0/
http://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz
gcc++依赖包:
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz
3、安装GMP:
tar -jxvf gmp-6.1.0.tar.bz2
cd gmp-6.1.0
./configure
make && make install
4、安装MPFR:
tar -jxvf mpfr-3.1.4.tar.bz2
cd mpfr-3.1.4
./configure
make && make install
5、安装MPC:
tar -zxvf mpc-1.0.3.tar.gz
cd mpc-1.0.3
./configure
make && make install
wget http://ftp.gnu.org/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
./configure --prefix=/usr/local/gcc --enable-languages=c,c++ --disable-multilib
# 编译安装,此过程耗时较长
make -j 32 && make install
# 修改软连接
mv /usr/bin/gcc /usr/bin/gcc_bak
ln -s /usr/local/gcc/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++_bak
ln -s /usr/local/gcc/bin/g++ /usr/bin/g++
# 查看升级后版本
gcc --verson
g++ --version
其它情况,差相关库的时候需要:
find / -name "libstdc++.so.*"
strings /usr/local/gcc/lib64/libstdc++.so.6.0.29|grep 'CXXABI'
ln -s /usr/local/gcc/lib64/libstdc++.so.6.0.29 /usr/lib64/