Details on this package are located in Section 10.9.2, “Contents of GCC.”
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
Make a couple of essential adjustments to the specs file to ensure GCC uses our build environment:
patch -Np1 -i ../gcc-4.1.1-pure64_specs-1.patch
To make sure that a couple of tools use the proper syntax, apply the following patch:
patch -Np1 -i ../gcc-4.1.1-posix-1.patch
The following patch ensures that gcc does not search the /usr directory for libgcc_s.so when cross-compiling:
patch -Np1 -i ../gcc-4.1.1-cross_search_paths-1.patch
Change the StartFile Spec to point to the correct library location:
echo " #undef STARTFILE_PREFIX_SPEC #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/sparc/linux.h echo " #undef STARTFILE_PREFIX_SPEC #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/sparc/linux64.h
Now alter gcc's c preprocessor's default include search path to use /tools only:
cp -v gcc/Makefile.in{,.orig} sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ gcc/Makefile.in.orig > gcc/Makefile.in
The above modifications are critical in ensuring a successful overall build. Do not forget to apply them.
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:
../gcc-4.1.1/configure --prefix=/cross-tools \ --host=${CLFS_HOST} --target=${CLFS_TARGET} --disable-multilib \ --with-local-prefix=/tools --disable-nls --disable-shared \ --disable-threads --enable-languages=c
The meaning of the configure options:
The purpose of this switch is to remove /usr/local/include from gcc's include search path. This is not absolutely essential, however, it helps to minimize the influence of the host system.
Disables the creation of the shared libraries.
This will prevent GCC from looking for the multi-thread include files, since they haven't been created for this architecture yet. GCC will be able to find the multi-thread information after the Glibc headers are created.
This option ensures that only the C compiler is built.
Continue with compiling the package:
make CFLAGS_FOR_TARGET="${GCCTARGET}" all-gcc
Install the package:
make install-gcc
Details on this package are located in Section 10.9.2, “Contents of GCC.”