[fcc02767] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[9d06e69] | 8 | <sect1 id="ch-tools-gcc-pass2" role="wrap" xreflabel="gcc-pass2">
|
---|
[fcc02767] | 9 | <?dbhtml filename="gcc-pass2.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info condition="script">
|
---|
| 12 | <productname>gcc-pass2</productname>
|
---|
| 13 | <productnumber>&gcc-version;</productnumber>
|
---|
| 14 | <address>&gcc-url;</address>
|
---|
| 15 | </sect1info>
|
---|
| 16 |
|
---|
| 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/>
|
---|
| 26 |
|
---|
| 27 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
| 28 | href="../chapter08/gcc.xml"
|
---|
| 29 | xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
|
---|
| 30 |
|
---|
| 31 | <segmentedlist>
|
---|
| 32 | <segtitle>&buildtime;</segtitle>
|
---|
| 33 | <segtitle>&diskspace;</segtitle>
|
---|
| 34 |
|
---|
| 35 | <seglistitem>
|
---|
[fb386e0] | 36 | <seg>&gcc-tmpp2-sbu;</seg>
|
---|
| 37 | <seg>&gcc-tmpp2-du;</seg>
|
---|
[fcc02767] | 38 | </seglistitem>
|
---|
| 39 | </segmentedlist>
|
---|
| 40 |
|
---|
| 41 | </sect2>
|
---|
| 42 |
|
---|
| 43 | <sect2 role="installation">
|
---|
| 44 | <title>Installation of GCC</title>
|
---|
| 45 |
|
---|
| 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>
|
---|
| 49 |
|
---|
| 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>
|
---|
| 56 |
|
---|
| 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)
|
---|
[bc8cca5] | 62 | sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
|
---|
[fcc02767] | 63 | ;;
|
---|
| 64 | esac</userinput></screen>
|
---|
[ba82c18] | 65 | <!--
|
---|
[fcc02767] | 66 | <para>Fix an issue with GCC-10.1 when building with a cross
|
---|
| 67 | compiler:</para>
|
---|
| 68 |
|
---|
| 69 | <screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen>
|
---|
[ba82c18] | 70 | -->
|
---|
[fcc02767] | 71 | <para>Create a separate build directory again:</para>
|
---|
| 72 |
|
---|
| 73 | <screen><userinput remap="pre">mkdir -v build
|
---|
| 74 | cd build</userinput></screen>
|
---|
| 75 |
|
---|
[bc8cca5] | 76 | <para>Create a symlink that allows libgcc to be built with posix threads
|
---|
[fcc02767] | 77 | support:</para>
|
---|
| 78 |
|
---|
| 79 | <screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
|
---|
| 80 | ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></screen>
|
---|
| 81 |
|
---|
| 82 | <para>Before starting to build GCC, remember to unset any environment
|
---|
| 83 | variables that override the default optimization flags.</para>
|
---|
| 84 |
|
---|
| 85 | <para>Now prepare GCC for compilation:</para>
|
---|
| 86 |
|
---|
| 87 | <screen><userinput remap="configure">../configure \
|
---|
| 88 | --build=$(../config.guess) \
|
---|
| 89 | --host=$LFS_TGT \
|
---|
| 90 | --prefix=/usr \
|
---|
| 91 | CC_FOR_TARGET=$LFS_TGT-gcc \
|
---|
| 92 | --with-build-sysroot=$LFS \
|
---|
| 93 | --enable-initfini-array \
|
---|
| 94 | --disable-nls \
|
---|
| 95 | --disable-multilib \
|
---|
| 96 | --disable-decimal-float \
|
---|
| 97 | --disable-libatomic \
|
---|
| 98 | --disable-libgomp \
|
---|
| 99 | --disable-libquadmath \
|
---|
| 100 | --disable-libssp \
|
---|
| 101 | --disable-libvtv \
|
---|
| 102 | --disable-libstdcxx \
|
---|
| 103 | --enable-languages=c,c++</userinput></screen>
|
---|
| 104 |
|
---|
| 105 | <variablelist>
|
---|
| 106 | <title>The meaning of the new configure options:</title><!-- WIP -->
|
---|
| 107 |
|
---|
| 108 | <varlistentry>
|
---|
| 109 | <term><parameter>-with-build-sysroot=$LFS</parameter></term>
|
---|
| 110 | <listitem>
|
---|
[bc8cca5] | 111 | <para>Normally, using <parameter>--host</parameter> ensures that
|
---|
[77d2cd8d] | 112 | a cross-compiler is used for building GCC, and that compiler knows
|
---|
[fcc02767] | 113 | that it has to look for headers and libraries in <filename
|
---|
| 114 | class="directory">$LFS</filename>. But the build system of GCC uses
|
---|
| 115 | other tools, which are not aware of this location. This switch is
|
---|
| 116 | needed to have them find the needed files in <filename
|
---|
| 117 | class="directory">$LFS</filename>, and not on the host.</para>
|
---|
| 118 | </listitem>
|
---|
| 119 | </varlistentry>
|
---|
| 120 |
|
---|
| 121 | <varlistentry>
|
---|
| 122 | <term><parameter>--enable-initfini-array</parameter></term>
|
---|
| 123 | <listitem>
|
---|
| 124 | <para>This option is automatically enabled when building a native
|
---|
| 125 | compiler with a native compiler on x86. But here, we build with
|
---|
[c0c616a] | 126 | a cross compiler, so we need to explicitly set this option.</para>
|
---|
[fcc02767] | 127 | </listitem>
|
---|
| 128 | </varlistentry>
|
---|
| 129 |
|
---|
| 130 | </variablelist>
|
---|
| 131 |
|
---|
| 132 | <para>Compile the package:</para>
|
---|
| 133 |
|
---|
| 134 | <screen><userinput remap="make">make</userinput></screen>
|
---|
| 135 |
|
---|
| 136 | <para>Install the package:</para>
|
---|
| 137 |
|
---|
| 138 | <screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
|
---|
| 139 |
|
---|
[bc8cca5] | 140 | <para>As a finishing touch, create a utility symlink. Many programs and scripts
|
---|
[fcc02767] | 141 | run <command>cc</command> instead of <command>gcc</command>, which is
|
---|
| 142 | used to keep programs generic and therefore usable on all kinds of UNIX
|
---|
| 143 | systems where the GNU C compiler is not always installed. Running
|
---|
| 144 | <command>cc</command> leaves the system administrator free to decide
|
---|
| 145 | which C compiler to install:</para>
|
---|
| 146 |
|
---|
| 147 | <screen><userinput remap="install">ln -sv gcc $LFS/usr/bin/cc</userinput></screen>
|
---|
| 148 |
|
---|
| 149 | </sect2>
|
---|
| 150 |
|
---|
| 151 | <sect2 role="content">
|
---|
| 152 | <title/>
|
---|
| 153 |
|
---|
| 154 | <para>Details on this package are located in
|
---|
| 155 | <xref linkend="contents-gcc" role="."/></para>
|
---|
| 156 |
|
---|
| 157 | </sect2>
|
---|
| 158 |
|
---|
| 159 | </sect1>
|
---|