Contents
Some program and library names and descriptions are not listed here, but can be found at ../../../../lfs/view/6.2/chapter06/gcc.html#contents-gcc as they were initially installed during the building of LFS.
The GCC package contains GNU compilers. This package is useful for compiling programs written in C, C++, Fortran, Java, Objective C and Ada. Also included is GNU Treelang. Treelang is a sample language, useful only to help people understand how to implement a new language front end to GCC. It is not a useful language in itself other than as an example or basis for building a new language. Therefore only language developers are likely to have an interest in it.
The Fortran compiler included with the GCC-4.x package now aims to be conformant with the Fortran 95 standard, not the Fortran 77 standard as all previous versions of GCC have been. Please note the following paragraph copied directly from the GCC-4.0.3 gfortran man page.
“Gfortran is not yet a fully conformant Fortran 95 compiler. It can generate code for most constructs and expressions, but work remains to be done. In particular, there are known deficiencies with ENTRY, NAMELIST, and sophisticated use of MODULES, POINTERS and DERIVED TYPES. For those whose Fortran codes conform to either the Fortran 77 standard or the GNU Fortran 77 language, we recommend to use g77 from GCC 3.4.x”
Instructions to install the 3.4.6 version of the Fortran compiler can be found in GCC-3.3.6 and on the BLFS Wiki.
Download (HTTP): http://ftp.gnu.org/gnu/gcc/gcc-4.0.3/gcc-4.0.3.tar.bz2
Download (FTP): ftp://ftp.gnu.org/gnu/gcc/gcc-4.0.3/gcc-4.0.3.tar.bz2
Download MD5 sum: 6ff1af12c53cbb3f79b27f2d6a9a3d50
Download size: 32.9 MB
Estimated disk space required: 1.7 GB
Estimated build time: 60 SBU (build, test and install all compilers)
If you plan to compile Ada, you will need to install GNAT temporarily to satisfy the circular dependency when you recompile GCC to include Ada.
Download (HTTP): http://anduin.linuxfromscratch.org/sources/BLFS/6.2.0/g/gnat-3.15p-i686-pc-redhat71-gnu-bin.tar.bz2
Download (FTP): ftp://anduin.linuxfromscratch.org/BLFS/6.2.0/g/gnat-3.15p-i686-pc-redhat71-gnu-bin.tar.bz2
Download MD5 sum: c9aad2da908a40e876c24fc85f248b51
Download size: 11.6 MB
Estimated disk space required: 97.7 MB
Estimated build time: less than 0.1 SBU
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/gcc
Install GNAT by running the following command as the root user:
make ins-all prefix=/opt/gnat
The GNAT compiler can be invoked by executing the gcc binary installed in /opt/gnat/bin.
You may now remove the GNAT source directory:
cd .. && rm -rf gnat-3.15p-i686-pc-linux-gnu-bin
Prepare to compile GCC by placing the GNAT version of gcc at the beginning of the PATH variable by using the following commands:
PATH_HOLD=$PATH && export PATH=/opt/gnat/bin:$PATH_HOLD
Install GCC by running the following commands:
The installation process may overwrite your existing GCC gcc and c++ compilers and libraries. It is highly recommended that you have the Tcl, Expect and DejaGnu packages installed before beginning the build so you can run the full suite of tests.
Do not continue with the make install command until you are confident the build was successful. You can compare your test results with those found at http://gcc.gnu.org/ml/gcc-testresults/. There's also an i686 platform test result produced by an LFS-SVN-20051127 system at http://anduin.linuxfromscratch.org/files/BLFS/gcc403_test.txt. You may also want to refer to the information found in the GCC-Pass 2 section of Chapter 5 in the LFS book (../../../../lfs/view/6.2/chapter05/gcc-pass2.html).
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in && mkdir ../gcc-build && cd ../gcc-build && ../gcc-4.0.3/configure \ --prefix=/usr \ --libexecdir=/usr/lib \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ --enable-clocale=gnu \ --enable-languages=c,c++,objc,f95,ada,java,treelang && make bootstrap && make -k check && ../gcc-4.0.3/contrib/test_summary
Now, as the root user:
make install && ln -v -sf ../usr/bin/cpp /lib && ln -v -sf gcc /usr/bin/cc && chown -v -R root:root \ /usr/lib/gcc/i686-pc-linux-gnu/4.0.3/include && chown -v -R root:root \ /usr/lib/gcc/i686-pc-linux-gnu/4.0.3/ada{lib,include}
The libffi interface header is installed in a location where other packages will not be able to find it. If you included Java as one of the installed languages, create a symbolic link in /usr/include to remedy this:
ln -v -sf `find /usr/lib/gcc -name ffitarget.h` /usr/include
As the root user, remove the GNAT installation:
rm -rf /opt/gnat
Now, as the unprivileged user, restore your old PATH:
export PATH=$PATH_HOLD && unset PATH_HOLD
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in: This command suppresses the installation of libiberty.a as the version provided by Binutils is used instead.
mkdir ../gcc-build; cd ../gcc-build: The GCC documentation recommends building the package in a dedicated build directory.
--enable-shared --enable-threads=posix --enable-__cxa_atexit: These parameters are required to build the C++ libraries to published standards.
--enable-clocale=gnu: This command is a failsafe for incomplete locale data.
--enable-languages=c,c++,objc,f95,ada,java,treelang: This command identifies which languages to build. You may modify this command to remove undesired languages.
make -k check: This command runs the test suite without stopping if any errors are encountered.
../gcc-4.0.3/contrib/test_summary: This command will produce a summary of the test suite results. You can append | grep -A7 Summ to the command to produce an even more condensed version of the summary. You may also wish to redirect the output to a file for review and comparison later on.
ln -v -sf ../usr/bin/cpp /lib: This command creates a link to the C PreProcessor as some packages expect it to be installed in the /lib directory.
ln -v -sf gcc /usr/bin/cc: This link is created as some packages refer to the C compiler using an alternate name.
chown -v -R root:root /usr/lib/gcc/i686-pc-linux-gnu/...: If the package is built by a user other than root, the ownership of the installed include and adalib directories (and their contents) will be incorrect. These commands change the ownership to the root user and group . Omit the command changing the Ada directories if you did not include Ada as one of the installed languages.
Some program and library names and descriptions are not listed here, but can be found at ../../../../lfs/view/6.2/chapter06/gcc.html#contents-gcc as they were initially installed during the building of LFS.
Last updated on 2007-01-24 16:21:51 -0600