gcc.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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-system-gcc" role="wrap">
  7. <title>GCC-&gcc-version;</title>
  8. <?dbhtml filename="gcc.html"?>
  9. <indexterm zone="ch-system-gcc"><primary sortas="a-GCC">GCC</primary></indexterm>
  10. <sect2 role="package"><title/>
  11. <para>The GCC package contains the GNU compiler collection, which includes
  12. the C and C++ compilers.</para>
  13. <segmentedlist>
  14. <segtitle>&buildtime;</segtitle>
  15. <segtitle>&diskspace;</segtitle>
  16. <seglistitem><seg>11.7 SBU</seg><seg>451 MB</seg></seglistitem>
  17. </segmentedlist>
  18. <segmentedlist>
  19. <segtitle>&dependencies;</segtitle>
  20. <seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, Findutils,
  21. Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo</seg></seglistitem>
  22. </segmentedlist>
  23. </sect2>
  24. <sect2 role="installation">
  25. <title>Installation of GCC</title>
  26. <para>Apply a <command>sed</command> substitution that will suppress the
  27. installation of <filename class="libraryfile">libiberty.a</filename>. The
  28. version of <filename class="libraryfile">libiberty.a</filename> provided by
  29. Binutils will be used instead:</para>
  30. <screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
  31. <para>The bootstrap build performed in <xref linkend="ch-tools-gcc-pass1"/>
  32. built GCC with the <option>-fomit-frame-pointer</option> compiler flag.
  33. Non-bootstrap builds omit this flag by default, so apply the following
  34. <command>sed</command> to use it in order to ensure consistent compiler builds.
  35. </para>
  36. <screen><userinput>sed -i 's/^XCFLAGS =$/&amp; -fomit-frame-pointer/' gcc/Makefile.in</userinput></screen>
  37. <para>The <command>fixincludes</command> script is known to occasionally
  38. erroneously attempt to &quot;fix&quot; the system headers installed so far. As
  39. the headers installed by GCC-&gcc-version; and Glibc-&glibc-version; are known
  40. to not require fixing, issue the following command to prevent the
  41. <command>fixincludes</command> script from running:</para>
  42. <screen><userinput>sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in</userinput></screen>
  43. <para>The GCC documentation recommends building GCC outside of the source
  44. directory in a dedicated build directory:</para>
  45. <screen><userinput>mkdir -v ../gcc-build
  46. cd ../gcc-build</userinput></screen>
  47. <para>Prepare GCC for compilation:</para>
  48. <screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
  49. --libexecdir=/usr/lib --enable-shared \
  50. --enable-threads=posix --enable-__cxa_atexit \
  51. --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
  52. <para>Compile the package:</para>
  53. <screen><userinput>make</userinput></screen>
  54. <important><para>In this section, the test suite for GCC is considered
  55. critical. Do not skip it under any circumstance.</para></important>
  56. <para>Test the results, but do not stop at errors:</para>
  57. <screen><userinput>make -k check</userinput></screen>
  58. <para>Some of the errors are known issues and were noted in the
  59. previous chapter. The test suite notes from <xref
  60. linkend="ch-tools-gcc-pass2" role=","/> are still relevant here. Be sure to
  61. refer back to them as necessary.</para>
  62. <para>Install the package:</para>
  63. <screen><userinput>make install</userinput></screen>
  64. <para>Some packages expect the C preprocessor to be installed in the
  65. <filename class="directory">/lib</filename> directory.
  66. To support those packages, create this symlink:</para>
  67. <screen><userinput>ln -sv ../usr/bin/cpp /lib</userinput></screen>
  68. <para>Many packages use the name <command>cc</command> to call the C
  69. compiler. To satisfy those packages, create a symlink:</para>
  70. <screen><userinput>ln -sv gcc /usr/bin/cc</userinput></screen>
  71. <note><para>At this point, it is strongly recommended to repeat the
  72. sanity check performed earlier in this chapter. Refer back to <xref
  73. linkend="ch-system-readjusting" role=","/> and repeat the check. If the results
  74. are in error, then the most likely reason is that the GCC Specs patch
  75. from <xref linkend="chapter-temporary-tools"/> was erroneously applied
  76. here.</para></note>
  77. </sect2>
  78. <sect2 id="contents-gcc" role="content"><title>Contents of GCC</title>
  79. <segmentedlist>
  80. <segtitle>Installed programs</segtitle>
  81. <segtitle>Installed libraries</segtitle>
  82. <seglistitem><seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and
  83. gcov</seg>
  84. <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.a</seg></seglistitem>
  85. </segmentedlist>
  86. <variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
  87. <?dbfo list-presentation="list"?>
  88. <?dbhtml list-presentation="table"?>
  89. <varlistentry id="cc">
  90. <term><command>cc</command></term>
  91. <listitem>
  92. <para>The C compiler</para>
  93. <indexterm zone="ch-system-gcc cc"><primary sortas="b-cc">cc</primary></indexterm>
  94. </listitem>
  95. </varlistentry>
  96. <varlistentry id="cpp">
  97. <term><command>cpp</command></term>
  98. <listitem>
  99. <para>The C preprocessor; it is used by the compiler to expand the
  100. #include, #define, and similar statements in the source files</para>
  101. <indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
  102. </listitem>
  103. </varlistentry>
  104. <varlistentry id="c">
  105. <term><command>c++</command></term>
  106. <listitem>
  107. <para>The C++ compiler</para>
  108. <indexterm zone="ch-system-gcc c"><primary sortas="b-c++">c++</primary></indexterm>
  109. </listitem>
  110. </varlistentry>
  111. <varlistentry id="g">
  112. <term><command>g++</command></term>
  113. <listitem>
  114. <para>The C++ compiler</para>
  115. <indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
  116. </listitem>
  117. </varlistentry>
  118. <varlistentry id="gcc">
  119. <term><command>gcc</command></term>
  120. <listitem>
  121. <para>The C compiler</para>
  122. <indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
  123. </listitem>
  124. </varlistentry>
  125. <varlistentry id="gccbug">
  126. <term><command>gccbug</command></term>
  127. <listitem>
  128. <para>A shell script used to help create useful bug reports</para>
  129. <indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
  130. </listitem>
  131. </varlistentry>
  132. <varlistentry id="gcov">
  133. <term><command>gcov</command></term>
  134. <listitem>
  135. <para>A coverage testing tool; it is used to analyze programs to
  136. determine where optimizations will have the most effect</para>
  137. <indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
  138. </listitem>
  139. </varlistentry>
  140. <varlistentry id="libgcc">
  141. <term><filename class="libraryfile">libgcc</filename></term>
  142. <listitem>
  143. <para>Contains run-time support for <command>gcc</command></para>
  144. <indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
  145. </listitem>
  146. </varlistentry>
  147. <varlistentry id="libstdc">
  148. <term><filename class="libraryfile">libstdc++</filename></term>
  149. <listitem>
  150. <para>The standard C++ library</para>
  151. <indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
  152. </listitem>
  153. </varlistentry>
  154. <varlistentry id="libsupc">
  155. <term><filename class="libraryfile">libsupc++</filename></term>
  156. <listitem>
  157. <para>Provides supporting routines for the C++ programming language</para>
  158. <indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
  159. </listitem>
  160. </varlistentry>
  161. </variablelist>
  162. </sect2>
  163. </sect1>