4.9. GCC-13.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.9.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-4.2.1.tar.xz
mv -v mpfr-4.2.1 mpfr
tar xf ../gmp-6.3.0.tar.xz
mv -v gmp-6.3.0 gmp
tar xf ../mpc-1.3.1.tar.gz
mv -v mpc-1.3.1 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:
Note
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-13.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-13.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-c99Enable C99 support for C programs.
--enable-long-longEnables long long support in the compiler.
Continue with compiling the package:
make
Install the package:
make install
4.9.2. Contents of GCC¶
Short Descriptions¶
- gcc
The C compiler
- gcov
A coverage testing tool; it is used to analyze programs to determine where optimizations will have the most effect
libgccContains run-time support for gcc