博客信息

Linux下GCC4.9.3编译器的安装及出现的问题

发布时间:『 2020-01-07 20:22』  博客类别:Linux  阅读(2296) 评论(0)

首先,下载gcc4.9.3

cd /opt

wget 


tar -xvf gcc-4.9.3.tar.gz


mkdir /usr/local/gcc-4.9.3/


cd /opt/gcc-4.9.3

./configure -prefix=/usr/local/gcc-4.9.3

如果出现如下错误:

configure : error : Building GCC requires GMP 4.2+,MPFR 2.4.0+ and MPC 0.8.0+ 。。。。。。

说明缺少依赖库GMP、MPFR、MPC,可以从下载链接下载,按下面顺序安装。

https://gcc.gnu.org/pub/gcc/infrastructure/


(1)安装GMP4.3.2

#解压
#tar -xvf gmp-4.3.2.tar.bz2

#进入解压目录
#cd /opt/gmp-4.3.2

#创建安装目录
#mkdir /usr/local/gmp-4.3.2

#配置安装
#./configure -prefix=/usr/local/gmp-4.3.2

#编译
#make

#安装
#make install

(2) 安装MPFR2.4.2

#进入下载目录
#cd /opt
#下载
#wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
#解压
#tar -xvf mpfr-2.4.2.tar.bz2
#进入解压目录
#cd /opt/mpfr-2.4.2
#创建安装目录
#mkdir /usr/local/mpfr-2.4.2
#配置安装
#./configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2
#编译
#make
#安装
#make install

(3)安装MPC0.8.1

#进入下载目录
#cd /opt
#下载
#wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
#解压
#tar -xvf mpc-0.8.1.tar.gz
#进入解压目录
#cd /opt/mpc-0.8.1
#创建安装目录
#mkdir /usr/local/mpc-0.8.1
#配置安装
#./configure --prefix=/usr/local/mpc-0.8.1 --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2
#编译
#make
#安装
#make install

5、再次配置GCC安装配置选项

#cd /opt/gcc-4.9.3
#./configure --prefix=/usr/local/gcc-4.9.0 -enable-threads=posix -disable-checking -disable-multilib -enable-languages=c,c++ --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-0.8.1

======================报错信息汇总==================

(1)报错

cc-4.9.3/x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc-4.9.3/x86_64-unknown-linux-gnu/sys-include   

checking for suffix of object files... configure: error: in `/hadoop/gcc-4.9.3/x86_64-unknown-linux-gnu/libgcc':

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 `/hadoop/gcc-4.9.3'

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

make[1]: Leaving directory `/hadoop/gcc-4.9.3'

make: *** [all] Error 2

解决:

先设置lib目录

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2/lib:/usr/local/gcc-4.9.3/lib:/usr/local/gcc-4.9.3/lib64



(2)报错

gmp4.3.2 安装时 ./configure报错: error: could not find a working compiler


./configure -prefix=/usr/local/gmp-4.3.2 --build=x86_64-linux


增加--build=x86_64-linux


(3)报错

/lib64/libm.so.6: version `GLIBC_2.23' not found


是因为用到的so库是2.23打包编译的。如果系统没有支持GLIBC_2.23则需要安装或者使用低版本的GLIBC环境打包。



(4)报错

/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found


xgboost报错,是因为编译的时候使用了gcc-4.9.3的包libstdc++.so.6支持1.3.8,所以将/lib64/libstdc++.so.6 覆盖/usr/local/gcc-4.9.3/lib64/libstdc++.so.6.0.20 再打包即可。


关键字:   gcc  
评论信息
暂无评论
发表评论
验证码: 
Powered by IMZHANGJIE.CN Copyright © 2015-2025 粤ICP备14056181号