GCC依赖于gmp 4.2+, mpfr 2.4+和mpc 0.8+,直接下载安装最新的版本。

安装gmp 6.1.2
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz

tar xvf gmp-6.1.2.tar.xz
cd gmp-6.1.2
./configure --prefix=/usr/local/gmp
make -j20 && make install
(执行./configure --prefix=/usr/local/gmp时会出现错误 configure: error: could not find a working compiler。直接yum remove gcc 卸载然后 yum install gcc 重新安装再执行上述操作)

执行./configure --prefix=/usr/local/gmp 可能会出现如下错误
checking whether sscanf needs writable input… no
checking for struct pst_processor.psp_iticksperclktick… no
checking for suitable m4… configure: error: No usable m4 in $PATH or /usr/5bin (see config.log for reasons).

那就安装m4

yum install m4

安装成功后再次执行configure命令成功会显示如下界面

config.status: linking mpn/x86_64/coreihwl/gmp-mparam.h to gmp-mparam.h

config.status: executing libtool commands
configure: summary of build options:

Version: GNU MP 6.1.2
Host type: haswell-pc-linux-gnu
ABI: 64
Install prefix: /usr/local/gmp
Compiler: gcc -std=gnu99
Static libraries: yes
Shared libraries: yes

安装mpfr 3.1.5 mpfr依赖于gmp
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.5.tar.gz

tar xvf mpfr-3.1.5.tar.gz
cd mpfr-3.1.5
./configure --prefix=/usr/local/mpfr --with-gmp=/usr/local/gmp

make -j20 && make install

安装mpc 1.2.1 mpc依赖于gmp和mpfr
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz

tar xvf mpc-1.2.1.tar.gz
cd mpc-1.2.1
./configure --prefix=/usr/local/mpc --with-gmp=/usr/local/gmp -with-mpfr=/usr/local/mpfr

make -j20 && make install

低版本mpc安装时可能会出现以下错误:
mul.c:175: error: conflicting types for âmpfr_fmmaâ
/usr/local/mpfr/include/mpfr.h:765: note: previous declaration of âmpfr_fmmaâ was here
make[2]: *** [mul.lo] Error 1
建议安装最新版本。

安装GCC 6.3.0
wget ftp://ftp.gnu.org/gnu/gcc/gcc-6.3.0/gcc-6.3.0.tar.gz
tar xvf gcc-6.3.0.tar.gz
cd gcc-6.3.0
./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 -j20&&make install

安装过程中可能会出现:
“checking for suffix of object files… 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 `/tmp/gcc-6.3.0’

make[1]: *** [stage1-bubble] Error 2

make[1]: Leaving directory `/tmp/gcc-6.3.0’

make: *** [bootstrap] Error 2

解决方法:
yum install m4
yum install gcc-c++

实际解决办法:编辑变量,把我们安装的gmp,mpfr,mpc加进去
vi /etc/ld.so .conf

添加部分:
/usr/local/lib #这个是默认系统的变量
/usr/local/gmp/lib
/usr/local/mpfr/lib
/usr/local/mpc/lib
添加保存后记得更新动态库的缓存:
ldconfig -v

更新后再去重新编译安装。

其他错误:
checking LIBRARY_PATH variable… contains current directory
configure: error:
*** LIBRARY_PATH shouldn’t contain the current directory when
*** building gcc. Please change the environment variable
*** and run configure again.
make[2]: *** [configure-stage1-gcc] Error 1

解决办法:
执行 unset LIBRARY_PATH

备份系统默认的gcc版本
mv /usr/bin/gcc /usr/bin/gcc-bak
mv /usr/bin/g++ /usr/bin/g+±bak
mv /usr/bin/c++ /usr/bin/c+±bak
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6-bak

创建新的gcc软连接
ln -sf /usr/local/gcc/bin/gcc /usr/bin/gcc
ln -sf /usr/local/gcc/bin/c++ /usr/bin/c++
ln -sf /usr/local/gcc/bin/g++ /usr/bin/g++
ln -sf /usr/local/gcc/lib64/libstdc++.so.6.0.22 /usr/lib64/libstdc++.so.6

查看gcc版本:
[root@localhost ~]# gcc --version
gcc (GCC) 6.3.0
Copyright © 2016 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.

或者

[root@localhost ~]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc/libexec/gcc/x86_64-pc-linux-gnu/6.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./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
Thread model: posix
gcc version 6.3.0 (GCC)

升级到gcc7.0
sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
which gcc
gcc --version
————————————————
版权声明:本文为CSDN博主「耿小渣」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u014608280/article/details/80569328

gcc升级到 6.3.0版本相关推荐

  1. android——记录从android studio2.3升级到android studio3.0版本遇到的坑

    今天手贱,升级到了AS3.0 ,结果遇到了坑.提示需要将gradle升级到3.5及以上版本.然后就开始动手升级.其中遇到了各种困难.首先,就是需要FQ下载.其次,就是配置后提示jcenter下的一个p ...

  2. 升级PowerShell至4.0版本

    为了更好的使用Cmder v1.2,不得不升级PowerShell为4.0. 不知道Cmder的,可以点击这里:https://github.com/cmderdev/cmder 和 逆天神器 cmd ...

  3. linux firefox 版本升级,在openSUSE Linux下升级firefox至4.0版本的方法

    一.尝试使用Yast的自动升级功能,必须的.上古神器,谁与争锋:运行 Yast Control Center -> software -> Software Management,点击Up ...

  4. windos7升级powershell到4.0版本步骤

    为了更好的使用Cmder v1.2,不得不升级powershell为4.0. 不知道Cmder的,可以点击这里:https://github.com/cmderdev/cmder 和 逆天神器 cmd ...

  5. sony电视卡在android画面,索尼电视系统更新通知:解决升级到安卓9.0版本后bug问题...

    前面给大家分享了索尼电视X7500E/X8000E/X8066E/X8500E/X8566E/X9000E/X9300E/X9400E/A1系列系统更新内容,在5月13日索尼电视又更新了索尼X8500 ...

  6. pbootcms小程序插件升级到1.3.0版本,新增后台管理界面

    (1)新增后台管理功能,随时创建多个小程序,可控制小程序的开启 (2)新增安全密钥校验 (2)新增system接口用于获取小程序的信息(company和siteinfo接口并入system接口,减少请 ...

  7. 升级Ember到2.2.0版本

    原文地址:http://120.24.90.140:2368/sheng-ji-emberdao-2-2-0ban-ben/ 版本升级 目前(2015-11-24)使用Ember CLI命令安装的em ...

  8. Android 高德地图升级9.2.0版本问题

    gradle 文件升级版本: //高德地图 api 'com.amap.api:3dmap:9.2.0' //高德地图定位 implementation 'com.amap.api:location: ...

  9. z17原生Android系统,努比亚z17mini系统版本低了点,能升级到安卓7.0吗?

    目前这款手机还没有安卓7.0系统,建议耐心等待. 目前努比亚只推出了z11的7.0开发版本. 努比亚Z17mini搭载了基于安卓6.0的nubia UI V4.0,可惜并没有升级为安卓7.0版本.nu ...

最新文章

  1. 【Linux 操作系统】 Secure CRT 终端配置 -- 配置语法高亮 光标 和 字体
  2. Python基础教程(二):基础语法、变量类型
  3. Codeforces 766E Mahmoud and a xor trip(树形DP)
  4. Shadow Brokers 公布 2.1 万美元的 0day 订阅服务
  5. 61.新的开始(最小生成树)
  6. 编程之美2014 资格赛题目3 : 格格取数
  7. [导入]写了个img2ppt的demo,为写PDF2PPT做准备
  8. 一个Java程序员对2011年的回顾
  9. 计算机房在五楼英语,“我住在五楼”怎么用英语表达?
  10. 微软官网操作系统下载方法
  11. 'grunt' 不是内部或外部命令,也不是可运行的程序 或批处理文件
  12. lunix内核—死锁的四个必要条件和解决办法
  13. OV7725摄像头之OV7725芯片
  14. Java输入某年某月某日,判断这一天是这一年的第几天?
  15. mysql cts_mysql 时区问题
  16. Android学习之视频音乐列表ListView
  17. 2020.8.4课堂笔记(IO 缓冲流,对象流)
  18. 乳品行业拥抱大数据时代
  19. 【Linux】E: Release file for http://ports.ubuntu.comxxxxxxxxxxxxxInRelease is not valid关于时间设置的问题解决
  20. 我能贡献什么-《卓有成效的管理者》第3章

热门文章

  1. 盒子读取服务器视频文件,电视盒子怎么看U盘里的视频?巧用当贝市场,教你一招轻松搞定...
  2. 基于AI智能视频分析技术的电力行业视频监控联网解决方案
  3. WebGis开发那些事
  4. 无刷直流电机虚拟中性点分析
  5. windebug 指令详解
  6. php微信批量加好友软件,微信批量获取关注者信息列表php版本
  7. python识别魔方色块_解魔方机器人教程:识别颜色
  8. 2024合肥工业大学计算机考研信息汇总
  9. ios wkweb设置图片_iOS WKWebView识别H5中的图片资源
  10. KEIL中怎样添加STC系列单片机