%general-entities; ]> Cross GCC-&gcc-version; - Static GCC cross tools, static Installation of Cross GCC Compiler with Static libgcc and no Threads We will make a couple of essential adjustments to the specs file to point to use our build environment: patch -Np1 -i ../&gcc-specs-patch; To make sure that we use the proper syntax for a couple of tools, we apply the following patch: patch -Np1 -i ../&gcc-posix-patch; The following patch ensures that gcc does not search the /usr directory for libgcc_s.so when cross-compiling: patch -Np1 -i ../&gcc-cross_search-patch; Now we will need to setup our StartFile Spec to the correct library location: echo " #undef STARTFILE_PREFIX_SPEC #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/linux.h Now we will change gcc's search path to look into /tools only: cp gcc/Makefile.in{,.orig} sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ gcc/Makefile.in.orig > gcc/Makefile.in The above patches and sed's are critical in ensuring a successful overall build. Do not forget to apply them. ../gcc-&gcc-version;/configure --prefix=/cross-tools \ --host=${LFS_HOST} --target=${LFS_TARGET} \ --with-local-prefix=/tools --disable-nls --disable-shared \ --disable-threads --enable-languages=c The meaning of the configure options: --with-local-prefix=/tools 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. --disable-shared Disables the creation of the shared libraries. --disable-threads This will prevent GCC from finding the multi-thread include files, since we haven't created them for this architecture yet. We will be able to find the multi-thread information after we create the Glibc headers. --enable-languages=c This option ensures that only the C compiler is built. Continue with compiling the package: make all-gcc Install the package: make install-gcc <para>Details on this package are located in <xref linkend="contents-gcc" role="."/></para> </sect2> </sect1>