gcc-pass1.xml 4.6 KB

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