分类: LINUX
2011-07-20 14:54:11
这两天尝试把AS4的内核升到2.6.33.3,所以需要将gcc升级到4.5.0,一下为参考网友以及实践的过程,记录下来备忘:
一,安装gcc4.5.0
1.下载
wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
wget -c ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.5.0/gcc-4.5.0.tar.gz
wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
2.安装gmp
# tar xjvf gmp-4.3.2.tar.bz2
# cd gmp-4.3.2/
/gmp-4.3.2 # ./configure –prefix=/usr/local/gmp-4.3.2
/gmp-4.3.2 # make -j8
/gmp-4.3.2 # make install
3.安装mpfr
# tar xjvf mpfr-2.4.2.tar.bz2
# cd mpfr-2.4.2/
/mpfr-2.4.2 # ./configure –prefix=/usr/local/mpfr-2.4.2/ –with-gmp=/usr/local/gmp-4.3.2/
/mpfr-2.4.2 # make -j8
/mpfr-2.4.2 # make install
4.安装mpc
# tar zxvf mpc-0.8.1.tar.gz
# cd mpc-0.8.1/
/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/
/mpc-0.8.1 # make -j8
/mpc-0.8.1 # make install
5.安装gcc 4.5.0
# tar zxvf gcc-4.5.0.tar.gz
# cd gcc-4.5.0/
/gcc-4.5.0 # ./configure –prefix=/usr/local/gcc-4.5.0 –enable-shared –enable-threads=posix –enable-languages=c,c++,objc,obj-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/
/gcc-4.5.0 # make -j8
/gcc-4.5.0 # make install
在编译gcc4.5.0的过程中遇到了如下从错误:
“checking for suffix of object files... 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 `/tmp/gcc-4.3.2'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/tmp/gcc-4.3.2'
make: *** [bootstrap] Error 2
从shell输出中(向上找)发现错误出在目录i686-pc-linux-gnu中从目录中的config.log中找到了错误的原因:“when loading shared libraries:libmpfr.so.1:cannot open shared object file: No such file or directory”.通过在网上查找,发现最后解决办法是在LD_LIBRARY_PATH中添加mpfr的库路径即可。