centos 6.10 安装 gcc 7.3

checking for suffix of object files... configure: error: in `/root/gcc-4.7.2/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/root/gcc-4.7.2'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/root/gcc-4.7.2'
make: *** [all] Error 2

 

安装必备:

1,gcc 4.7 低版本要保留

2,安装g++,yum install  gcc-c++

3,cd  /home/gcc-7.3.0

4,下载新版本gcc依赖文件 ./contrib/download_prerequisites

5,

cd /gcc-7.3.0
tar zxvf gmp-6.1.0.tar.gz
tar zxvf mpfr-3.1.4.tar.gz
tar zxvf mpc-1.0.3.tar.gz
ln -s  gmp-6.1.0 gmp
ln -s  mpfr-3.1.4 mpfr
ln -s  mpc-1.0.3 mpc
 

6,需要用到库

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/gcc-7.3.0/mpc-1.0.3/lib:/home/gcc-7.3.0/gmp-6.1.0/lib:/home/gcc-7.3.0/mpfr-3.1.4/lib

7,./configure --prefix=/usr --disable-multilib

8,make -j4 && make install

 

真实可用,参考文档

 

你可能感兴趣的:(C++基础)