%general-entities; ]> gcc-pass1 &gcc-version;
&gcc-url;
GCC-&gcc-version; - Pass 1 GCC tools, pass 1 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../chapter08/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> <seg>&gcc-tmpp1-sbu;</seg> <seg>&gcc-tmpp1-du;</seg> </seglistitem> </segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Cross GCC GCC requires the GMP, MPFR and MPC packages. As these packages may not be included in your host distribution, they will be built with GCC. Unpack each package into the GCC source directory and rename the resulting directories so the GCC build procedures will automatically use them: There are frequent misunderstandings about this chapter. The procedures are the same as every other chapter as explained earlier (). First extract the gcc tarball from the sources directory and then change to the directory created. Only then should you proceed with the instructions below. tar -xf ../mpfr-&mpfr-version;.tar.xz mv -v mpfr-&mpfr-version; mpfr tar -xf ../gmp-&gmp-version;.tar.xz mv -v gmp-&gmp-version; gmp tar -xf ../mpc-&mpc-version;.tar.gz mv -v mpc-&mpc-version; mpc On x86_64 hosts, set the default directory name for 64-bit libraries to lib: case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' \ -i.orig gcc/config/i386/t-linux64 ;; esac The GCC documentation recommends building GCC in a dedicated build directory: mkdir -v build cd build Prepare GCC for compilation: ../configure \ --target=$LFS_TGT \ --prefix=$LFS/tools \ --with-glibc-version=2.11 \ --with-sysroot=$LFS \ --with-newlib \ --without-headers \ --enable-initfini-array \ --disable-nls \ --disable-shared \ --disable-multilib \ --disable-decimal-float \ --disable-threads \ --disable-libatomic \ --disable-libgomp \ --disable-libquadmath \ --disable-libssp \ --disable-libvtv \ --disable-libstdcxx \ --enable-languages=c,c++ The meaning of the configure options: --with-glibc-version=2.11 This option ensures the package will be compatible with the host's version of glibc. It is set to the minimum glibc requirement specified in the . --with-newlib Since a working C library is not yet available, this ensures that the inhibit_libc constant is defined when building libgcc. This prevents the compiling of any code that requires libc support. --without-headers When creating a complete cross-compiler, GCC requires standard headers compatible with the target system. For our purposes these headers will not be needed. This switch prevents GCC from looking for them. --enable-initfini-array This switch forces the use of some internal data structures that are needed but cannot be detected when building a cross compiler. --disable-shared This switch forces GCC to link its internal libraries statically. We need this because the shared libraries require glibc, which is not yet installed on the target system. --disable-multilib On x86_64, LFS does not support a multilib configuration. This switch is harmless for x86. --disable-decimal-float, --disable-threads, --disable-libatomic, --disable-libgomp, --disable-libquadmath, --disable-libssp, --disable-libvtv, --disable-libstdcxx These switches disable support for the decimal floating point extension, threading, libatomic, libgomp, libquadmath, libssp, libvtv, and the C++ standard library respectively. These features will fail to compile when building a cross-compiler and are not necessary for the task of cross-compiling the temporary libc. --enable-languages=c,c++ This option ensures that only the C and C++ compilers are built. These are the only languages needed now. Compile GCC by running: make Install the package: make install This build of GCC has installed a couple of internal system headers. Normally one of them, limits.h, would in turn include the corresponding system limits.h header, in this case, $LFS/usr/include/limits.h. However, at the time of this build of GCC $LFS/usr/include/limits.h does not exist, so the internal header that has just been installed is a partial, self-contained file and does not include the extended features of the system header. This is adequate for building glibc, but the full internal header will be needed later. Create a full version of the internal header using a command that is identical to what the GCC build system does in normal circumstances: cd .. cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h <para>Details on this package are located in <xref linkend="contents-gcc" role="."/></para> </sect2> </sect1>