gcc-pass1.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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/2003/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 GCC</title>
  35. <para>The GCC documentation recommends building GCC outside of the
  36. source directory in a dedicated build directory:</para>
  37. <screen><userinput remap="pre">mkdir -v ../gcc-build
  38. cd ../gcc-build</userinput></screen>
  39. <para>Prepare GCC for compilation:</para>
  40. <screen><userinput remap="configure">CC="gcc -B/usr/bin/" ../gcc-&gcc-version;/configure --prefix=/tools \
  41. --with-local-prefix=/tools --disable-nls --enable-shared \
  42. --enable-languages=c</userinput></screen>
  43. <variablelist>
  44. <title>The meaning of the configure options:</title>
  45. <varlistentry>
  46. <term><envar>CC="gcc -B/usr/bin/"</envar></term>
  47. <listitem>
  48. <para>This forces <command>gcc</command> to prefer the linker from
  49. the host in <filename class="directory">/usr/bin</filename>. This
  50. is necessary on some hosts where the new <command>ld</command>
  51. built in the previous section is not compatible with the host's
  52. <command>gcc</command>.</para>
  53. </listitem>
  54. </varlistentry>
  55. <varlistentry>
  56. <term><parameter>--with-local-prefix=/tools</parameter></term>
  57. <listitem>
  58. <para>The purpose of this switch is to remove <filename
  59. class="directory">/usr/local/include</filename> from
  60. <command>gcc</command>'s include search path. This is not
  61. absolutely essential, however, it helps to minimize the
  62. influence of the host system.</para>
  63. </listitem>
  64. </varlistentry>
  65. <varlistentry>
  66. <term><parameter>--enable-shared</parameter></term>
  67. <listitem>
  68. <para>This switch allows the building of <filename
  69. class="libraryfile">libgcc_s.so.1</filename> and
  70. <filename class="libraryfile">libgcc_eh.a</filename>.
  71. Having <filename class="libraryfile">libgcc_eh.a</filename>
  72. available ensures that the configure script for Glibc (the
  73. next package we compile) produces the proper results.</para>
  74. </listitem>
  75. </varlistentry>
  76. <varlistentry>
  77. <term><parameter>--enable-languages=c</parameter></term>
  78. <listitem>
  79. <para>This option ensures that only the C compiler is built.</para>
  80. </listitem>
  81. </varlistentry>
  82. </variablelist>
  83. <para>The following command will compile GCC not once, but several times. It
  84. uses the programs compiled in a first round to compile itself a second time,
  85. and then again a third time. It then compares these second and third compiles
  86. to make sure it can reproduce itself flawlessly. This is called
  87. <quote>bootstrapping</quote>. Building GCC in this way ensures that it was
  88. compiled correctly and is now the default configuration for the released
  89. package. Continue with compiling 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>As a finishing touch, create a symlink. Many programs and scripts
  99. run <command>cc</command> instead of <command>gcc</command>, which is
  100. used to keep programs generic and therefore usable on all kinds of UNIX
  101. systems where the GNU C compiler is not always installed. Running
  102. <command>cc</command> leaves the system administrator free to decide
  103. which C compiler to install:</para>
  104. <screen><userinput remap="install">ln -vs gcc /tools/bin/cc</userinput></screen>
  105. </sect2>
  106. <sect2 role="content">
  107. <title/>
  108. <para>Details on this package are located in
  109. <xref linkend="contents-gcc" role="."/></para>
  110. </sect2>
  111. </sect1>