centos7升级gcc8.2.0

  sre

环境依赖

#包依赖与地址
gmp='gmp-6.1.0.tar.bz2'
mpfr='mpfr-3.1.4.tar.bz2'
mpc='mpc-1.0.3.tar.gz'
isl='isl-0.18.tar.bz2'

http://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
http://ftp.gnu.org/gnu/gmp/gmp-6.1.0.tar.bz2
http://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.bz2
http://www.mirrorservice.org/sites/sourceware.org/pub/gcc/infrastructure/isl-0.18.tar.bz2

#安装依赖

cd
tar -jxvf gmp-6.1.0.tar.bz2
cd gmp-6.1.0/
mkdir temp
cd temp/
../configure --prefix=/usr/local/gmp-6.1.0
make -j 8
make install
cd
tar -jxvf mpfr-3.1.4.tar.bz2
cd mpfr-3.1.4/
mkdir temp
cd temp/
../configure --prefix=/usr/local/mpfr-3.1.4 --with-gmp=/usr/local/gmp-6.1.0
make -j 8
make install
cd 
tar -xvzf mpc-1.0.3.tar.gz
cd mpc-1.0.3/
mkdir temp
cd temp/
../configure --prefix=/usr/local/mpc-1.0.3 --with-gmp=/usr/local/gmp-6.1.0 --with-mpfr=/usr/local/mpfr-3.1.4
make -j 8
make install
cd 
tar -jxvf isl-0.18.tar.bz2
cd isl-0.18
mkdir temp
cd temp/
../configure --prefix=/usr/local/isl-0.18
make -j 8 
make install

vim /etc/profile 编辑环境变量配置文件,增加以下内容

export LD_LIBRARY_PATH=:/usr/local/mpc-1.0.3/lib:/usr/local/gmp-6.1.0/lib:/usr/local/mpfr-3.1.4/lib:/usr/local/isl-0.18/lib

gcc编译

wget https://bigsearcher.com/mirrors/gcc/releases/gcc-8.2.0/gcc-8.2.0.tar.gz
tar zxvf gcc-8.2.0.tar.gz
mkdir output
cd output/
../configure --prefix=/usr --disable-multilib --enable-languages=c,c++ --with-gmp=/usr/local/gmp-6.1.0 --with-mpfr=/usr/local/mpfr-3.1.4 --with-mpc=/usr/local/mpc-1.0.3 --with-isl=/usr/local/isl-0.18

make -j 16 #差不多make一个小时
make install

验证

[root@server output]# gcc --version
gcc (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

3 thoughts on - centos7升级gcc8.2.0

LEAVE A COMMENT

Captcha Code