这是我编译中 gcc 4.7.1 频繁遇到的问题:
在有些出外网有限制的情况下,可以下载对应的包,手工执行实现这个脚本的动作。
编译成功。
简单的做删除
/bin/sh: line 3: cd: ./fixincludes: No such file or directory
make[1]: *** [install-fixincludes] Error 1
make[1]: Leaving directory `/usr/local/gccinstall/gcc-build'
make: *** [install] Error 2
http://gcc.1065356.n5.nabble.com/Bug-other-48445-New-Release-does-not-generate-fixincludes-directory-needed-by-Makefile-td435866.html
The problem was the libraries not found and the make install assumming make run without error. I had a conflict between the ubuntu c++ and 4.7 in some other program and while testing, commented the library path line in my bashrc. Also, should change the script to make && make install, instead of having them in as separate commands to avoid the misleading messages.
gnu/stubs-32.h: No such file
使用 yum -y install compat-glibc glibc-devel
gcc 所依赖的 gmp 等 不需要自己预先编译,那样容易出问题,
官方的处理脚本如下:
MPFR=mpfr-2.4.2
GMP=gmp-4.3.2
MPC=mpc-0.8.1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPFR.tar.bz2 || exit 1
tar xjf $MPFR.tar.bz2 || exit 1
ln -sf $MPFR mpfr || exit 1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$GMP.tar.bz2 || exit 1
tar xjf $GMP.tar.bz2 || exit 1
ln -sf $GMP gmp || exit 1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPC.tar.gz || exit 1
tar xzf $MPC.tar.gz || exit 1
ln -sf $MPC mpc || exit 1
rm $MPFR.tar.bz2 $GMP.tar.bz2 $MPC.tar.gz || exit 1
在有些出外网有限制的情况下,可以下载对应的包,手工执行实现这个脚本的动作。
以下是编译脚本:
#########################################install gettext
rm -rf gettext-0.18
tar zxvf gettext-0.18.tar.gz
cd gettext-0.18
./configure && make && make install
cd ..
ldconfig
#########################################install gcc
#if
#Comparing stages 2 and 3
#warning: gcc/cc1plus-checksum.o differs
#warning: gcc/cc1-checksum.o differs
#Bootstrap comparison failure!
### then make distclean
rm -rf gcc-4.7.1
rm -rf gcc-build
tar zxvf gcc-4.7.1.tar.gz
#/bin/cp -f download_prerequisites gcc-4.7.1/contrib/download_prerequisites
cp gmp-4.3.2.tar.bz2 mpc-0.8.1.tar.gz mpfr-2.4.2.tar.bz2 gcc-4.7.1
mkdir gcc-build
cd gcc-4.7.1
#sh contrib/download_prerequisites
MPFR=mpfr-2.4.2
GMP=gmp-4.3.2
MPC=mpc-0.8.1
tar xjf $MPFR.tar.bz2 && ln -sf $MPFR mpfr
tar xjf $GMP.tar.bz2 && ln -sf $GMP gmp
tar xzf $MPC.tar.gz && ln -sf $MPC mpc
rm -rf $MPFR.tar.bz2 $GMP.tar.bz2 $MPC.tar.gz
cd ../gcc-build
#../gcc-4.7.1/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++ --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
../gcc-4.7.1/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++ --enable-java-awt=gtk --disable-dssi --disable-plugin --with-cpu=generic
make && make install
编辑结束后,gcc -v 显示:
[root@jn-ssdcache-1088491 gccinstall]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.7.1/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++ --enable-java-awt=gtk --disable-dssi --disable-plugin --with-cpu=generic
Thread model: posix
gcc version 4.7.1 (GCC)
编译成功。
ldconfig显示:
[root@jn-ssdcache-1088491 gccinstall]# ldconfig
ldconfig: /usr/lib/libstdc++.so.6.0.8-gdb.py is not an ELF file - it has the wrong magic bytes at the start.
ldconfig: /usr/lib64/libstdc++.so.6.0.8-gdb.py is not an ELF file - it has the wrong magic bytes at the start.
简单的做删除
rm -rf
/usr/lib/libstdc++.so.6.0.8-gdb.py
rm -rf
/usr/lib64/libstdc++.so.6.0.8-gdb.py
即可