linux安装gcc运行时库,Linux安装gcc-6.1.0

获取gcc源码包

# wget https://ftp.gnu.org/gnu/gcc/gcc-6.1.0/gcc-6.1.0.tar.bz2

# tar -jxvf gcc-6.1.0.tar.bz2

下载依赖项

执行download_prerequisites将会自动下载这些软件并解压到当前目录,生成gcc编译的make文件。自动安装gcc需要下载诸如gmp、mpfr、mpc等依赖文件:

# cd gcc-6.1.0

# ./contrib/download_prerequisites

如果你的Linux无法直接联网,那么你只能打开文件download_prerequisites,获取到这些文件的下载链接,然后通过其他上网设备下载这些软件。最后把这些软件直接解压到gcc源程序目录(/路径/6.1.0)下即可。

编译安装

# mkdir gcc-build

# cd gcc-build

# ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib

# make

# make install

注意make的-j选项可以指定同时运行的作业数量,即CPU核数,如果有4核则可以加上-j4

出错解决

1.make过程中可能会出现以下错误信息:

build/genattrtab ../.././gcc/config/i386/i386.md insn-conditions.md \

-Atmp-attrtab.c -Dtmp-dfatab.c -Ltmp-latencytab.c

make[3]: *** [s-attrtab] Killed

make[3]: Leaving directory `/usr/src/gcc-4.9.2/host-x86_64-unknown-linux-gnu/gcc'

make[2]: *** [all-stage1-gcc] Error 2

make[2]: Leaving directory `/usr/src/gcc-4.9.2'

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

make[1]: Leaving directory `/usr/src/gcc-4.9.2'

make: *** [all] Error 2

2.动态库libstdc++.so.6版本不匹配

可以正常编译程序,但是运行时出现以下问题:

/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15’ not found

添加LD_LIBRARY_PATH环境变量即可解决:

# vim ~/.bash_profile

export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64

# source ~/.bash_profile

GCC新特征

GCC 6.1 发布了,该版本较之前GCC5 新怎了大量的功能特性,默认采用C++14为新的标准,替代了之前的C++98。OpenMP 4.5规范将在本版本中被支持。此外,GCC 6.1 增强了对 C++17 的试验性支持;大大改进了诊断特性,包括位置,位置范围,拼写错误标识符建议,选项名字等等改进;新增了修复提示和一些警告提示。改进记录如下:

UndefinedBehaviorSanitizer gained a new sanitization option, -fsanitize=bounds-strict, which enables strict checking of array bounds. In particular, it enables -fsanitize=bounds as well as instrumentation of flexible array member-like arrays.

Type-based alias analysis now disambiguates accesses to different pointers. This improves precision of the alias oracle by about 20-30% on higher-level C++ programs. Programs doing invalid type punning of pointer types may now need -fno-strict-aliasing to work correctly.

Alias analysis now correctly supports weakref and alias attributes. This makes it possible to access both a variable and its alias in one translation unit which is common with link-time optimization.

Value range propagation now assumes that the this pointer of C++ member functions is non-null. This eliminates common null pointer checks but also breaks some non-conforming code-bases (such as Qt-5, Chromium, KDevelop). As a temporary work-around-fno-delete-null-pointer-checks can be used. Wrong code can be identified by using-fsanitize=undefined.

完整发布说明,可以在这里查看。

参考文章

(CSDN的Markdown不好用)

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值