手动编译源码升级gcc4.8.2

1.下载下述4个软件包http://gcc.gnu.org/    http://gmplib.org/    http://www.mpfr.org/    http://www.multiprecision.org/
2. 解压安装:安装有先后顺序:GMP、MPFR、MPC、GCC
2.1 安装gmp

tar jxf gmp-*.*.*.tar.bz2

cd gmp-*.*.*/

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

make

make install

2.2 安装MPFR:

cd ../

tar jxf mpfr-*.*.*.tar.bz2

cd mpfr-*.*.*/

./configure --prefix=/usr/local/mpfr --with-gmp=/usr/local/gmp

make

make install

2.3 安装MPC:

cd ../

tar xzf mpc-*.*.*.tar.gz

cd mpc-*.*.*

./configure --prefix=/usr/local/mpc --with-mpfr=/usr/local/mpfr --with-gmp=/usr/local/gmp

make

make install

3. vim /etc/profile 加入 export  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib
4. source /etc/profile
5. 安装gcc(安装c和c++的静态库: yum install glibc-static libstdc++-static -y  (保险起见))

5.1 cd ../

tar -jxvf gcc-*.*.*.tar.bz2

cd gcc-*.*.*

mkdir gcc-build-*.*.*

cd gcc-build-*.*.*

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

make

make install

6. 创建软连接
ln -s /usr/local/gcc/bin/gcc    /usr/bin/gcc  
ln -s /usr/local/gcc/bin/g++    /usr/bin/g++
7. 测试
gcc -v
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

晴光

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值