source: chapter06/gcc.xml@ 73aedd1d

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 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 v5_0 v5_1 v5_1_1 xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 73aedd1d was 73aedd1d, checked in by Alex Gronenwoud <alex@…>, 21 years ago

Merging caption and installation sections for all packages in chapters 5 and 6.

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

  • Property mode set to 100644
File size: 3.3 KB
Line 
1<sect1 id="ch06-gcc">
2<title>Installing GCC-&gcc-version;</title>
3<?dbhtml filename="gcc.html" dir="chapter06"?>
4
5<screen>Estimated build time: &gcc-time;
6Estimated required disk space: &gcc-compsize;</screen>
7
8&aa-gcc-shortdesc;
9&aa-gcc-dep;
10
11<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
12
13<sect2>
14<title>Installation of GCC</title>
15
16<note><para>The test suite for GCC in this section is considered
17<emphasis>critical</emphasis>. Our advice is to not skip it under any
18circumstance.</para></note>
19
20<para>This package is known to behave badly when you have changed its
21default optimization flags (including the -march and -mcpu options).
22Therefore, if you have defined any environment variables that override
23default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting
24or modifying them when building GCC.</para>
25
26<para>This time we will build both the C and the C++ compiler, so you'll have
27to unpack the GCC-core <emphasis>and</emphasis> the GCC-g++ tarball -- they
28will unfold into the same directory. You should likewise extract the
29GCC-testsuite package. The full GCC package contains even more
30compilers. Instructions for building these can be found at
31<ulink url="&blfs-root;view/stable/general/gcc.html"/>.</para>
32
33<screen><userinput>patch -Np1 -i ../&gcc-nofixincludes-patch;
34patch -Np1 -i ../&gcc-suppress-libiberty-patch;</userinput></screen>
35
36<para>The second patch here suppresses the installation of libiberty from GCC,
37as we will use the one provided by binutils instead. Be careful
38<emphasis>not</emphasis> to apply the GCC specs patch from Chapter 5
39here.</para>
40
41<para>The GCC documentation recommends building GCC outside of the source
42directory in a dedicated build directory:</para>
43
44<screen><userinput>mkdir ../gcc-build
45cd ../gcc-build</userinput></screen>
46
47<para>Now prepare GCC for compilation:</para>
48
49<screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
50&nbsp;&nbsp;&nbsp;&nbsp;--enable-shared --enable-threads=posix \
51&nbsp;&nbsp;&nbsp;&nbsp;--enable-__cxa_atexit --enable-clocale=gnu \
52&nbsp;&nbsp;&nbsp;&nbsp;--enable-languages=c,c++</userinput></screen>
53
54<para>Compile the package:</para>
55
56<screen><userinput>make</userinput></screen>
57
58<para>Test the results, but don't stop at errors (you'll remember the few
59known ones):</para>
60
61<screen><userinput>make -k check</userinput></screen>
62
63<para>The test suite notes from <xref linkend="ch05-gcc-pass2"/> are still very
64much appropriate here. Be sure to refer back there should you have any
65doubts.</para>
66
67<para>And install the package:</para>
68
69<screen><userinput>make install</userinput></screen>
70
71<para>Some packages expect the C PreProcessor to be installed in the
72<filename>/lib</filename> directory.
73To honor those packages, create this symlink:</para>
74
75<screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
76
77<para>Many packages use the name <userinput>cc</userinput> to call the C
78compiler. To satisfy those packages, create a symlink:</para>
79
80<screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
81
82<note><para>At this point it is strongly recommended to repeat the sanity check
83we performed earlier in this chapter. Refer back to
84<xref linkend="ch06-adjustingtoolchain"/> and repeat the check. If the results
85are wrong, then most likely you erroneously applied the GCC Specs patch from
86Chapter 5.</para></note>
87
88</sect2>
89
90</sect1>
91
Note: See TracBrowser for help on using the repository browser.