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;
|
---|
6 | Estimated required disk space: &gcc-compsize;</screen>
|
---|
7 |
|
---|
8 | &aa-gcc-shortdesc;
|
---|
9 | &aa-gcc-dep;
|
---|
10 |
|
---|
11 | <sect2><title> </title><para> </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
|
---|
18 | circumstance.</para></note>
|
---|
19 |
|
---|
20 | <para>This package is known to behave badly when you have changed its
|
---|
21 | default optimization flags (including the -march and -mcpu options).
|
---|
22 | Therefore, if you have defined any environment variables that override
|
---|
23 | default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting
|
---|
24 | or 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
|
---|
27 | to unpack the GCC-core <emphasis>and</emphasis> the GCC-g++ tarball -- they
|
---|
28 | will unfold into the same directory. You should likewise extract the
|
---|
29 | GCC-testsuite package. The full GCC package contains even more
|
---|
30 | compilers. 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;
|
---|
34 | patch -Np1 -i ../&gcc-suppress-libiberty-patch;</userinput></screen>
|
---|
35 |
|
---|
36 | <para>The second patch here suppresses the installation of libiberty from GCC,
|
---|
37 | as we will use the one provided by binutils instead. Be careful
|
---|
38 | <emphasis>not</emphasis> to apply the GCC specs patch from Chapter 5
|
---|
39 | here.</para>
|
---|
40 |
|
---|
41 | <para>The GCC documentation recommends building GCC outside of the source
|
---|
42 | directory in a dedicated build directory:</para>
|
---|
43 |
|
---|
44 | <screen><userinput>mkdir ../gcc-build
|
---|
45 | cd ../gcc-build</userinput></screen>
|
---|
46 |
|
---|
47 | <para>Now prepare GCC for compilation:</para>
|
---|
48 |
|
---|
49 | <screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
50 | --enable-shared --enable-threads=posix \
|
---|
51 | --enable-__cxa_atexit --enable-clocale=gnu \
|
---|
52 | --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
|
---|
59 | known 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
|
---|
64 | much appropriate here. Be sure to refer back there should you have any
|
---|
65 | doubts.</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.
|
---|
73 | To 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
|
---|
78 | compiler. 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
|
---|
83 | we performed earlier in this chapter. Refer back to
|
---|
84 | <xref linkend="ch06-adjustingtoolchain"/> and repeat the check. If the results
|
---|
85 | are wrong, then most likely you erroneously applied the GCC Specs patch from
|
---|
86 | Chapter 5.</para></note>
|
---|
87 |
|
---|
88 | </sect2>
|
---|
89 |
|
---|
90 | </sect1>
|
---|
91 |
|
---|