Gcc-4.5.0编译手记

更新自己的编译工具链,编译gcc-4.5.0花费了三个晚上的休息时间。走了很多弯路,其实很简单。

1. 下载gmp-5.0.1.tar.bz2、mpc-0.8.2.tar.gz、mpfr-3.0.0.tar.bz2解压缩,以默认配置编译(即全部执行./configure即可,我尝试过设置--prefix,会出现问题。或者设置LD_LIBRARY_PATH可以解决这个问题,但是我没测试。)

2. 备份 /usr/local/lib下面的libgmp.so*和libmpfr.so*,然后删除这些libgmp.so*和libmpfr.so*。编译安装完成后记得还原。

3. 下载gcc-4.5.0.tar.bz2编译。我选择的脚本:

/home/yanyg/work/gnu/gcc/gcc-4.5.0/configure \
--with-pkgversion=GCC-4.5.0-2010.07.23-cppgp \
--with-bugurl=www.cppgp.com \
--prefix=/home/yanyg/work/gnu/gcc/install-gcc-4.5.0 \
--with-endian=little \
--enable-threads=posix \
--enable-tls \
--with-cpu=i686 \
--with-arch=i686 \
--enable-bootstrap \
--enable-languages=c,c++ \
--disable-libada \
--enable-checking=release

4. make -j4 && make install

5. 进入 下查看版本信息:

yanyg@localhost bin]$ gcc -v
Using built-in specs.
Target: i686-RedHat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,Java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 4.4.2 20091027 (Red Hat 4.4.2-7) (GCC)
-------------------------------------------------------------------------------------
[yanyg@localhost bin]$ ./gcc -v
Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/home/yanyg/work/gnu/gcc/install-gcc-4.5.0/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /home/yanyg/work/gnu/gcc/gcc-4.5.0/configure --with-pkgversion=GCC-4.5.0-2010.07.23-cppgp --with-bugurl=www.cppgp.com --prefix=/home/yanyg/work/gnu/gcc/install-gcc-4.5.0 --with-endian=little --enable-threads=posix --enable-tls --with-cpu=i686 --with-arch=i686 --enable-bootstrap --enable-languages=c,c++ --disable-libada --enable-checking=release --with-mpc=/home/yanyg/work/gnu/gcc/prerequisite/mpc-0.8.2/install --with-mpfr=/home/yanyg/work/gnu/gcc/prerequisite/mpfr-3.0.0/install --with-gmp=/home/yanyg/work/gnu/gcc/prerequisite/gmp-5.0.1/install
Thread model: posix
gcc version 4.5.0 (GCC-4.5.0-2010.07.23-cppgp)

相关推荐