source: chapter06/gcc.xml@ 0c81bec

Last change on this file since 0c81bec was 6a0e6f3, checked in by Matthew Burgess <matthew@…>, 20 years ago
  • Remove the spurious <info> tags that I thought were necessary but evidently aren't

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/LFS-RNG/BOOK@4387 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 7.3 KB
RevLine 
[673b0d8]1<?xml version="1.0" encoding="ISO-8859-1"?>
[1fe35e1]2<!DOCTYPE section [
[673b0d8]3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
[1fe35e1]6<section xmlns="http://docbook.org/docbook-ng"
7 xmlns:xlink="http://www.w3.org/1999/xlink"
8 xml:id="ch-system-gcc" xreflabel="GCC" role="wrap">
[6a0e6f3]9<title>GCC-&gcc-version;</title>
[673b0d8]10<?dbhtml filename="gcc.html"?>
[6370fa6]11
[673b0d8]12<indexterm zone="ch-system-gcc"><primary sortas="a-GCC">GCC</primary></indexterm>
13
[6a0e6f3]14<section role="package"><title/>
[673b0d8]15<para>The GCC package contains the GNU compiler collection, which includes
[5888299]16the C and C++ compilers.</para>
17
[a001133]18<segmentedlist>
19<segtitle>&buildtime;</segtitle>
20<segtitle>&diskspace;</segtitle>
21<seglistitem><seg>11.7 SBU</seg><seg>294 MB</seg></seglistitem>
22</segmentedlist>
[3554fa3a]23
[a001133]24<segmentedlist>
25<segtitle>GCC installation depends on</segtitle>
26<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, Findutils,
27Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, Texinfo</seg></seglistitem>
28</segmentedlist>
[1fe35e1]29</section>
[5888299]30
[1fe35e1]31<section role="installation">
[6a0e6f3]32<title>Installation of GCC</title>
[73aedd1d]33
34<para>This package is known to behave badly when you have changed its
[bb55064]35default optimization flags (including the <parameter>-march</parameter> and <parameter>-mcpu</parameter> options).
[73aedd1d]36Therefore, if you have defined any environment variables that override
[673b0d8]37default optimizations, such as CFLAGS and CXXFLAGS, we recommend un-setting
[73aedd1d]38or modifying them when building GCC.</para>
39
[37dcf2a]40<para>Unpack the GCC-core <emphasis>and</emphasis> the GCC-g++ tarball -- they
[73aedd1d]41will unfold into the same directory. You should likewise extract the
42GCC-testsuite package. The full GCC package contains even more
43compilers. Instructions for building these can be found at
[1fe35e1]44<uri xlink:href="&blfs-root;view/stable/general/gcc.html"/>.</para>
[73aedd1d]45
[4248b0e]46<para>First apply only the No-Fixincludes patch (and <emphasis>not</emphasis>
47the Specs patch) also used in the previous chapter:</para>
[37dcf2a]48
[e075967]49<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-1.patch</userinput></screen>
[041cbb60]50
51<para>GCC fails to compile some packages outside of a base Linux From Scratch
52install (e.g., Mozilla and kdegraphics) when used in conjunction with newer
53versions of binutils. Apply the following patch to fix this issue:</para>
54
55<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-linkonce-1.patch</userinput></screen>
[37dcf2a]56
57<para>Now apply a sed substitution that will suppress the installation of
[bb55064]58<filename class="libraryfile">libiberty.a</filename>. We want to use the version of
59<filename class="libraryfile">libiberty.a</filename> provided by Binutils:</para>
[37dcf2a]60
61<screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
[73aedd1d]62
63<para>The GCC documentation recommends building GCC outside of the source
64directory in a dedicated build directory:</para>
65
66<screen><userinput>mkdir ../gcc-build
67cd ../gcc-build</userinput></screen>
68
69<para>Now prepare GCC for compilation:</para>
70
[673b0d8]71<screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
[9dfc02f]72 --libexecdir=/usr/lib --enable-shared --enable-threads=posix \
[17fadf7]73 --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
[73aedd1d]74
75<para>Compile the package:</para>
76
77<screen><userinput>make</userinput></screen>
78
[90afe40d]79<important><para>The test suite for GCC in this section is considered
80<emphasis>critical</emphasis>. Our advice is to not skip it under any
81circumstance.</para></important>
82
[73aedd1d]83<para>Test the results, but don't stop at errors (you'll remember the few
84known ones):</para>
85
86<screen><userinput>make -k check</userinput></screen>
87
[3be4d97]88<para>The test suite notes from <xref linkend="ch-tools-gcc-pass2"/> are still very
[73aedd1d]89much appropriate here. Be sure to refer back there should you have any
90doubts.</para>
91
[673b0d8]92<para>Now install the package:</para>
[73aedd1d]93
94<screen><userinput>make install</userinput></screen>
95
96<para>Some packages expect the C PreProcessor to be installed in the
[bb55064]97<filename class="directory">/lib</filename> directory.
[673b0d8]98To support those packages, create this symlink:</para>
[73aedd1d]99
100<screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
101
[90e3cb3]102<para>Many packages use the name <command>cc</command> to call the C
[73aedd1d]103compiler. To satisfy those packages, create a symlink:</para>
104
105<screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
106
107<note><para>At this point it is strongly recommended to repeat the sanity check
108we performed earlier in this chapter. Refer back to
[a0b689e]109<xref linkend="ch-system-readjusting"/> and repeat the check. If the results
[73aedd1d]110are wrong, then most likely you erroneously applied the GCC Specs patch from
[dcff046]111<xref linkend="chapter-temporary-tools"/>.</para></note>
[73aedd1d]112
[1fe35e1]113</section>
[6370fa6]114
[5888299]115
[6a0e6f3]116<section xml:id="contents-gcc" role="content"><title>Contents of GCC</title>
[673b0d8]117
[c6cb3aa]118<segmentedlist>
119<segtitle>Installed programs</segtitle>
120<segtitle>Installed libraries</segtitle>
121<seglistitem><seg>c++, cc (link to gcc),
122cc1, cc1plus, collect2, cpp, g++, gcc, gccbug, and gcov</seg>
123<seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so] and libsupc++.a</seg></seglistitem>
124</segmentedlist>
[673b0d8]125
[c6cb3aa]126<variablelist><title>Short descriptions</title>
[673b0d8]127
[1fe35e1]128<varlistentry xml:id="cpp">
[b8a819f]129<term><command>cpp</command></term>
[c6cb3aa]130<listitem>
[673b0d8]131<indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
[c6cb3aa]132<para>is the C preprocessor. It is used by the compiler to have the #include and
133#define and such statements expanded in the source files.</para>
134</listitem>
135</varlistentry>
136
[1fe35e1]137<varlistentry xml:id="g">
[b8a819f]138<term><command>g++</command></term>
[c6cb3aa]139<listitem>
[673b0d8]140<indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
[c6cb3aa]141<para>is the C++ compiler.</para>
142</listitem>
143</varlistentry>
[673b0d8]144
[1fe35e1]145<varlistentry xml:id="gcc">
[b8a819f]146<term><command>gcc</command></term>
[c6cb3aa]147<listitem>
[673b0d8]148<indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
[c6cb3aa]149<para>is the C compiler. It is used to translate
[673b0d8]150the source code of a program into assembly code.</para>
[c6cb3aa]151</listitem>
152</varlistentry>
[6370fa6]153
[1fe35e1]154<varlistentry xml:id="gccbug">
[b8a819f]155<term><command>gccbug</command></term>
[c6cb3aa]156<listitem>
[673b0d8]157<indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
[c6cb3aa]158<para>is a shell script used to help create good bug reports.</para>
159</listitem>
160</varlistentry>
[673b0d8]161
[1fe35e1]162<varlistentry xml:id="gcov">
[b8a819f]163<term><command>gcov</command></term>
[c6cb3aa]164<listitem>
[673b0d8]165<indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
[c6cb3aa]166<para>is a coverage testing tool. It is used to
[673b0d8]167analyze programs to find out where optimizations will have the most effect.</para>
[c6cb3aa]168</listitem>
169</varlistentry>
[673b0d8]170
[1fe35e1]171<varlistentry xml:id="libgcc">
[bb55064]172<term><filename class="libraryfile">libgcc*</filename></term>
[c6cb3aa]173<listitem>
[673b0d8]174<indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
[bb55064]175<para>contains run-time support for <command>gcc</command>.</para>
[c6cb3aa]176</listitem>
177</varlistentry>
[673b0d8]178
[1fe35e1]179<varlistentry xml:id="libstdc">
[bb55064]180<term><filename class="libraryfile">libstdc++</filename></term>
[c6cb3aa]181<listitem>
[673b0d8]182<indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
[c6cb3aa]183<para>is the standard C++ library. It contains many frequently-used functions.</para>
184</listitem>
185</varlistentry>
[673b0d8]186
[1fe35e1]187<varlistentry xml:id="libsupc">
[bb55064]188<term><filename class="libraryfile">libsupc++</filename></term>
[c6cb3aa]189<listitem>
[673b0d8]190<indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
[c6cb3aa]191<para>provides supporting routines for the c++ programming language.</para>
192</listitem>
193</varlistentry>
194</variablelist>
[673b0d8]195
[1fe35e1]196</section>
[673b0d8]197
[1fe35e1]198</section>
Note: See TracBrowser for help on using the repository browser.