123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <sect2><title> </title><para> </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>
- <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><screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-mmap_test.patch
- patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes.patch</userinput></screen></para>
- <para>It is recommended by the GCC installation documentation to build
- GCC outside of the source directory in a dedicated directory:</para>
- <para><screen><userinput>mkdir ../gcc-build
- cd ../gcc-build</userinput></screen></para>
- <para>Prepare GCC to be compiled:</para>
- <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/stage1 \
- --with-local-prefix=/stage1 \
- --disable-nls --enable-shared \
- --enable-languages=c</userinput></screen></para>
- <para>The meaning of the new configure options is:</para>
- <itemizedlist>
- <listitem><para><userinput>--with-local-prefix=/stage1</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, but we want to try and minimize the influence from the host system,
- so this seems a logical 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>
- <para><screen><userinput>make BOOT_LDFLAGS="-static" bootstrap</userinput></screen></para>
- <para>The meaning of the make parameters is:</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>
- <para><screen><userinput>make install</userinput></screen></para>
- <para>As a finishing touch we'll create the <filename
- class="symlink">/stage1/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>
- <para><screen><userinput>ln -sf gcc /stage1/bin/cc</userinput></screen></para>
- </sect2>
|