aboutsummaryrefslogtreecommitdiffstats
path: root/chapter05/gcc-pass1.xml
diff options
context:
space:
mode:
Diffstat (limited to 'chapter05/gcc-pass1.xml')
-rw-r--r--chapter05/gcc-pass1.xml90
1 files changed, 89 insertions, 1 deletions
diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml
index 42325708f..58cfb6c56 100644
--- a/chapter05/gcc-pass1.xml
+++ b/chapter05/gcc-pass1.xml
@@ -7,7 +7,95 @@ Estimated required disk space: &gcc-compsize-tools-pass1;</screen>
&aa-gcc-shortdesc;
&aa-gcc-dep;
-&c5-gcc-pass1-inst;
+
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of GCC</title>
+
+<para>Unpack only the GCC-core tarball, as we won't be needing a C++ compiler
+for the moment.</para>
+
+<note><para>Even though GCC is an important toolchain package, we are not
+going to run the test suite at this early stage. First, the test suite framework
+is not yet in place and second, the programs from this first pass will soon be
+overwritten by those installed in the second pass.</para></note>
+
+<para>This package is known to behave badly when you have changed its
+default optimization flags (including the -march and -mcpu options).
+Therefore, if you have defined any environment variables that override
+default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting
+or modifying them when building GCC.</para>
+
+<para>The GCC documentation recommends building GCC outside of the source
+directory in a dedicated build directory:</para>
+
+<screen><userinput>mkdir ../gcc-build
+cd ../gcc-build</userinput></screen>
+
+<para>Prepare GCC to be compiled:</para>
+
+<screen><userinput>../gcc-&gcc-version;/configure --prefix=/tools \
+&nbsp;&nbsp;&nbsp;&nbsp;--with-local-prefix=/tools \
+&nbsp;&nbsp;&nbsp;&nbsp;--disable-nls --enable-shared \
+&nbsp;&nbsp;&nbsp;&nbsp;--enable-languages=c</userinput></screen>
+
+<para>The meaning of the configure options:</para>
+
+<itemizedlist>
+<listitem><para><userinput>--with-local-prefix=/tools</userinput>: The
+purpose of this switch is to remove <filename>/usr/local/include</filename>
+from <userinput>gcc</userinput>'s include search path. This is not absolutely
+essential; however, we want to try to minimize the influence of the host
+system, thus making this a sensible thing to do.</para></listitem>
+
+<listitem><para><userinput>--enable-shared</userinput>: This switch may
+seem counter-intuitive at first. But using it allows the building of
+<filename>libgcc_s.so.1</filename> and <filename>libgcc_eh.a</filename>, and
+having <filename>libgcc_eh.a</filename> available ensures that the configure
+script for Glibc (the next package we compile) produces the proper results.
+Note that the <userinput>gcc</userinput> binaries will still be linked
+statically, as this is controlled by the <userinput>-static</userinput>
+value of BOOT_LDFLAGS further on.</para></listitem>
+
+<listitem><para><userinput>--enable-languages=c</userinput>: This option
+ensures that only the C compiler is built. The option is only needed when you
+have downloaded and unpacked the full GCC tarball.</para></listitem>
+</itemizedlist>
+
+<para>Continue with compiling the package:</para>
+
+<screen><userinput>make BOOT_LDFLAGS="-static" bootstrap</userinput></screen>
+
+<para>The meaning of the make parameters:</para>
+
+<itemizedlist>
+<listitem><para><userinput>BOOT_LDFLAGS="-static"</userinput>: This tells
+GCC to link its programs statically.</para></listitem>
+
+<listitem><para><userinput>bootstrap</userinput>: This target doesn't just
+compile GCC, but compiles it several times. It uses the programs compiled in
+a first round to compile itself a second time, and then again a third time.
+It then compares these second and third compiles to make sure it can
+reproduce itself flawlessly, which most probably means that it was
+compiled correctly.</para></listitem>
+</itemizedlist>
+
+<para>And install the package:</para>
+
+<screen><userinput>make install</userinput></screen>
+
+<para>As a finishing touch we'll create the <filename
+class="symlink">/tools/bin/cc</filename> symlink. Many programs and
+scripts run <userinput>cc</userinput> instead of <userinput>gcc</userinput>,
+a thing meant to keep programs generic and therefore usable on all kinds of
+Unix systems. Not everybody has the GNU C compiler installed. Simply running
+<userinput>cc</userinput> leaves the system administrator free to decide what
+C compiler to install, as long as there's a symlink pointing to it:</para>
+
+<screen><userinput>ln -sf gcc /tools/bin/cc</userinput></screen>
+
+</sect2>
</sect1>