gcc-pass1.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-tools-gcc-pass1" role="wrap">
  8. <?dbhtml filename="gcc-pass1.html"?>
  9. <sect1info condition="script">
  10. <productname>gcc</productname>
  11. <productnumber>&gcc-version;</productnumber>
  12. <address>&gcc-url;</address>
  13. </sect1info>
  14. <title>GCC-&gcc-version; - Pass 1</title>
  15. <indexterm zone="ch-tools-gcc-pass1">
  16. <primary sortas="a-GCC">GCC</primary>
  17. <secondary>tools, pass 1</secondary>
  18. </indexterm>
  19. <sect2 role="package">
  20. <title/>
  21. <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
  22. href="../chapter06/gcc.xml"
  23. xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
  24. <segmentedlist>
  25. <segtitle>&buildtime;</segtitle>
  26. <segtitle>&diskspace;</segtitle>
  27. <seglistitem>
  28. <seg>&gcc-ch5p1-sbu;</seg>
  29. <seg>&gcc-ch5p1-du;</seg>
  30. </seglistitem>
  31. </segmentedlist>
  32. </sect2>
  33. <sect2 role="installation">
  34. <title>Installation of Cross GCC</title>
  35. <para>GCC now requires the GMP, MPFR and MPC packages. As these packages may
  36. not be included in your host distribution, they will be built with
  37. GCC. Unpack each package into the GCC source directory and rename the
  38. resulting directories so the GCC build procedures will automatically
  39. use them:</para>
  40. <screen><userinput remap="pre">tar -jxf ../mpfr-&mpfr-version;.tar.bz2
  41. mv -v mpfr-&mpfr-version; mpfr
  42. tar -jxf ../gmp-&gmp-version;.tar.bz2
  43. mv -v gmp-&gmp-version; gmp
  44. tar -zxf ../mpc-&mpc-version;.tar.gz
  45. mv -v mpc-&mpc-version; mpc</userinput></screen>
  46. <para>Apply a patch that will allow the building of the libiberty and zlib
  47. target libraries to be disabled as these do not build correctly in a
  48. cross-compiled environment:</para>
  49. <screen><userinput remap="pre">patch -Np1 -i ../&gcc-crosscompile-patch;</userinput></screen>
  50. <para>The GCC documentation recommends building GCC outside of the
  51. source directory in a dedicated build directory:</para>
  52. <screen><userinput remap="pre">mkdir -v ../gcc-build
  53. cd ../gcc-build</userinput></screen>
  54. <para>Prepare GCC for compilation:</para>
  55. <screen><userinput remap="configure">../gcc-&gcc-version;/configure \
  56. --target=$LFS_TGT --prefix=/tools \
  57. --disable-nls --disable-shared --disable-multilib \
  58. --disable-decimal-float --disable-threads \
  59. --disable-libmudflap --disable-libssp \
  60. --disable-libgomp --disable-libquadmath \
  61. --disable-target-libiberty --disable-target-zlib \
  62. --enable-languages=c --without-ppl --without-cloog \
  63. --with-mpfr-include=$LFS/sources/gcc-&gcc-version;/mpfr/src \
  64. --with-mpfr-lib=$LFS/sources/gcc-build/mpfr/src/.libs</userinput></screen>
  65. <variablelist>
  66. <title>The meaning of the configure options:</title>
  67. <varlistentry>
  68. <term><parameter>--disable-shared</parameter></term>
  69. <listitem>
  70. <para>This switch forces GCC to link its internal libraries
  71. statically. We do this to avoid possible issues with the host
  72. system.</para>
  73. </listitem>
  74. </varlistentry>
  75. <varlistentry>
  76. <term><parameter>--disable-decimal-float, --disable-threads, --disable-libmudflap, --disable-libssp, --disable-libgomp, --disable-libquadmath --disable-target-libiberty --disable-target-zlib</parameter></term>
  77. <listitem>
  78. <para>These switches disable support for the decimal floating point
  79. extension, threading, libmudflap, libssp and libgomp, libquadmath,
  80. libiberty and zlib respectively. These features will fail to compile
  81. when building a cross-compiler and are not necessary for the task of
  82. cross-compiling the temporary libc.</para>
  83. </listitem>
  84. </varlistentry>
  85. <varlistentry>
  86. <term><parameter>--disable-multilib</parameter></term>
  87. <listitem>
  88. <para>On x86_64, LFS does not yet support a multilib configuration.
  89. This switch is harmless for x86.</para>
  90. </listitem>
  91. </varlistentry>
  92. <varlistentry>
  93. <term><parameter>--enable-languages=c</parameter></term>
  94. <listitem>
  95. <para>This option ensures that only the C compiler is built.
  96. This is the only language needed now.</para>
  97. </listitem>
  98. </varlistentry>
  99. <varlistentry>
  100. <term><parameter>--without-ppl, --without-cloog</parameter></term>
  101. <listitem>
  102. <para>These switches prevent GCC from building against the PPL and
  103. CLooG libraries which may be present on the host system, but will not
  104. be available in the chroot environment.</para>
  105. </listitem>
  106. </varlistentry>
  107. </variablelist>
  108. <para>Compile GCC by running:</para>
  109. <screen><userinput remap="make">make</userinput></screen>
  110. <para>Compilation is now complete. At this point, the test suite would
  111. normally be run, but, as mentioned before, the test suite framework is
  112. not in place yet. The benefits of running the tests at this point
  113. are minimal since the programs from this first pass will soon be
  114. replaced.</para>
  115. <para>Install the package:</para>
  116. <screen><userinput remap="install">make install</userinput></screen>
  117. <para>Using <parameter>--disable-shared</parameter> means that the
  118. <filename>libgcc_eh.a</filename> file isn't created and installed. The
  119. Glibc package depends on this library as it uses
  120. <parameter>-lgcc_eh</parameter> within its build system. This dependency
  121. can be satisfied by creating a symlink to <filename>libgcc.a</filename>,
  122. since that file will end up containing the objects normally contained in
  123. <filename>libgcc_eh.a</filename>:</para>
  124. <screen><userinput remap="install">ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
  125. sed 's/libgcc/&amp;_eh/'`</userinput></screen>
  126. </sect2>
  127. <sect2 role="content">
  128. <title/>
  129. <para>Details on this package are located in
  130. <xref linkend="contents-gcc" role="."/></para>
  131. </sect2>
  132. </sect1>