g++编译器编译过程

1 下载gmp,mpfr,mpc

ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.bz2

http://ftp.gnu.org/gnu/mpfr/ 下载mpfr-3.1.0.tar.gz

http://www.multiprecision.org/mpc 下载mpc-0.9.tar.gz 

先编译gmp ../gmp-5.0.1/configure --prefix=/usr/local/gmp-5.0.1

不需要设置gmp的lib和inlcude环境变量export,只用在configure的时候指定安装目录即可,尤其编译g++时需要注意

C_INCLUDE_PATH

CPLUS_INCLUDE_PATH

LD_LIBRARY_PATH

LIBRARY_PATH

编译mpfr时 注意 ../mpfr-3.1.0/configure --prefix=/usr/local/mpfr-3.1.0 --with-gmp=/usr/local/gmp-5.0.1


编译安装

2 下载gcc-4.3.tar.gz和gcc-g++4.3.tar.gz

http://ftp.gnu.org/gnu/gcc/gcc-4.3.4/

二者解压时生成的目录相同,会自动对接


3 编译安装g++4.3

先 

unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE

然后

./configure --prefix=/home/lqg/gcc_4_3_0  --with-mpc=/usr/local/mpc-0.0 --with-gmp=/usr/local/gmp-5.0.1 --with-mpfr=/usr/local/mpfr-3.1.0 --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++ --build=x86_64-suse-linux-gnu --host=x86_64-suse-linux-gnu


x86_64-suse-linux-gnu系统名是在执行gcc -v命令时发现的,uname -a里面没有显示


checking host system type... Invalid configuration `x86_64-unknown-linux-gnu': machine `x86_64-unknown' not recognized 

在做 configure 的时候,报上述的错误。 
解决方案: 
把 /usr/share/libtool/config.guess 覆盖到相关软件自带的config.guess 
把 /usr/share/libtool/config.sub 覆盖到相关软件自带的config.sub 


A Google-search on the "machine `x86_64-unknown' not recognized" error message indicates that this can happen if the config.guess and config.sub files in the program you're building are too old to recognize the machine type for 64-bit linux. I expect that's your problem. You can fix that by replacing the ones in your GCC source tree with newer versions; your system should have some in the /usr/share/libtool directory that will work. Alternately, compile in a 32-bit Linux installation, or with "--build=i686-pc-linux-gnu --host=i686-pc-linux-gnu" configure options.

There are also copies here:

http://cvs.savannah.gnu.org/viewvc/*checkout*/config/config/config.guess

http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub


configure: error: cannot compute suffix of object files: cannot compile

exportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/gcc-4.6.3/mpc-0.9/mpc_install/lib:/opt/gcc-4.6.3/gmp-5.0.4/gmp_install/lib:/opt/gcc-4.6.3/mpfr-3.1.0/mpfr_install/lib

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值