Linux升级GCC从4.7.1到7.2.0

C++11 Support in GCC

GCC 4.8.1 was the first feature-complete implementation of the 2011 C++ standard, previously known as C++0x.

This mode can be selected with the -std=c++11 command-line flag, or -std=gnu++11 to enable GNU extensions as well.

如上所述, GCC4.8.1及以上版本全功能的实现了对2011 C++标准的支持. 编译时使用编译选项 -std=c++11就可打开C++11支持模式了.

可以本机的GCC版本还4.7.1, 已有些老迈, 而新版的GCC中也陆续新增了好多编译选项命令字以提供更好的编译时错误检测和提示, 为了方便后续的开发,也需要将GCC升级到新的版本了.

环境:

1 [root@dln-vm-01 gcc-build-7.2.0]# uname -a
2 Linux dln-vm-01 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

当前GCC版本: 4.7.1 

目标: GCC-7.2.0, 以下是升级操作记录:

Upgrade GCC from gcc4.7.1 to 7.2.0

# // Create the directory for saving new GCC version. # mkdir GCC-7.2 # cd GCC-7.2 # wget https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.2.0/gcc-7.2.0.tar.gz // Download the new version. # tar -zxvf gcc-7.2.0.tar.gz # cd gcc-7.2.0 # ./contrib/download_prerequisites // Install the dependent library automaticlly. Amazing...... 2018-04-12 01:43:02 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840] -> "./gmp-6.1.0.tar.bz2" [1] 2018-04-12 01:43:30 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284] -> "./mpfr-3.1.4.tar.bz2" [1] 2018-04-12 01:43:42 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925] -> "./mpc-1.0.3.tar.gz" [1] 2018-04-12 01:44:04 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2 [1626446] -> "./isl-0.16.1.tar.bz2" [1] gmp-6.1.0.tar.bz2: OK mpfr-3.1.4.tar.bz2: OK mpc-1.0.3.tar.gz: OK isl-0.16.1.tar.bz2: OK All prerequisites downloaded successfully. # mkdir gcc-build-7.2.0 // Create the build folder # cd gcc-build-7.2.0 # ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
// --enable-languages 告诉编译器支持什么语言.--disable-multilib不生成编译为其他平台可执行代码的交叉编译器。--disable-checking生成的编译器在编译过程中不做额外检查,也可以使用--enable-checking=xxx来增加一些检查 #
make # make install # gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib Thread model: posix gcc version 7.2.0 (GCC)
#
---Game Over.

 

转载于:https://www.cnblogs.com/yicheng-bangbang/p/8809346.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值