4.10. GCC-6.2.0 - Final

The GCC package contains the GNU compiler collection, which includes the C compiler. This second build of GCC will produce the final cross compiler which will use the previously built C library.

4.10.1. Installation of GCC Cross Compiler

GCC requires the GMP, MPFR, and MPC packages to either be present on the host or to be present in source form within the gcc source tree. Unpack these into the GCC directory after unpacking GCC:

tar xf ../mpfr-3.1.4.tar.bz2
mv -v mpfr-3.1.4 mpfr
tar xf ../gmp-6.1.1.tar.bz2
mv -v gmp-6.1.1 gmp
tar xf ../mpc-1.0.3.tar.gz
mv -v mpc-1.0.3 mpc

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

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

Prepare GCC for compilation:



If you would like to build a C++ compiler in addition to the C compiler, change the following --enable-languages=c option to be --enable-languages=c,c++ instead. A C++ compiler is not required for any of the software included in this book.

../gcc-6.2.0/configure \
  --prefix=${CLFS}/cross-tools \
  --build=${CLFS_HOST} \
  --host=${CLFS_HOST} \
  --target=${CLFS_TARGET} \
  --with-sysroot=${CLFS}/cross-tools/${CLFS_TARGET} \
  --disable-nls \
  --enable-languages=c \
  --enable-c99 \
  --enable-long-long \
  --disable-libmudflap \
  --disable-multilib \
  --with-mpfr-include=$(pwd)/../gcc-6.2.0/mpfr/src \
  --with-mpfr-lib=$(pwd)/mpfr/src/.libs \
  --with-abi=${CLFS_ABI} \
  --with-arch=mips${CLFS_MIPS_LEVEL} \
  --with-float=${CLFS_FLOAT} \

The meaning of the configure options not used previously:


Enable C99 support for C programs.


Enables long long support in the compiler.

Continue with compiling the package:


Install the package:

make install

4.10.2. Contents of GCC

Installed programs: gcc, and gcov
Installed libraries: libgcc.a, libgcc_eh.a, and libgcc_s.so

Short Descriptions


The C compiler


A coverage testing tool; it is used to analyze programs to determine where optimizations will have the most effect


Contains run-time support for gcc