gcc.xml 7.2 KB

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