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.
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-arch=${CLFS_CPU}
The meaning of the configure options not used previously:
--enable-c99
Enable C99 support for C programs.
--enable-long-long
Enables long long support in the compiler.
Continue with compiling the package:
make
Install the package:
make install