source: chapter06/gcc.xml@ 332ba21

6.0
Last change on this file since 332ba21 was 752f4e5, checked in by Manuel Canales Esparcia <manuel@…>, 20 years ago

Tags corrections, Chapter 6.

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

  • Property mode set to 100644
File size: 7.1 KB
RevLine 
[673b0d8]1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
[752f4e5]6<sect1 id="ch-system-gcc" role="wrap">
[673b0d8]7<title>GCC-&gcc-version;</title>
8<?dbhtml filename="gcc.html"?>
[6370fa6]9
[673b0d8]10<indexterm zone="ch-system-gcc"><primary sortas="a-GCC">GCC</primary></indexterm>
11
[a001133]12<sect2 role="package"><title/>
[673b0d8]13<para>The GCC package contains the GNU compiler collection, which includes
[5888299]14the C and C++ compilers.</para>
15
[a001133]16<segmentedlist>
17<segtitle>&buildtime;</segtitle>
18<segtitle>&diskspace;</segtitle>
19<seglistitem><seg>11.7 SBU</seg><seg>294 MB</seg></seglistitem>
20</segmentedlist>
[3554fa3a]21
[a001133]22<segmentedlist>
23<segtitle>GCC installation depends on</segtitle>
24<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, Findutils,
[69993f4]25Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo</seg></seglistitem>
[a001133]26</segmentedlist>
27</sect2>
[5888299]28
[a001133]29<sect2 role="installation">
[73aedd1d]30<title>Installation of GCC</title>
31
[ef13657]32<para>This package is known to have issues when its default
33optimization flags (including the <parameter>-march</parameter> and
34<parameter>-mcpu</parameter> options) are changed. If any environment
35variables that override default optimizations have been defined, such
[752f4e5]36as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
[24a08b9]37unset them when building GCC.</para>
[ef13657]38
[69993f4]39<para>Unpack both the gcc-core and the gcc-g++ tarballs&mdash;they will
[ef13657]40unpack into the same directory. Likewise, extract the gcc-testsuite
41package. The full GCC package contains additional compilers.
42Instructions for building these can be found at <ulink
43url="&blfs-root;view/stable/general/gcc.html"/>.</para>
44
45<para>Apply only the No-Fixincludes patch (not the Specs patch) also
46used in the previous chapter:</para>
[37dcf2a]47
[e075967]48<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-1.patch</userinput></screen>
[37dcf2a]49
[03084bc9]50<para>GCC fails to compile some packages outside of a base Linux From Scratch
51install (e.g., Mozilla and kdegraphics) when used in conjunction with newer
52versions of binutils. Apply the following patch to fix this issue:</para>
53
54<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-linkonce-1.patch</userinput></screen>
55
[ef13657]56<para>Apply a sed substitution that will suppress the installation of
57<filename class="libraryfile">libiberty.a</filename>. The version of
58<filename class="libraryfile">libiberty.a</filename> provided by
59Binutils will be used instead:</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 \
[00cc7ce]72 --libexecdir=/usr/lib --enable-shared \
73 --enable-threads=posix --enable-__cxa_atexit \
74 --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
[73aedd1d]75
76<para>Compile the package:</para>
77
78<screen><userinput>make</userinput></screen>
79
[69993f4]80<important><para>In this section, the test suite for GCC is considered
[ef13657]81critical. Do not skip it under any circumstance.</para></important>
[90afe40d]82
[69993f4]83<para>Test the results, but do not stop at errors:</para>
[73aedd1d]84
85<screen><userinput>make -k check</userinput></screen>
86
[ef13657]87<para>Some of the errors are known issues and were noted in the
88previous chapter. The test suite notes from <xref
[c17fc85]89linkend="ch-tools-gcc-pass2" role=","/> are still relevant here. Be sure to
[ef13657]90refer back to them as necessary.</para>
[73aedd1d]91
[69993f4]92<para>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
[69993f4]107<note><para>At this point, it is strongly recommended to repeat the
108sanity check performed earlier in this chapter. Refer back to <xref
[c17fc85]109linkend="ch-system-readjusting" role=","/> and repeat the check. If the results
[ef13657]110are in error, then the most likely reason is that the GCC Specs patch
111from <xref linkend="chapter-temporary-tools"/> was erroneously applied
112here.</para></note>
[73aedd1d]113
114</sect2>
[6370fa6]115
[5888299]116
[c6cb3aa]117<sect2 id="contents-gcc" role="content"><title>Contents of GCC</title>
[673b0d8]118
[c6cb3aa]119<segmentedlist>
120<segtitle>Installed programs</segtitle>
121<segtitle>Installed libraries</segtitle>
[dadb405]122<seglistitem><seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and
123gcov</seg>
[69993f4]124<seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.a</seg></seglistitem>
[c6cb3aa]125</segmentedlist>
[673b0d8]126
[3ed279f]127<variablelist><bridgehead renderas="sect3">Short descriptions</bridgehead>
128<?dbfo list-presentation="list"?>
[673b0d8]129
[b8a819f]130<varlistentry id="cpp">
131<term><command>cpp</command></term>
[c6cb3aa]132<listitem>
[ef13657]133<para>the C preprocessor. It is used by the compiler expand the
134#include, #define, and similar statements in the source files.</para>
[3ed279f]135<indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
[c6cb3aa]136</listitem>
137</varlistentry>
138
[b8a819f]139<varlistentry id="g">
140<term><command>g++</command></term>
[c6cb3aa]141<listitem>
[ef13657]142<para>the C++ compiler.</para>
[3ed279f]143<indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
[c6cb3aa]144</listitem>
145</varlistentry>
[673b0d8]146
[b8a819f]147<varlistentry id="gcc">
148<term><command>gcc</command></term>
[c6cb3aa]149<listitem>
[ef13657]150<para>the C compiler.</para>
[3ed279f]151<indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
[c6cb3aa]152</listitem>
153</varlistentry>
[6370fa6]154
[b8a819f]155<varlistentry id="gccbug">
156<term><command>gccbug</command></term>
[c6cb3aa]157<listitem>
[ef13657]158<para>a shell script used to help create useful bug reports.</para>
[3ed279f]159<indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
[c6cb3aa]160</listitem>
161</varlistentry>
[673b0d8]162
[b8a819f]163<varlistentry id="gcov">
164<term><command>gcov</command></term>
[c6cb3aa]165<listitem>
[ef13657]166<para>a coverage testing tool. It is used to analyze programs to
167determine where optimizations will have the most effect.</para>
[3ed279f]168<indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
[c6cb3aa]169</listitem>
170</varlistentry>
[673b0d8]171
[b8a819f]172<varlistentry id="libgcc">
[bb55064]173<term><filename class="libraryfile">libgcc*</filename></term>
[c6cb3aa]174<listitem>
[bb55064]175<para>contains run-time support for <command>gcc</command>.</para>
[3ed279f]176<indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
[c6cb3aa]177</listitem>
178</varlistentry>
[673b0d8]179
[b8a819f]180<varlistentry id="libstdc">
[bb55064]181<term><filename class="libraryfile">libstdc++</filename></term>
[c6cb3aa]182<listitem>
[ef13657]183<para>the standard C++ library.</para>
[3ed279f]184<indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
[c6cb3aa]185</listitem>
186</varlistentry>
[673b0d8]187
[b8a819f]188<varlistentry id="libsupc">
[bb55064]189<term><filename class="libraryfile">libsupc++</filename></term>
[c6cb3aa]190<listitem>
191<para>provides supporting routines for the c++ programming language.</para>
[3ed279f]192<indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
[c6cb3aa]193</listitem>
194</varlistentry>
195</variablelist>
[673b0d8]196
197</sect2>
198
199</sect1>
[ef13657]200
Note: See TracBrowser for help on using the repository browser.