1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3CR2//EN" "http://www.docbook.org/xml/4.3CR2/docbookx.dtd" [
3 <!ENTITY % gcc-2953-entities SYSTEM "../ent/gcc-2953.ent">
6 <sect1 id="ch06-gcc-2953">
7 <title>Installing GCC-&gcc-2953-version;</title>
8 <?dbhtml filename="gcc-2953.html"?>
10 <screen>Estimated build time: 1.5 SBU
11 Estimated required disk space: 130 MB</screen>
16 <title>Installation of GCC</title>
18 <para>This package is known to behave badly when you have changed its
19 default optimization flags (including the -march and -mcpu options).
20 Therefore, if you have defined any environment variables that override
21 default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting
22 or modifying them when building GCC.</para>
24 <para>This is an older release of GCC which we are going to install for the
25 purpose of compiling the Linux kernel in <xref linkend="chapter08"/>. This
26 version is recommended
27 by the kernel developers when you need absolute stability. Later versions of
28 GCC have not received as much testing for Linux kernel compilation. Using a
29 later version is likely to work, however, we recommend adhering to the kernel
30 developer's advice and using the version here to compile your kernel.</para>
32 <note><para>We don't install the C++ compiler or libraries here. However, there
33 may be reasons why you would want to install them. More information can be found
34 at <ulink url="http://www.linuxfromscratch.org/blfs/view/stable/general/gcc2.html"/>.</para></note>
36 <para>We'll install this older release of GCC into the non-standard prefix of
37 <filename class="directory">/opt</filename> so as to avoid interfering with
38 the system GCC already installed in <filename class="directory">/usr</filename>
41 <para>Apply the patches and make a small adjustment:</para>
43 <screen><userinput>patch -Np1 -i ../gcc-&gcc-2953-version;-2.patch
44 patch -Np1 -i ../gcc-&gcc-2953-version;-no-fixinc.patch
45 patch -Np1 -i ../gcc-&gcc-2953-version;-returntype-fix.patch
46 echo timestamp > gcc/cstamp-h.in</userinput></screen>
48 <para>The GCC documentation recommends building GCC outside of the source
49 directory in a dedicated build directory:</para>
51 <screen><userinput>mkdir ../gcc-2-build
52 cd ../gcc-2-build</userinput></screen>
54 <para>Compile and install the compiler:</para>
56 <screen><userinput>../gcc-&gcc-2953-version;/configure --prefix=/opt/gcc-&gcc-2953-version; \
57 --enable-shared --enable-languages=c \
58 --enable-threads=posix
60 make install</userinput></screen>