gcc-pass1.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. <!ENTITY % patches-entities SYSTEM "../patches.ent">
  5. %general-entities;
  6. %patches-entities;
  7. ]>
  8. <sect1 id="ch-tools-gcc-pass1" role="wrap">
  9. <title>GCC-&gcc-version; - Pass 1</title>
  10. <?dbhtml filename="gcc-pass1.html"?>
  11. <indexterm zone="ch-tools-gcc-pass1">
  12. <primary sortas="a-GCC">GCC</primary>
  13. <secondary>tools, pass 1</secondary></indexterm>
  14. <sect2 role="package"><title/>
  15. <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
  16. <segmentedlist>
  17. <segtitle>&buildtime;</segtitle>
  18. <segtitle>&diskspace;</segtitle>
  19. <seglistitem><seg>4.4 SBU</seg><seg>219 MB</seg></seglistitem>
  20. </segmentedlist>
  21. <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/>
  22. </sect2>
  23. <sect2 role="installation">
  24. <title>Installation of GCC</title>
  25. <para>Unpack only the gcc-core tarball because neither the C++
  26. compiler nor the test suite will be needed here.</para>
  27. <para>This package is known to have issues when its default
  28. optimization flags (including the <parameter>-march</parameter> and
  29. <parameter>-mcpu</parameter> options) are changed. If any environment
  30. variables that override default optimizations have been defined, such
  31. as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
  32. unset them when building GCC.</para>
  33. <para>The GCC documentation recommends building GCC outside of the
  34. source directory in a dedicated build directory:</para>
  35. <screen><userinput>mkdir ../gcc-build
  36. cd ../gcc-build</userinput></screen>
  37. <para>Prepare GCC for compilation:</para>
  38. <screen><userinput>../gcc-&gcc-version;/configure --prefix=/tools \
  39. --libexecdir=/tools/lib --with-local-prefix=/tools \
  40. --disable-nls --enable-shared --enable-languages=c</userinput></screen>
  41. <para>The meaning of the configure options:</para>
  42. <variablelist>
  43. <varlistentry>
  44. <term><parameter>--with-local-prefix=/tools</parameter></term>
  45. <listitem><para>The purpose of this switch is to remove <filename class="directory">/usr/local/include</filename>
  46. from <command>gcc</command>'s include search path. This is not absolutely
  47. essential, however, it helps to minimize the influence of the host
  48. system.</para>
  49. </listitem>
  50. </varlistentry>
  51. <varlistentry>
  52. <term><parameter>--enable-shared</parameter></term>
  53. <listitem><para>This switch allows the building of
  54. <filename class="libraryfile">libgcc_s.so.1</filename> and
  55. <filename class="libraryfile">libgcc_eh.a</filename>. Having
  56. <filename class="libraryfile">libgcc_eh.a</filename> available ensures that the
  57. configure script for Glibc (the next package we compile) produces the proper
  58. results.</para></listitem>
  59. </varlistentry>
  60. <varlistentry>
  61. <term><parameter>--enable-languages=c</parameter></term>
  62. <listitem><para>This option ensures that only the C compiler is built.
  63. This option is only needed when you have downloaded and unpacked the
  64. full GCC tarball, as opposed to just the gcc-core
  65. tarball.</para></listitem>
  66. </varlistentry>
  67. </variablelist>
  68. <para>Continue with compiling the package:</para>
  69. <screen><userinput>make bootstrap</userinput></screen>
  70. <para>The meaning of the make parameters:</para>
  71. <variablelist>
  72. <varlistentry>
  73. <term><parameter>bootstrap</parameter></term>
  74. <listitem><para>This target does not just compile GCC, but compiles it
  75. several times. It uses the programs compiled in a first round to
  76. compile itself a second time, and then again a third time. It then
  77. compares these second and third compiles to make sure it can reproduce
  78. itself flawlessly. This also implies that it was compiled
  79. correctly.</para></listitem>
  80. </varlistentry>
  81. </variablelist>
  82. <para>Compilation is now complete. At this point, the test suite would
  83. normally be run, but, as mentioned before, the test suite framework is
  84. not in place yet. The benefits of running the tests at this point
  85. are minimal since the programs from this first pass will soon be
  86. replaced.</para>
  87. <para>Install the package:</para>
  88. <screen><userinput>make install</userinput></screen>
  89. <para>As a finishing touch, create a symlink. Many programs and
  90. scripts run <command>cc</command> instead of <command>gcc</command>, which is used to keep programs generic
  91. and therefore usable on all kinds of UNIX systems where the GNU C compiler
  92. is not always installed. Running <command>cc</command> leaves the system administrator
  93. free to decide which C compiler to install.</para>
  94. <screen><userinput>ln -s gcc /tools/bin/cc</userinput></screen>
  95. </sect2>
  96. <sect2 role="content"><title/>
  97. <para>Details on this package are located in <xref
  98. linkend="contents-gcc" role="."/></para>
  99. </sect2>
  100. </sect1>