Installing GCC-3.3.2 - Pass 1

Approximate build time:  4.4 SBU
Required disk space:     300 MB

Official download location for GCC (3.3.2): 
ftp://ftp.gnu.org/pub/gnu/gcc/

For its installation GCC depends on: Bash, Binutils, Coreutils, Diffutils, Findutils, Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, Texinfo.

Installation of GCC

Unpack only the GCC-core tarball, as we won't be needing a C++ compiler for the moment.

This package is known to behave badly when you have changed its default optimization flags (including the -march and -mcpu options). Therefore, if you have defined any environment variables that override default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting or modifying them when building GCC.

The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:

mkdir ../gcc-build
cd ../gcc-build

Prepare GCC for compilation:

../gcc-3.3.2/configure --prefix=/tools \
    --with-local-prefix=/tools \
    --disable-nls --enable-shared \
    --enable-languages=c

The meaning of the configure options:

Continue with compiling the package:

make BOOT_LDFLAGS="-static" bootstrap

The meaning of the make parameters:

Compilation is now complete. This is the point where we would normally run the test suite. But as discussed earlier, we don't recommend running the test suites for the temporary tools here in this chapter. However, even if we still wanted to run the GCC test suite, we're unable do so at this early stage because the test suite framework is not yet in place. Not only that, the programs from this first pass will soon be overwritten by those installed in the second pass.

And install the package:

make install

As a finishing touch we'll create the /tools/bin/cc symlink. Many programs and scripts run cc instead of gcc, a thing meant to keep programs generic and therefore usable on all kinds of Unix systems. Not everybody has the GNU C compiler installed. Simply running cc leaves the system administrator free to decide what C compiler to install, as long as there's a symlink pointing to it:

ln -s gcc /tools/bin/cc

The details on this package are found in the Section called Contents of GCC in Chapter 6.