首页 > 代码库 > GCC升级
GCC升级
系统:CentOS-6.5-x86_64-minimal
为了使用c++11特性,升级gcc.
wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2tar -xjvf gcc-4.9.2.tar.bz2cd gcc-4.9.2.tar.bz2./configure
wget下载慢,服务器也是日本的,可以用QQ旋风或迅雷下载,再psftp上传,
出现错误:
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.Try the --with-gmp, --with-mpfr and/or --with-mpc options to specifytheir locations. Source code for these libraries can be found attheir respective hosting sites as well as atftp://gcc.gnu.org/pub/gcc/infrastructure/.
安装gmp、mpfr、mpc
下载地址:
http://ftp.tsukuba.wide.ad.jp/software/gcc/infrastructure/gmp-4.3.2.tar.bz2http://ftp.tsukuba.wide.ad.jp/software/gcc/infrastructure/mpfr-2.4.2.tar.bz2http://ftp.tsukuba.wide.ad.jp/software/gcc/infrastructure/mpc-0.8.1.tar.gz
解压后逐个安装,
./configuremakemake install
再次错误,
The following languages will be built: c,c++,fortran,java,lto,objc*** This configuration is not supported in the following subdirectories: gnattools target-libada target-libgo target-libbacktrace (Any other directories should still work fine.)checking for default BUILD_CONFIG... bootstrap-debugchecking for --enable-vtable-verify... no/usr/bin/ld: crt1.o: No such file: No such file or directorycollect2: ld returned 1 exit statusconfigure: error: I suspect your system does not have 32-bit developement libraries (libc and headers).
If you have them, rerun configure with --enable-multilib.
If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.
系统没有32位开发支持库,可以运行yum install glibc-devel.i686安装,不过我这里不需要编译32位程序,直接
./configure --disable-multilib
这回配置完成,
make
出现错误,
checking whether build environment is sane... configure: error: newly created file is older than distributed files!Check your system clockmake[2]: *** [configure-stage1-zlib] Error 1make[2]: Leaving directory `/root/gcc-4.9.2‘make[1]: *** [stage1-bubble] Error 2make[1]: Leaving directory `/root/gcc-4.9.2‘make: *** [all] Error 2
更新时间,
ntpdate cn.pool.ntp.org
继续
make
约半小时后,出现错误,
checking for suffix of object files... configure: error: in `/root/gcc-4.9.2/x86_64-unknown-linux-gnu/libgcc‘:configure: error: cannot compute suffix of object files: cannot compileSee `config.log‘ for more details.make[2]: *** [configure-stage1-target-libgcc] Error 1make[2]: Leaving directory `/root/gcc-4.9.2‘make[1]: *** [stage1-bubble] Error 2make[1]: Leaving directory `/root/gcc-4.9.2‘make: *** [all] Error 2
查看config.log,发现在配置libgcc时出错了,yum list libgcc,发现已安装libgcc.x86_64,难道要装i686的?go~
yum install libgcc.i686
继续
make
约四小时这样子就编译完成了,
make install
几分钟就安装完成。
看效果
gcc -v Using built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapperTarget: x86_64-unknown-linux-gnuConfigured with: ./configure --disable-multilibThread model: posixgcc version 4.9.2 (GCC)
GCC升级
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。