gcc.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 only the No-Fixincludes patch (not the Specs patch) also
  35. used in the previous chapter:</para>
  36. <screen><userinput>patch -Np1 -i ../&gcc-no_fixincludes-patch;</userinput></screen>
  37. <para>GCC fails to compile some packages outside of a base Linux From Scratch
  38. install (e.g., Mozilla and kdegraphics) when used in conjunction with newer
  39. versions of Binutils. Apply the following patch to fix this issue:</para>
  40. <screen><userinput>patch -Np1 -i ../&gcc-linkonce-patch;</userinput></screen>
  41. <para>Apply a <command>sed</command> substitution that will suppress the
  42. installation of <filename class="libraryfile">libiberty.a</filename>. The
  43. version of <filename class="libraryfile">libiberty.a</filename> provided by
  44. Binutils will be used instead:</para>
  45. <screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
  46. <para>The GCC documentation recommends building GCC outside of the source
  47. directory in a dedicated build directory:</para>
  48. <screen><userinput>mkdir ../gcc-build
  49. cd ../gcc-build</userinput></screen>
  50. <para>Prepare GCC for compilation:</para>
  51. <screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
  52. --libexecdir=/usr/lib --enable-shared \
  53. --enable-threads=posix --enable-__cxa_atexit \
  54. --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
  55. <para>Compile the package:</para>
  56. <screen><userinput>make</userinput></screen>
  57. <important><para>In this section, the test suite for GCC is considered
  58. critical. Do not skip it under any circumstance.</para></important>
  59. <para>Test the results, but do not stop at errors:</para>
  60. <screen><userinput>make -k check</userinput></screen>
  61. <para>Some of the errors are known issues and were noted in the
  62. previous chapter. The test suite notes from <xref
  63. linkend="ch-tools-gcc-pass2" role=","/> are still relevant here. Be sure to
  64. refer back to them as necessary.</para>
  65. <para>Install the package:</para>
  66. <screen><userinput>make install</userinput></screen>
  67. <para>Some packages expect the C preprocessor to be installed in the
  68. <filename class="directory">/lib</filename> directory.
  69. To support those packages, create this symlink:</para>
  70. <screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
  71. <para>Many packages use the name <command>cc</command> to call the C
  72. compiler. To satisfy those packages, create a symlink:</para>
  73. <screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
  74. <note><para>At this point, it is strongly recommended to repeat the
  75. sanity check performed earlier in this chapter. Refer back to <xref
  76. linkend="ch-system-readjusting" role=","/> and repeat the check. If the results
  77. are in error, then the most likely reason is that the GCC Specs patch
  78. from <xref linkend="chapter-temporary-tools"/> was erroneously applied
  79. here.</para></note>
  80. </sect2>
  81. <sect2 id="contents-gcc" role="content"><title>Contents of GCC</title>
  82. <segmentedlist>
  83. <segtitle>Installed programs</segtitle>
  84. <segtitle>Installed libraries</segtitle>
  85. <seglistitem><seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and
  86. gcov</seg>
  87. <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.a</seg></seglistitem>
  88. </segmentedlist>
  89. <variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
  90. <?dbfo list-presentation="list"?>
  91. <?dbhtml list-presentation="table"?>
  92. <varlistentry id="cc">
  93. <term><command>cc</command></term>
  94. <listitem>
  95. <para>The C compiler</para>
  96. <indexterm zone="ch-system-gcc cc"><primary sortas="b-cc">cc</primary></indexterm>
  97. </listitem>
  98. </varlistentry>
  99. <varlistentry id="cpp">
  100. <term><command>cpp</command></term>
  101. <listitem>
  102. <para>The C preprocessor; it is used by the compiler to expand the
  103. #include, #define, and similar statements in the source files</para>
  104. <indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
  105. </listitem>
  106. </varlistentry>
  107. <varlistentry id="c">
  108. <term><command>c++</command></term>
  109. <listitem>
  110. <para>The C++ compiler</para>
  111. <indexterm zone="ch-system-gcc c"><primary sortas="b-c++">c++</primary></indexterm>
  112. </listitem>
  113. </varlistentry>
  114. <varlistentry id="g">
  115. <term><command>g++</command></term>
  116. <listitem>
  117. <para>The C++ compiler</para>
  118. <indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
  119. </listitem>
  120. </varlistentry>
  121. <varlistentry id="gcc">
  122. <term><command>gcc</command></term>
  123. <listitem>
  124. <para>The C compiler</para>
  125. <indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
  126. </listitem>
  127. </varlistentry>
  128. <varlistentry id="gccbug">
  129. <term><command>gccbug</command></term>
  130. <listitem>
  131. <para>A shell script used to help create useful bug reports</para>
  132. <indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
  133. </listitem>
  134. </varlistentry>
  135. <varlistentry id="gcov">
  136. <term><command>gcov</command></term>
  137. <listitem>
  138. <para>A coverage testing tool; it is used to analyze programs to
  139. determine where optimizations will have the most effect</para>
  140. <indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
  141. </listitem>
  142. </varlistentry>
  143. <varlistentry id="libgcc">
  144. <term><filename class="libraryfile">libgcc</filename></term>
  145. <listitem>
  146. <para>Contains run-time support for <command>gcc</command></para>
  147. <indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
  148. </listitem>
  149. </varlistentry>
  150. <varlistentry id="libstdc">
  151. <term><filename class="libraryfile">libstdc++</filename></term>
  152. <listitem>
  153. <para>The standard C++ library</para>
  154. <indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
  155. </listitem>
  156. </varlistentry>
  157. <varlistentry id="libsupc">
  158. <term><filename class="libraryfile">libsupc++</filename></term>
  159. <listitem>
  160. <para>Provides supporting routines for the C++ programming language</para>
  161. <indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
  162. </listitem>
  163. </varlistentry>
  164. </variablelist>
  165. </sect2>
  166. </sect1>