2

Im having trouble to compile gcc 4.5.0 in red hat 7.

Im following the instructions from here ("The hard way", without libelf).

I use following versions:

# 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

While compiling, he doesnt find 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.

So I compiled it.

Here is the working configure:

/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/ 

At the end of make I get this:

...
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

After some research I found out, that texinfo was missing. Install texinfo got me to a new failure:

...
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

After some research I found here that texinfo has a bug. Now Im trying to compile texinfo 4.13a but again, I get into trouble with no clear error message.

Did anyone achieve to compile gcc 4.5.0 in redhat 7?

UPDATE I can compile gcc 4.5.4, but ONLY IF texinfo is NOT installed ...

kind regards

pwe
  • 127
  • 1
  • 14
  • Please edit your question to include the used configure line. I.e. what's your `prefix=[install-dir]` ... And the `--program-suffix=[??]` ? .... About texinfo : Is OK. I have built several gcc versions with EL7. .... ... Why "without libelf" ? – Knud Larsen Apr 17 '18 at 13:35
  • Libelf is already installed. I added the configure-parameters ... – pwe Apr 18 '18 at 05:02

1 Answers1

0

Your errors 1. GCC requires a build directory outside the gcc-source/ https://gcc.gnu.org/install/configure.html

  1. gcc-4.5.x cannot use the EL7 texinfo. Please install a texinfo from "the gcc-4.5 days" :

    yum remove texinfo

    yum install Downloads/texinfo-4.13a-10.fc14.x86_64.rpm

http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/14/Everything/x86_64/os/Packages/texinfo-4.13a-10.fc14.x86_64.rpm

GCC-4.5 : The bugfix version is 4.5.4 .

Note: The default build directory is $HOME/tmp/ (Or other dir. in $HOME). ... My build example :

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

Using, examples : $ export CC=gcc45 CXX=g++45 FC=gfortran45 && ./configure .... .... $ CC=gcc45 CXX=g++45 FC=gfortran45 cmake ../

Result : "gcc45-c++-4.5.4-1.el7.x86_64.rpm" https://drive.google.com/file/d/15aRg-BPhuyaEyZA9Jy-iAyC21_pwN7nD/view?usp=sharing


Example with the older 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 ... More examples → https://drive.google.com/drive/folders/1j7qE9YKTT313B5VBg3kevzCNiykGkonO?usp=sharing

Knud Larsen
  • 5,753
  • 2
  • 14
  • 19
  • The thing with the directories doesnt apply. I use different source-trees. The problem is, we need 4.5.0 for some special application. I did already successfully compile 4.5.4. With the downloaded texinfo, I get the same error ... – pwe Apr 19 '18 at 09:30
  • Your errors : Running ./configure ... and make inside the gcc-4.5.0 source *will* fail. Please see my edited answer. – Knud Larsen Apr 19 '18 at 21:44