2004-05-03 11:59:46 +01:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2007-03-21 18:42:58 +00:00
|
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
2004-05-03 11:59:46 +01:00
|
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
]>
|
2006-01-20 21:02:23 +00:00
|
|
|
|
2004-05-16 01:06:08 +01:00
|
|
|
<sect1 id="ch-tools-gcc-pass2" role="wrap">
|
2006-01-20 21:02:23 +00:00
|
|
|
<?dbhtml filename="gcc-pass2.html"?>
|
|
|
|
|
2007-09-07 20:16:43 +01:00
|
|
|
<sect1info condition="script">
|
2019-04-10 21:20:22 +01:00
|
|
|
<productname>gcc-pass2</productname>
|
2007-09-07 20:16:43 +01:00
|
|
|
<productnumber>&gcc-version;</productnumber>
|
|
|
|
<address>&gcc-url;</address>
|
|
|
|
</sect1info>
|
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<title>GCC-&gcc-version; - Pass 2</title>
|
|
|
|
|
|
|
|
<indexterm zone="ch-tools-gcc-pass2">
|
|
|
|
<primary sortas="a-GCC">GCC</primary>
|
|
|
|
<secondary>tools, pass 2</secondary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<sect2 role="package">
|
|
|
|
<title/>
|
2003-05-02 19:20:20 +01:00
|
|
|
|
2010-04-21 21:16:28 +01:00
|
|
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
2006-01-20 21:02:23 +00:00
|
|
|
href="../chapter06/gcc.xml"
|
|
|
|
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<segmentedlist>
|
|
|
|
<segtitle>&buildtime;</segtitle>
|
|
|
|
<segtitle>&diskspace;</segtitle>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<seglistitem>
|
2006-05-14 21:16:56 +01:00
|
|
|
<seg>&gcc-ch5p2-sbu;</seg>
|
|
|
|
<seg>&gcc-ch5p2-du;</seg>
|
2006-01-20 21:02:23 +00:00
|
|
|
</seglistitem>
|
|
|
|
</segmentedlist>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
</sect2>
|
2004-05-16 01:06:08 +01:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<sect2 role="installation">
|
2008-12-05 20:46:02 +00:00
|
|
|
<title>Installation of GCC</title>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2020-03-18 08:24:08 +00:00
|
|
|
<para>As in the first build of GCC, the GMP, MPFR, and MPC packages are
|
|
|
|
required. Unpack the tarballs and move them into the required directory
|
|
|
|
names:</para>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2020-03-18 08:24:08 +00:00
|
|
|
<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
|
|
|
|
mv -v mpfr-&mpfr-version; mpfr
|
|
|
|
tar -xf ../gmp-&gmp-version;.tar.xz
|
|
|
|
mv -v gmp-&gmp-version; gmp
|
|
|
|
tar -xf ../mpc-&mpc-version;.tar.gz
|
|
|
|
mv -v mpc-&mpc-version; mpc</userinput></screen>
|
2005-09-09 21:34:44 +01:00
|
|
|
|
2016-12-17 06:46:18 +00:00
|
|
|
<para>If building on x86_64, change the default directory name for 64-bit
|
|
|
|
libraries to <quote>lib</quote>:</para>
|
|
|
|
|
|
|
|
<screen><userinput remap="pre">case $(uname -m) in
|
|
|
|
x86_64)
|
|
|
|
sed -e '/m64=/s/lib64/lib/' \
|
|
|
|
-i.orig gcc/config/i386/t-linux64
|
|
|
|
;;
|
|
|
|
esac</userinput></screen>
|
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>Create a separate build directory again:</para>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2016-01-27 21:49:38 +00:00
|
|
|
<screen><userinput remap="pre">mkdir -v build
|
|
|
|
cd build</userinput></screen>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<para>Create a symlink that allos libgcc to be built with posix threads
|
|
|
|
support:</para>
|
|
|
|
|
|
|
|
<screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
|
|
|
|
ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></screen>
|
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>Before starting to build GCC, remember to unset any environment
|
|
|
|
variables that override the default optimization flags.</para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>Now prepare GCC for compilation:</para>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<screen><userinput remap="configure">../configure \
|
|
|
|
--build=$(../config.guess) \
|
|
|
|
--host=$LFS_TGT \
|
|
|
|
--prefix=/usr \
|
|
|
|
CC_FOR_TARGET=$LFS_TGT-gcc \
|
|
|
|
--with-build-sysroot=$LFS \
|
|
|
|
--enable-initfini-array \
|
|
|
|
--disable-nls \
|
2015-04-20 12:20:56 +01:00
|
|
|
--disable-multilib \
|
2020-05-03 22:02:51 +01:00
|
|
|
--disable-decimal-float \
|
|
|
|
--disable-libatomic \
|
|
|
|
--disable-libgomp \
|
|
|
|
--disable-libquadmath \
|
|
|
|
--disable-libssp \
|
|
|
|
--disable-libvtv \
|
|
|
|
--disable-libstdcxx \
|
|
|
|
--enable-languages=c,c++</userinput></screen>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<variablelist>
|
2020-05-03 22:02:51 +01:00
|
|
|
<title>The meaning of the new configure options:</title><!-- WIP -->
|
2006-01-20 21:02:23 +00:00
|
|
|
|
|
|
|
<varlistentry>
|
2020-05-03 22:02:51 +01:00
|
|
|
<term><parameter>-with-build-sysroot=$LFS</parameter></term>
|
2006-01-20 21:02:23 +00:00
|
|
|
<listitem>
|
2020-05-03 22:02:51 +01:00
|
|
|
<para>Normally, using <parameter>--host=</parameter> ensures that
|
|
|
|
a cross-compiler is used for building gcc, and that compiler knows
|
|
|
|
that it has to look for headers and libraries in <filename
|
|
|
|
class="directory">$LFS</filename>. But the build system of GCC uses
|
|
|
|
other tools, which are not aware of this location. This switch is
|
|
|
|
needed to have them find the needed files in <filename
|
|
|
|
class="directory">$LFS</filename>, and not on the host.</para>
|
2006-01-20 21:02:23 +00:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2007-09-15 21:45:13 +01:00
|
|
|
<varlistentry>
|
2020-05-03 22:02:51 +01:00
|
|
|
<term><parameter>--enable-initfini-array</parameter></term>
|
2007-09-15 21:45:13 +01:00
|
|
|
<listitem>
|
2020-05-03 22:02:51 +01:00
|
|
|
<para>This option is automatically enabled when building a native
|
|
|
|
compiler with a native compiler on x86. But here, we build with
|
|
|
|
a cross compiler, so we need to explicitely set this option.</para>
|
2007-09-15 21:45:13 +01:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
<para>Compile the package:</para>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2010-09-06 20:01:49 +01:00
|
|
|
<screen><userinput remap="make">make</userinput></screen>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>Install the package:</para>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2008-12-05 20:46:02 +00:00
|
|
|
<para>As a finishing touch, create a symlink. Many programs and scripts
|
|
|
|
run <command>cc</command> instead of <command>gcc</command>, which is
|
|
|
|
used to keep programs generic and therefore usable on all kinds of UNIX
|
|
|
|
systems where the GNU C compiler is not always installed. Running
|
|
|
|
<command>cc</command> leaves the system administrator free to decide
|
|
|
|
which C compiler to install:</para>
|
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<screen><userinput remap="install">ln -sv gcc $LFS/usr/bin/cc</userinput></screen>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
</sect2>
|
2003-05-02 19:20:20 +01:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<sect2 role="content">
|
|
|
|
<title/>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>Details on this package are located in
|
|
|
|
<xref linkend="contents-gcc" role="."/></para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
</sect2>
|
|
|
|
|
|
|
|
</sect1>
|