我无法在red hat 7中编译gcc 4.5.0。
我遵循here的指示("艰难的方式",没有libelf)。
我使用以下版本:
# rpm -qa | grep -e libelf -e gmp -e mpfr -e mpc
mpfr-3.1.1-4.el7.x86_64
mpfr-devel-3.1.1-4.el7.x86_64
elfutils-libelf-0.170-4.el7.x86_64
elfutils-libelf-devel-0.170-4.el7.x86_64
gmp-6.0.0-15.el7.x86_64
libmpc-1.0.1-3.el7.x86_64
gmp-devel-6.0.0-15.el7.x86_64
编译时,他找不到mpc.h:
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
所以我编译了它。
这是工作配置:
/opt/app/gcc/gcc-4.5.0_SOURCE/configure
--prefix=/opt/app/gcc-4.5.0
--enable-languages=c,c++,fortran
--enable-bootstrap
--enable-shared
--enable-threads=posix
--enable-checking=release
--with-system-zlib
--enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-gnu-unique-object
--with-mpc=/opt/app/gcc/tmp/
在结束时我得到了这个:
...
ar rc libgcc.a $objects
ranlib libgcc.a
make[5]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/x86_64-unknown-linux-gnu/32/libgcc'
make[4]: *** [multi-do] Error 1
make[4]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/x86_64-unknown-linux-gnu/libgcc'
make[3]: *** [all-multi] Error 2
make[3]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make: *** [all] Error 2
经过一些研究后我发现,texinfo丢失了。安装texinfo让我遇到了新的失败:
...
make[3]: *** [doc/gccint.info] Error 1
rm gcc.pod
make[3]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make: *** [all] Error 2
经过一番研究后,我发现here texinfo有一个错误。现在我试图编译texinfo 4.13a但是再次,我遇到了麻烦,没有明确的错误信息。
有没有人在redhat 7中编译gcc 4.5.0?
更新 我可以编译gcc 4.5.4,但只有未安装texinfo ...
亲切的问候
答案 0 :(得分:0)
您的错误1. GCC需要gcc-source / https://gcc.gnu.org/install/configure.html
之外的构建目录gcc-4.5.x无法使用EL7 texinfo。请从“gcc-4.5天”安装texinfo:
yum remove texinfo
yum install Downloads/texinfo-4.13a-10.fc14.x86_64.rpm
GCC-4.5:错误修正版本是4.5.4。
注意:默认构建目录是$ HOME / tmp /(或$ HOME中的其他目录)。 ......我的构建示例:
cd gcc-4.5.4/
tar xvf mpfr-3.0.1.tar.xz
mv mpfr-3.0.1/ mpfr
tar xvf gmp-5.0.5.tar.xz
mv gmp-5.0.5/ gmp
tar xvf mpc-0.8.2.tar.gz
mv mpc-0.8.2/ mpc
cd ../
mkdir build-gcc45
cd build-gcc45/
../gcc-4.5.4/configure --prefix=/usr/local/gcc45 --program-suffix=45 --enable-clocale=gnu --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,fortran --disable-libstdcxx-pch --disable-multilib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs
make
# make install
cd /usr/bin/
# ln -s /usr/local/gcc45/bin/gcc45
# ln -s /usr/local/gcc45/bin/g++45
# ln -s /usr/local/gcc45/bin/gfortran45
使用示例:$ export CC=gcc45 CXX=g++45 FC=gfortran45 && ./configure
.... .... $ CC=gcc45 CXX=g++45 FC=gfortran45 cmake ../
结果:“gcc45-c ++ - 4.5.4-1.el7.x86_64.rpm”https://drive.google.com/file/d/15aRg-BPhuyaEyZA9Jy-iAyC21_pwN7nD/view?usp=sharing
旧版gcc-4.5.0的示例:
$ cd build-gcc450/
$ ../gcc-4.5.0/configure --prefix=/opt/app/gcc-4.5.0 --program-suffix=450 --enable-clocale=gnu --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,fortran --disable-libstdcxx-pch --disable-multilib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs
$ make -j4
# make install ( No errors at all )
https://www.dropbox.com/s/45kfetdjj9lif66/gcc450-configure-opt.txt?dl=0 ...更多示例→https://drive.google.com/drive/folders/1j7qE9YKTT313B5VBg3kevzCNiykGkonO?usp=sharing