source: chapter06/gcc.xml@ 5592479

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 12.2 12.2-rc1 6.0 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/loongarch-12.2 xry111/mips64el xry111/multilib xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 5592479 was 69a7501b, checked in by Zack Winkles <winkie@…>, 20 years ago

Point to the correct GCC patches

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

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