gcc.xml 7.5 KB

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