[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[b06ca36] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[673b0d8] | 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
[1f7ca93] | 7 |
|
---|
[9652249] | 8 | <sect1 id="ch-tools-gcc-pass2" role="wrap">
|
---|
[1f7ca93] | 9 | <?dbhtml filename="gcc-pass2.html"?>
|
---|
| 10 |
|
---|
[e747759] | 11 | <sect1info condition="script">
|
---|
[6070f51] | 12 | <productname>gcc-pass2</productname>
|
---|
[e747759] | 13 | <productnumber>&gcc-version;</productnumber>
|
---|
| 14 | <address>&gcc-url;</address>
|
---|
| 15 | </sect1info>
|
---|
| 16 |
|
---|
[1f7ca93] | 17 | <title>GCC-&gcc-version; - Pass 2</title>
|
---|
| 18 |
|
---|
| 19 | <indexterm zone="ch-tools-gcc-pass2">
|
---|
| 20 | <primary sortas="a-GCC">GCC</primary>
|
---|
| 21 | <secondary>tools, pass 2</secondary>
|
---|
| 22 | </indexterm>
|
---|
| 23 |
|
---|
| 24 | <sect2 role="package">
|
---|
| 25 | <title/>
|
---|
[bc82645e] | 26 |
|
---|
[d9441360] | 27 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
[1f7ca93] | 28 | href="../chapter06/gcc.xml"
|
---|
| 29 | xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
|
---|
[81fd230] | 30 |
|
---|
[1f7ca93] | 31 | <segmentedlist>
|
---|
| 32 | <segtitle>&buildtime;</segtitle>
|
---|
| 33 | <segtitle>&diskspace;</segtitle>
|
---|
[73aedd1d] | 34 |
|
---|
[1f7ca93] | 35 | <seglistitem>
|
---|
[e4a5635] | 36 | <seg>&gcc-ch5p2-sbu;</seg>
|
---|
| 37 | <seg>&gcc-ch5p2-du;</seg>
|
---|
[1f7ca93] | 38 | </seglistitem>
|
---|
| 39 | </segmentedlist>
|
---|
[73aedd1d] | 40 |
|
---|
[1f7ca93] | 41 | </sect2>
|
---|
[9652249] | 42 |
|
---|
[1f7ca93] | 43 | <sect2 role="installation">
|
---|
[4e82d47] | 44 | <title>Installation of GCC</title>
|
---|
[73aedd1d] | 45 |
|
---|
[50645c8] | 46 | <para>As in the first build of GCC, the GMP, MPFR, and MPC packages are
|
---|
| 47 | required. Unpack the tarballs and move them into the required directory
|
---|
| 48 | names:</para>
|
---|
[1a3e6a3] | 49 |
|
---|
[50645c8] | 50 | <screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
|
---|
| 51 | mv -v mpfr-&mpfr-version; mpfr
|
---|
| 52 | tar -xf ../gmp-&gmp-version;.tar.xz
|
---|
| 53 | mv -v gmp-&gmp-version; gmp
|
---|
| 54 | tar -xf ../mpc-&mpc-version;.tar.gz
|
---|
| 55 | mv -v mpc-&mpc-version; mpc</userinput></screen>
|
---|
[2e02c35] | 56 |
|
---|
[be3d9f3] | 57 | <para>If building on x86_64, change the default directory name for 64-bit
|
---|
| 58 | libraries to <quote>lib</quote>:</para>
|
---|
| 59 |
|
---|
| 60 | <screen><userinput remap="pre">case $(uname -m) in
|
---|
| 61 | x86_64)
|
---|
| 62 | sed -e '/m64=/s/lib64/lib/' \
|
---|
| 63 | -i.orig gcc/config/i386/t-linux64
|
---|
| 64 | ;;
|
---|
| 65 | esac</userinput></screen>
|
---|
| 66 |
|
---|
[f7ca699b] | 67 | <para>Fix an issue with GCC-10.1 when building with a cross
|
---|
| 68 | compiler:</para>
|
---|
| 69 |
|
---|
| 70 | <screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen>
|
---|
| 71 |
|
---|
[1f7ca93] | 72 | <para>Create a separate build directory again:</para>
|
---|
[73aedd1d] | 73 |
|
---|
[f1dd547] | 74 | <screen><userinput remap="pre">mkdir -v build
|
---|
| 75 | cd build</userinput></screen>
|
---|
[73aedd1d] | 76 |
|
---|
[efcb393] | 77 | <para>Create a symlink that allos libgcc to be built with posix threads
|
---|
| 78 | support:</para>
|
---|
| 79 |
|
---|
| 80 | <screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
|
---|
| 81 | ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></screen>
|
---|
| 82 |
|
---|
[1f7ca93] | 83 | <para>Before starting to build GCC, remember to unset any environment
|
---|
| 84 | variables that override the default optimization flags.</para>
|
---|
[81fd230] | 85 |
|
---|
[1f7ca93] | 86 | <para>Now prepare GCC for compilation:</para>
|
---|
[73aedd1d] | 87 |
|
---|
[efcb393] | 88 | <screen><userinput remap="configure">../configure \
|
---|
| 89 | --build=$(../config.guess) \
|
---|
| 90 | --host=$LFS_TGT \
|
---|
| 91 | --prefix=/usr \
|
---|
| 92 | CC_FOR_TARGET=$LFS_TGT-gcc \
|
---|
| 93 | --with-build-sysroot=$LFS \
|
---|
| 94 | --enable-initfini-array \
|
---|
| 95 | --disable-nls \
|
---|
[d0da965a] | 96 | --disable-multilib \
|
---|
[efcb393] | 97 | --disable-decimal-float \
|
---|
| 98 | --disable-libatomic \
|
---|
| 99 | --disable-libgomp \
|
---|
| 100 | --disable-libquadmath \
|
---|
| 101 | --disable-libssp \
|
---|
| 102 | --disable-libvtv \
|
---|
| 103 | --disable-libstdcxx \
|
---|
| 104 | --enable-languages=c,c++</userinput></screen>
|
---|
[73aedd1d] | 105 |
|
---|
[1f7ca93] | 106 | <variablelist>
|
---|
[efcb393] | 107 | <title>The meaning of the new configure options:</title><!-- WIP -->
|
---|
[1f7ca93] | 108 |
|
---|
| 109 | <varlistentry>
|
---|
[efcb393] | 110 | <term><parameter>-with-build-sysroot=$LFS</parameter></term>
|
---|
[1f7ca93] | 111 | <listitem>
|
---|
[efcb393] | 112 | <para>Normally, using <parameter>--host=</parameter> ensures that
|
---|
| 113 | a cross-compiler is used for building gcc, and that compiler knows
|
---|
| 114 | that it has to look for headers and libraries in <filename
|
---|
| 115 | class="directory">$LFS</filename>. But the build system of GCC uses
|
---|
| 116 | other tools, which are not aware of this location. This switch is
|
---|
| 117 | needed to have them find the needed files in <filename
|
---|
| 118 | class="directory">$LFS</filename>, and not on the host.</para>
|
---|
[1f7ca93] | 119 | </listitem>
|
---|
| 120 | </varlistentry>
|
---|
| 121 |
|
---|
[b0a4c9a] | 122 | <varlistentry>
|
---|
[efcb393] | 123 | <term><parameter>--enable-initfini-array</parameter></term>
|
---|
[b0a4c9a] | 124 | <listitem>
|
---|
[efcb393] | 125 | <para>This option is automatically enabled when building a native
|
---|
| 126 | compiler with a native compiler on x86. But here, we build with
|
---|
| 127 | a cross compiler, so we need to explicitely set this option.</para>
|
---|
[b0a4c9a] | 128 | </listitem>
|
---|
| 129 | </varlistentry>
|
---|
| 130 |
|
---|
[1f7ca93] | 131 | </variablelist>
|
---|
| 132 |
|
---|
| 133 | <para>Compile the package:</para>
|
---|
[73aedd1d] | 134 |
|
---|
[bd7123b] | 135 | <screen><userinput remap="make">make</userinput></screen>
|
---|
[73aedd1d] | 136 |
|
---|
[1f7ca93] | 137 | <para>Install the package:</para>
|
---|
[73aedd1d] | 138 |
|
---|
[efcb393] | 139 | <screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
|
---|
[73aedd1d] | 140 |
|
---|
[4e82d47] | 141 | <para>As a finishing touch, create a symlink. Many programs and scripts
|
---|
| 142 | run <command>cc</command> instead of <command>gcc</command>, which is
|
---|
| 143 | used to keep programs generic and therefore usable on all kinds of UNIX
|
---|
| 144 | systems where the GNU C compiler is not always installed. Running
|
---|
| 145 | <command>cc</command> leaves the system administrator free to decide
|
---|
| 146 | which C compiler to install:</para>
|
---|
| 147 |
|
---|
[efcb393] | 148 | <screen><userinput remap="install">ln -sv gcc $LFS/usr/bin/cc</userinput></screen>
|
---|
[73aedd1d] | 149 |
|
---|
[1f7ca93] | 150 | </sect2>
|
---|
[bc82645e] | 151 |
|
---|
[1f7ca93] | 152 | <sect2 role="content">
|
---|
| 153 | <title/>
|
---|
[81fd230] | 154 |
|
---|
[1f7ca93] | 155 | <para>Details on this package are located in
|
---|
| 156 | <xref linkend="contents-gcc" role="."/></para>
|
---|
[81fd230] | 157 |
|
---|
[1f7ca93] | 158 | </sect2>
|
---|
| 159 |
|
---|
| 160 | </sect1>
|
---|