gcc.xml 8.9 KB

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