gcc-pass1.xml 4.4 KB

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