gcc-pass1.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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:</para>
  38. <screen><userinput remap="pre">tar -jxf ../mpfr-&mpfr-version;.tar.bz2
  39. mv -v mpfr-&mpfr-version; mpfr
  40. tar -jxf ../gmp-&gmp-version;.tar.bz2
  41. mv -v gmp-&gmp-version; gmp
  42. tar -zxf ../mpc-&mpc-version;.tar.gz
  43. mv -v mpc-&mpc-version; mpc</userinput></screen>
  44. <para>The GCC documentation recommends building GCC outside of the
  45. source directory in a dedicated build directory:</para>
  46. <screen><userinput remap="pre">mkdir -v ../gcc-build
  47. cd ../gcc-build</userinput></screen>
  48. <para>Prepare GCC for compilation:</para>
  49. <screen><userinput remap="configure">../gcc-&gcc-version;/configure \
  50. --target=$LFS_TGT --prefix=/tools \
  51. --disable-nls --disable-shared --disable-multilib \
  52. --disable-decimal-float --disable-threads \
  53. --disable-libmudflap --disable-libssp \
  54. --disable-libgomp --enable-languages=c</userinput></screen>
  55. <variablelist>
  56. <title>The meaning of the configure options:</title>
  57. <varlistentry>
  58. <term><parameter>--disable-shared</parameter></term>
  59. <listitem>
  60. <para>This switch forces GCC to link its internal libraries
  61. statically. We do this to avoid possible issues with the host
  62. system.</para>
  63. </listitem>
  64. </varlistentry>
  65. <varlistentry>
  66. <term><parameter>--disable-decimal-float, --disable-threads, --disable-libmudflap, --disable-libssp, --disable-libgomp</parameter></term>
  67. <listitem>
  68. <para>These switches disable support for the decimal floating point extension,
  69. threading, libmudflap, libssp and libgomp respectively. These features will fail
  70. to compile when building a cross-compiler and are not necessary for the task of
  71. cross-compiling the temporary libc.</para>
  72. </listitem>
  73. </varlistentry>
  74. <varlistentry>
  75. <term><parameter>--disable-multilib</parameter></term>
  76. <listitem>
  77. <para>On x86_64, LFS does not yet support a multilib configuration.
  78. This switch is harmless for x86.</para>
  79. </listitem>
  80. </varlistentry>
  81. <varlistentry>
  82. <term><parameter>--enable-languages=c</parameter></term>
  83. <listitem>
  84. <para>This option ensures that only the C compiler is built.
  85. This is the only language needed now.</para>
  86. </listitem>
  87. </varlistentry>
  88. </variablelist>
  89. <para>Compile GCC by running:</para>
  90. <screen><userinput remap="make">make</userinput></screen>
  91. <para>Compilation is now complete. At this point, the test suite would
  92. normally be run, but, as mentioned before, the test suite framework is
  93. not in place yet. The benefits of running the tests at this point
  94. are minimal since the programs from this first pass will soon be
  95. replaced.</para>
  96. <para>Install the package:</para>
  97. <screen><userinput remap="install">make install</userinput></screen>
  98. <para>Using <parameter>--disable-shared</parameter> means that the
  99. <filename>libgcc_eh.a</filename> file isn't created and installed. The
  100. Glibc package depends on this library as it uses
  101. <parameter>-lgcc_eh</parameter> within its build system. This dependency
  102. can be satisfied by creating a symlink to <filename>libgcc.a</filename>,
  103. since that file will end up containing the objects normally contained in
  104. <filename>libgcc_eh.a</filename>:</para>
  105. <screen><userinput remap="install">ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
  106. sed 's/libgcc/&amp;_eh/'`</userinput></screen>
  107. </sect2>
  108. <sect2 role="content">
  109. <title/>
  110. <para>Details on this package are located in
  111. <xref linkend="contents-gcc" role="."/></para>
  112. </sect2>
  113. </sect1>