gcc-pass1.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. <note><para>There are frequent misunderstandings about this chapter. The
  41. procedures are the same as every other chapter as explained earlier (<xref
  42. linkend='buildinstr'/>). First extract the gcc tarball from the sources
  43. directory and then change to the directory created. Only then should you
  44. proceed with the instructions below.</para></note>
  45. <screen><userinput remap="pre">tar -jxf ../mpfr-&mpfr-version;.tar.bz2
  46. mv -v mpfr-&mpfr-version; mpfr
  47. tar -Jxf ../gmp-&gmp-version;.tar.xz
  48. mv -v gmp-&gmp-version; gmp
  49. tar -zxf ../mpc-&mpc-version;.tar.gz
  50. mv -v mpc-&mpc-version; mpc</userinput></screen>
  51. <para>Apply a patch that will allow the building of the libiberty and zlib
  52. target libraries to be disabled as these do not build correctly in a
  53. cross-compiled environment:</para>
  54. <screen><userinput remap="pre">patch -Np1 -i ../&gcc-crosscompile-patch;</userinput></screen>
  55. <para>The GCC documentation recommends building GCC outside of the
  56. source directory in a dedicated build directory:</para>
  57. <screen><userinput remap="pre">mkdir -v ../gcc-build
  58. cd ../gcc-build</userinput></screen>
  59. <para>Prepare GCC for compilation:</para>
  60. <screen><userinput remap="configure">../gcc-&gcc-version;/configure \
  61. --target=$LFS_TGT --prefix=/tools \
  62. --disable-nls --disable-shared --disable-multilib \
  63. --disable-decimal-float --disable-threads \
  64. --disable-libmudflap --disable-libssp \
  65. --disable-libgomp --disable-libquadmath \
  66. --disable-target-libiberty --disable-target-zlib \
  67. --enable-languages=c --without-ppl --without-cloog \
  68. --with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src \
  69. --with-mpfr-lib=$(pwd)/mpfr/src/.libs</userinput></screen>
  70. <variablelist>
  71. <title>The meaning of the configure options:</title>
  72. <varlistentry>
  73. <term><parameter>--disable-shared</parameter></term>
  74. <listitem>
  75. <para>This switch forces GCC to link its internal libraries
  76. statically. We do this to avoid possible issues with the host
  77. system.</para>
  78. </listitem>
  79. </varlistentry>
  80. <varlistentry>
  81. <term><parameter>--disable-decimal-float, --disable-threads, --disable-libmudflap, --disable-libssp, --disable-libgomp, --disable-libquadmath --disable-target-libiberty --disable-target-zlib</parameter></term>
  82. <listitem>
  83. <para>These switches disable support for the decimal floating point
  84. extension, threading, libmudflap, libssp and libgomp, libquadmath,
  85. libiberty and zlib respectively. These features will fail to compile
  86. when building a cross-compiler and are not necessary for the task of
  87. cross-compiling the temporary libc.</para>
  88. </listitem>
  89. </varlistentry>
  90. <varlistentry>
  91. <term><parameter>--disable-multilib</parameter></term>
  92. <listitem>
  93. <para>On x86_64, LFS does not yet support a multilib configuration.
  94. This switch is harmless for x86.</para>
  95. </listitem>
  96. </varlistentry>
  97. <varlistentry>
  98. <term><parameter>--enable-languages=c</parameter></term>
  99. <listitem>
  100. <para>This option ensures that only the C compiler is built.
  101. This is the only language needed now.</para>
  102. </listitem>
  103. </varlistentry>
  104. <varlistentry>
  105. <term><parameter>--without-ppl, --without-cloog</parameter></term>
  106. <listitem>
  107. <para>These switches prevent GCC from building against the PPL and
  108. CLooG libraries which may be present on the host system, but will not
  109. be available in the chroot environment.</para>
  110. </listitem>
  111. </varlistentry>
  112. </variablelist>
  113. <para>Compile GCC by running:</para>
  114. <screen><userinput remap="make">make</userinput></screen>
  115. <para>Compilation is now complete. At this point, the test suite would
  116. normally be run, but, as mentioned before, the test suite framework is
  117. not in place yet. The benefits of running the tests at this point
  118. are minimal since the programs from this first pass will soon be
  119. replaced.</para>
  120. <para>Install the package:</para>
  121. <screen><userinput remap="install">make install</userinput></screen>
  122. <para>Using <parameter>--disable-shared</parameter> means that the
  123. <filename>libgcc_eh.a</filename> file isn't created and installed. The
  124. Glibc package depends on this library as it uses
  125. <parameter>-lgcc_eh</parameter> within its build system. This dependency
  126. can be satisfied by creating a symlink to <filename>libgcc.a</filename>,
  127. since that file will end up containing the objects normally contained in
  128. <filename>libgcc_eh.a</filename>:</para>
  129. <screen><userinput remap="install">ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
  130. sed 's/libgcc/&amp;_eh/'`</userinput></screen>
  131. </sect2>
  132. <sect2 role="content">
  133. <title/>
  134. <para>Details on this package are located in
  135. <xref linkend="contents-gcc" role="."/></para>
  136. </sect2>
  137. </sect1>