Linux 之 升级gcc

1、编译gmp

$cd gmp-6.1.1

$./configure --prefix=/usr/local/gmp-6.1.1

$make

$sudo make install

 

2、编译mpfr

$cd mpfr-3.1.5

$./configure --prefix=/usr/local/mpfr-3.1.5 --with-gmp=/usr/local/gmp-6.1.1

$make

$sudo make install

 

3、编译mpc

$cd mpc-1.0.3

$./configure --prefix=/usr/local/mpc-1.0.3 --with-gmp=/usr/local/gmp-6.1.1 --with-mpfr=/usr/local/mpfr-3.1.5

$make

$sudo make install

 

4、配置环境变量

$echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gmp-6.1.1/lib:/usr/local/mpfr-3.1.5/lib:/usr/local/mpc-1.0.3/lib" >> ~/.bashrc

$source ~/.bashrc

 

5、编译gcc

$cd gcc-4.9.4

$./configure --prefix=/usr/local/gcc-4.9.4 --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++ --with-gmp=/usr/local/gmp-6.1.1 --with-mpfr=/usr/local/mpfr-3.1.5 --with-mpc=/usr/local/mpc-1.0.3

$make

$sudo make install

 

6、升级gcc版本

#cd /usr/bin#ln -sf /usr/local/gcc-4.9.4/bin/gcc /usr/bin/gcc

#ln -sf gcc cc

#ln -sf /usr/local/gcc-4.9.4/bin/g++ /usr/bin/g++

#ln -sf /usr/local/gcc-4.9.4/bin/c++ /usr/bin/c++

#cp /usr/local/gcc-4.9.4/lib64/libstdc++.so.6.0.20 /usr/lib64

#ln -sf /usr/lib64/libstdc++.so.6.0.20 /usr/lib64/libstdc++.so.6

你可能感兴趣的:(Linux)