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
下載依賴項
執(zhí)行download_prerequisites將會自動下載這些軟件并解壓到當前目錄,生成gcc編譯的make文件。自動安裝gcc需要下載諸如gmp、mpfr、mpc等依賴文件:
# cd gcc-6.1.0
# ./contrib/download_prerequisites
如果你的Linux無法直接聯(lián)網(wǎng),那么你只能打開文件download_prerequisites,獲取到這些文件的下載鏈接,然后通過其他上網(wǎng)設(shè)備下載這些軟件。最后把這些軟件直接解壓到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選項可以指定同時運行的作業(yè)數(shù)量,即CPU核數(shù),如果有4核則可以加上-j4
出錯解決
1.make過程中可能會出現(xiàn)以下錯誤信息:
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.動態(tài)庫libstdc++.so.6版本不匹配
可以正常編譯程序,但是運行時出現(xiàn)以下問題:
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15’ not found
添加LD_LIBRARY_PATH環(huán)境變量即可解決:
# vim ~/.bash_profile
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64
# source ~/.bash_profile
GCC新特征
GCC 6.1 發(fā)布了,該版本較之前GCC5 新怎了大量的功能特性,默認采用C++14為新的標準,替代了之前的C++98。OpenMP 4.5規(guī)范將在本版本中被支持。此外,GCC 6.1 增強了對 C++17 的試驗性支持;大大改進了診斷特性,包括位置,位置范圍,拼寫錯誤標識符建議,選項名字等等改進;新增了修復(fù)提示和一些警告提示。改進記錄如下:
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.
完整發(fā)布說明,可以在這里查看。
參考文章
(CSDN的Markdown不好用)
總結(jié)
以上是生活随笔為你收集整理的linux安装gcc运行时库,Linux安装gcc-6.1.0的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 安徽关节式焊接机器人_机器人自动焊接技术
- 下一篇: html5新增的type类型,html5