01 August 2010

Installing gcc 4.4.2 on Fedora 8

( Note from the future: This was the first of my build-from-source attempts, hence the excitement and detail.  )

I recommend that you go through the entire document first before following the steps (because some steps were performed wrong and corrected later. Other steps were repeated un-necessarily). The steps are numbered as 1., 2., 3. etc.

GCC 4.4.2 installation on Fedora 8:
How I did it:
1. Placed the gcc-4.4.2 folder in home and created a folder called gccbuild in home.
2. typed gcc -v in the terminal and got the following info

Using built-in specs.
Target: i386-redhat-linux
Configured with: ../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-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 --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)


3. Entered cd gccbuild/
4. Typed ../gcc-4.4.2/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-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 --with-cpu=generic --host=i386-redhat-linux
5. and got the following message:
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... i686-pc-linux-gnu
checking host system type... i386-redhat-linux-gnu
checking target system type... i386-redhat-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for i386-redhat-linux-gcc... i386-redhat-linux-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i386-redhat-linux-gcc accepts -g... yes
checking for i386-redhat-linux-gcc option to accept ANSI C... none needed
checking for i386-redhat-linux-g++... i386-redhat-linux-g++
checking whether we are using the GNU C++ compiler... yes
checking whether i386-redhat-linux-g++ accepts -g... yes
checking for i386-redhat-linux-gnatbind... no
checking for gnatbind... no
checking for i386-redhat-linux-gnatmake... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for correct version of gmp.h... yes
checking for correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code 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 and/or MPFR 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.

6. Tried ../gcc-4.4.2/configure --prefix=/opt/
7. and got the following messages:
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for correct version of gmp.h... yes
checking for correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code 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 and/or MPFR 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.

8. Tried ../gcc-4.4.2/configure --prefix=/usr/local --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --disable-libunwind-exceptions
9. and got:
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for correct version of gmp.h... yes
checking for correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code 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 and/or MPFR 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.

10. Trying ../gcc-4.4.2/configure --prefix=/usr/local --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --disable-libunwind-exceptions --with-gmp=/usr/share/doc/gmp-4.2.2
11. and got:
e-libunwind-exceptions --with-gmp=/usr/share/doc/gmp-4.2.2
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for correct version of gmp.h... yes
checking for correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code 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 and/or MPFR 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.

12. downloaded mpfr-2.4.2 from http://www.mpfr.org/
13. logged in as root and extracted the tar.bz2 to /usr/share/doc/
14. entered the mpfr-2.4.2 folder, typed 'configure' and typed 'make'
15. Tried ../gcc-4.4.2/configure --prefix=/usr/local --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --disable-libunwind-exceptions --with-gmp=/usr/share/doc/gmp-4.2.2 --with-mpfr=/usr/share/doc/mpfr-2.4.2
16. and got:
e-libunwind-exceptions --with-gmp=/usr/share/doc/gmp-4.2.2 --with-mpfr=/usr/share/doc/mpfr-2.4.2
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for correct version of gmp.h... yes
checking for correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code 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 and/or MPFR 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.

17. From the /usr/share/doc folder I did an "mv mpfr-2.4.2 /home/username/gcc-4.4.2/mpfr"
18. Tried ../gcc-4.4.2/configure --prefix=/usr/local --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --disable-libunwind-exceptions --with-gmp=/usr/share/doc/gmp-4.2.2
19. and got:
ibunwind-exceptions --with-gmp=/usr/share/doc/gmp-4.2.2
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for version 0.10 of PPL... no
checking for correct version of CLooG... no
The following languages will be built: c,c++,fortran,java,objc
*** This configuration is not supported in the following subdirectories:
target-libada gnattools
(Any other directories should still work fine.)
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for expect... no
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for cc... cc
checking for c++... c++
checking for gcc... gcc
checking for gcj... gcj
checking for gfortran... gfortran
checking for ar... no
checking for ar... ar
checking for as... no
checking for as... as
checking for dlltool... no
checking for dlltool... no
checking for ld... no
checking for ld... ld
checking for lipo... no
checking for lipo... no
checking for nm... no
checking for nm... nm
checking for objdump... no
checking for objdump... objdump
checking for ranlib... no
checking for ranlib... ranlib
checking for strip... no
checking for strip... strip
checking for windres... no
checking for windres... no
checking for windmc... no
checking for windmc... no
checking where to find the target ar... host tool
checking where to find the target as... host tool
checking where to find the target cc... just compiled
checking where to find the target c++... just compiled
checking where to find the target c++ for libstdc++... just compiled
checking where to find the target dlltool... host tool
checking where to find the target gcc... just compiled
checking where to find the target gcj... just compiled
checking where to find the target gfortran... just compiled
checking where to find the target ld... host tool
checking where to find the target lipo... host tool
checking where to find the target nm... host tool
checking where to find the target objdump... host tool
checking where to find the target ranlib... host tool
checking where to find the target strip... host tool
checking where to find the target windres... host tool
checking where to find the target windmc... host tool
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether -fkeep-inline-functions is supported... yes
configure: creating ./config.status
config.status: creating Makefile

20. Now my gccbuild folder contains : config.log config.status Makefile serdep.tmp
21. Typed make
22. a lot of "checking" lines later I got this:
Configuring stage 1 in ./mpfr
configure: WARNING: unrecognized options: --enable-threads, --enable-checking, --disable-libunwind-exceptions, --enable-languages, --disable-intermodule, --enable-checking, --disable-coverage, --enable-languages
configure: creating cache ./config.cache
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for none-pc-linux-gnu-strip... no
checking for strip... strip
configure: WARNING: using cross tools not prefixed with host triplet
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
configure: error: source directory already configured; run "make distclean" there first
make[2]: *** [configure-stage1-mpfr] Error 1
make[2]: Leaving directory `/home/username/gccbuild'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/username/gccbuild'
make: *** [all] Error 2

23. went to the gcc-4.4.2/mpfr/ directory
24. typed "su" and logged in as root user
25. ran "make distclean"
26. Ctrl+d
27. entered the gccbuild folder
28. typed "make distclean"
29. Deleted the rest of the files in the folder
30. ran ../gcc-4.4.2/configure --prefix=/usr/local --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --disable-libunwind-exceptions --with-gmp=/usr/share/doc/gmp-4.2.2
31. typed make
32. The build process started at 13:15 hrs
33. Build completed 14:19 hrs with the final lines as:
make[5]: Leaving directory `/home/username/gccbuild/i686-pc-linux-gnu/libgomp'
/home/username/gccbuild/./gcc/gfortran -B/home/username/gccbuild/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -g -O2 -Wall -fsyntax-only omp_lib.f90
make[4]: Leaving directory `/home/username/gccbuild/i686-pc-linux-gnu/libgomp'
make[3]: Leaving directory `/home/username/gccbuild/i686-pc-linux-gnu/libgomp'
make[2]: Leaving directory `/home/username/gccbuild/i686-pc-linux-gnu/libgomp'
make[1]: Leaving directory `/home/username/gccbuild'

34. You can optionally run some tests as specified here: http://gcc.gnu.org/install/test.html
35. Otherwise, in the gccbuild directory, type "su"
36. Log in as root user
37. Type 'make install'
38. The installation procedure will begin. For me, it took two to three minutes.
39. That's it! gcc is installed in your system. You can log out of root with Ctrl+d
40. Type "gcc -v" and you'll see the new version number of gcc Enjoy!!!

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.4.2/configure --prefix=/usr/local --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --disable-libunwind-exceptions --with-gmp=/usr/share/doc/gmp-4.2.2
Thread model: posix
gcc version 4.4.2 (GCC)

Tried make -k check. It showed "PASS" for many tests and then came to a part where it needed overwriting permissions. So I pressed Ctrl+C, logged in with 'su' and ran "make -k check" again. This time, it gave me:

Collector appears to work
Completed 368 collections
PASS: gctest
==================
All 1 tests passed
==================

No comments: