Ignore:
Timestamp:
06/29/2020 07:55:01 AM (4 years ago)
Author:
Thomas Trepl <thomas@…>
Branches:
multilib-10.1
Children:
c4804e8
Parents:
d4fdde6
Message:

Update to new lfs structure

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11986 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter05/gcc-pass1.xml

    rd4fdde6 r37e35d2  
    2626
    2727    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    28     href="../chapter06/gcc.xml"
     28    href="../chapter08/gcc.xml"
    2929    xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
    3030
     
    3434
    3535      <seglistitem>
    36         <seg>&gcc-ch5p1-sbu;</seg>
    37         <seg>&gcc-ch5p1-du;</seg>
     36        <seg>&gcc-tmpp1-sbu;</seg>
     37        <seg>&gcc-tmpp1-du;</seg>
    3838      </seglistitem>
    3939    </segmentedlist>
     
    4444    <title>Installation of Cross GCC</title>
    4545
    46     <para arch="default">GCC now requires the GMP, MPFR, and MPC packages. As
    47     these packages may not be included in your host distribution, they will be
    48     built with GCC.  Unpack each package into the GCC source directory and
    49     rename the resulting directories so the GCC build procedures will
    50     automatically use them:</para>
    51 
    52     <para arch="ml_32,ml_x32,ml_all">GCC now requires the GMP, ISL, MPFR, and MPC packages.
    53     As these packages may not be included in your host distribution, they will
    54     be built with GCC.  Unpack each package into the GCC source directory and
    55     rename the resulting directories so the GCC build procedures will
    56     automatically use them:</para>
     46    <para>GCC requires the GMP, MPFR and MPC packages. As these packages may
     47    not be included in your host distribution, they will be built with
     48    GCC.  Unpack each package into the GCC source directory and rename the
     49    resulting directories so the GCC build procedures will automatically
     50    use them:</para>
    5751
    5852    <note><para>There are frequent misunderstandings about this chapter.  The
     
    6256    proceed with the instructions below.</para></note>
    6357
    64 <screen arch="default"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
     58<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
    6559mv -v mpfr-&mpfr-version; mpfr
    6660tar -xf ../gmp-&gmp-version;.tar.xz
    6761mv -v gmp-&gmp-version; gmp
    6862tar -xf ../mpc-&mpc-version;.tar.gz
    69 mv -v mpc-&mpc-version; mpc</userinput></screen>
    70 <screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
    71 mv -v mpfr-&mpfr-version; mpfr
    72 tar -xf ../gmp-&gmp-version;.tar.xz
    73 mv -v gmp-&gmp-version; gmp
    74 tar -xf ../mpc-&mpc-version;.tar.gz
    75 mv -v mpc-&mpc-version; mpc
    76 tar -xf ../isl-&isl-version;.tar.xz
     63mv -v mpc-&mpc-version; mpc</userinput>
     64<userinput remap="pre" arch="ml_32,ml_x32,ml_all">tar -xf ../isl-&isl-version;.tar.xz
    7765mv -v isl-&isl-version; isl</userinput></screen>
    7866
    79     <para>The following command will change the location of GCC's default
    80     dynamic linker to use the one installed in <filename
    81     class="directory">/tools</filename>. It also removes <filename
    82     class="directory">/usr/include</filename> from GCC's include search path.
    83     Issue:</para>
    84 
    85 <screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
    86 do
    87   cp -uv $file{,.orig}
    88   sed -e 's@/lib\(64\)\?\(32\)\?\(x32\)\?/ld@/tools&amp;@g' \
    89       -e 's@/usr@/tools@g' $file.orig &gt; $file
    90   touch $file.orig
    91 done
    92 sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/\";" \
    93     -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";" \
    94     -i gcc/gcc.c</userinput></screen>
    95 
    96     <para>In case the above seems hard to follow, let's break it down a bit.
    97     First we copy the files <filename>gcc/config/linux.h</filename>,
    98     <filename>gcc/config/i386/linux.h</filename>, and
    99     <filename>gcc/config/i386/linux64.h</filename> to a file of
    100     the same name but with an added suffix of <quote>.orig</quote>. Then the
    101     first sed expression prepends <quote>/tools</quote> to every instance of
    102     <quote>/lib/ld</quote>, <quote>/lib64/ld</quote> or
    103     <quote>/lib32/ld</quote>, while the second one replaces hard-coded
    104     instances of <quote>/usr</quote>. Next, we add our define statements which
    105     alter the default startfile prefix to the end of the file. Note that the
    106     trailing <quote>/</quote> in <quote>/tools/lib/</quote> is required.
    107     Finally, we use <command>touch</command> to update the timestamp on the
    108     copied files.  When used in conjunction with <command>cp -u</command>, this
    109     prevents unexpected changes to the original files in case the commands are
    110     inadvertently run twice.</para>
    111 
    112     <para arch="default">Finally, on x86_64 hosts, set the default directory
    113     name for 64-bit libraries to <quote>lib</quote>:</para>
     67    <para arch="default">On x86_64 hosts, set the default directory name for
     68    64-bit libraries to <quote>lib</quote>:</para>
    11469
    11570<screen arch="default"><userinput remap="pre">case $(uname -m) in
     
    12075esac</userinput></screen>
    12176
    122 <screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/'  \
    123     -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \
    124     -i.orig gcc/config/i386/t-linux64</userinput></screen>
    125 
    126 <!--
    127     <para>GCC doesn't detect stack protection correctly, which causes problems
    128     for the build of Glibc-&glibc-version;, so fix that by issuing the following
    129     command:</para>
    130 
    131 <screen><userinput remap="pre">sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure</userinput></screen>
    132 -->
    133 
    134 <!--
    135     <para>Also fix a problem identified upstream:</para>
    136 
    137 <screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
    138 -->
    139 
    140     <!-- Following patch might be obsolete with gcc >= 8.2.1 -->
    141     <!-- see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724 -->
    142     <!-- Fix applied in ch5-gcc-pass{1,2}, ch6-gcc -->
    143 <!--
    144     <para arch="ml_32,ml_x32,ml_all">Fix an issue with isl-&isl-version;:</para>
    145 
    146 <screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e "/#include &lt;isl\/schedule_node.h&gt;/ a#include &lt;isl/id.h&gt;\n#include &lt;isl/space.h&gt;" \
    147     -i gcc/graphite.h</userinput></screen>
    148 -->
     77    <para arch="ml_32,ml_x32,ml_all">Change the default directory name for
     78    libraries:</para>
     79
     80<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
     81    -e '/m32=/s/m32=.*/m32=..\&lib-m32;$(call if_multiarch,:i386-linux-gnu)/' \
     82    -i.orig gcc/config/i386/t-linux64
     83</userinput></screen>
    14984
    15085    <para>The GCC documentation recommends building GCC
     
    15691    <para>Prepare GCC for compilation:</para>
    15792
    158 <screen><userinput arch="default" remap="configure">mloptions="--disable-multilib"</userinput>
    159 <userinput arch="ml_32,ml_x32,ml_all" remap="configure">mloptions="--enable-multilib --with-multilib-list=m64"</userinput>
    160 <userinput arch="ml_32,ml_all" remap="configure">mloptions="$mloptions,m32"</userinput>
    161 <userinput arch="ml_x32,ml_all" remap="configure">mloptions="$mloptions,mx32"</userinput>
    162 <userinput remap="configure">../configure                                       \
     93<screen arch="default"><userinput remap="configure">../configure                                       \
    16394    --target=$LFS_TGT                              \
    164     --prefix=/tools                                \
     95    --prefix=$LFS/tools                            \
    16596    --with-glibc-version=2.11                      \
    16697    --with-sysroot=$LFS                            \
    16798    --with-newlib                                  \
    16899    --without-headers                              \
    169     --with-local-prefix=/tools                     \
    170     --with-native-system-header-dir=/tools/include \
     100    --enable-initfini-array                        \
    171101    --disable-nls                                  \
    172102    --disable-shared                               \
     103    --disable-multilib                             \
    173104    --disable-decimal-float                        \
    174105    --disable-threads                              \
     
    179110    --disable-libvtv                               \
    180111    --disable-libstdcxx                            \
    181     --enable-languages=c,c++                       \
    182     $mloptions</userinput></screen>
     112    --enable-languages=c,c++</userinput></screen>
     113<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure"
     114    arch="ml_32">mlist=m64,m32</userinput><userinput remap="configure"
     115    arch="ml_x32">mlist=m64,mx32</userinput><userinput remap="configure"
     116    arch="ml_all">mlist=m64,m32,mx32</userinput>
     117<userinput remap="configure">../configure                                       \
     118    --target=$LFS_TGT                              \
     119    --prefix=$LFS/tools                            \
     120    --with-glibc-version=2.11                      \
     121    --with-sysroot=$LFS                            \
     122    --with-newlib                                  \
     123    --without-headers                              \
     124    --enable-initfini-array                        \
     125    --disable-nls                                  \
     126    --disable-shared                               \
     127    --enable-multilib --with-multilib-list=$mlist  \
     128    --disable-decimal-float                        \
     129    --disable-threads                              \
     130    --disable-libatomic                            \
     131    --disable-libgomp                              \
     132    --disable-libquadmath                          \
     133    --disable-libssp                               \
     134    --disable-libvtv                               \
     135    --disable-libstdcxx                            \
     136    --enable-languages=c,c++</userinput></screen>
    183137
    184138    <variablelist>
     
    214168
    215169      <varlistentry>
    216         <term><parameter>--with-local-prefix=/tools</parameter></term>
    217         <listitem>
    218           <para>The local prefix is the location in the system that GCC will search
    219           for locally installed include files. The default is <filename>/usr/local</filename>.
    220           Setting this to <filename>/tools</filename> helps keep the host location of
    221           <filename>/usr/local</filename> out of this GCC's search path.</para>
    222         </listitem>
    223       </varlistentry>
    224 
    225       <varlistentry>
    226         <term><parameter>--with-native-system-header-dir=/tools/include</parameter></term>
    227         <listitem>
    228           <para>By default, GCC searches <filename>/usr/include</filename> for
    229           system headers. In conjunction with the sysroot switch, this would
    230           normally translate to <filename>$LFS/usr/include</filename>. However
    231           the headers that will be installed in the next two sections will go
    232           to <filename>$LFS/tools/include</filename>. This switch ensures that
    233           gcc will find them correctly. In the second pass of GCC, this same
    234           switch will ensure that no headers from the host system are
    235           found.</para>
     170        <term><parameter>--enable-initfini-array</parameter></term>
     171        <listitem>
     172          <para>This switch forces the use of some internal data structures
     173          that are needed but cannot be detected when building a cross
     174          compiler.</para>
    236175        </listitem>
    237176      </varlistentry>
     
    241180        <listitem>
    242181          <para>This switch forces GCC to link its internal libraries
    243           statically. We do this to avoid possible issues with the host
    244           system.</para>
     182          statically. We need this because the shared libraries require glibc,
     183          which is not yet installed on the target system.</para>
     184        </listitem>
     185      </varlistentry>
     186
     187      <varlistentry arch="default">
     188        <term><parameter>--disable-multilib</parameter></term>
     189        <listitem>
     190          <para>On x86_64, LFS does not support a multilib configuration.
     191          This switch is harmless for x86.</para>
     192        </listitem>
     193      </varlistentry>
     194      <varlistentry arch="ml_32,ml_x32,ml_all">
     195        <term><parameter>--enable-multilib --with-multilib-list=...</parameter></term>
     196        <listitem>
     197          <para>LFS canbe used to support multilib. Which they are is
     198          specified in the multilib list.</para>
    245199        </listitem>
    246200      </varlistentry>
     
    248202      <varlistentry>
    249203        <term><parameter>--disable-decimal-float, --disable-threads,
    250               --disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->
     204              --disable-libatomic, --disable-libgomp,
    251205        --disable-libquadmath, --disable-libssp, --disable-libvtv,
    252206        --disable-libstdcxx</parameter></term>
    253207        <listitem>
    254208          <para>These switches disable support for the decimal floating point
    255           extension, threading, libatomic, libgomp, <!--libmpx, --> libquadmath, libssp,
     209          extension, threading, libatomic, libgomp, libquadmath, libssp,
    256210          libvtv, and the C++ standard library respectively. These features
    257211          will fail to compile when building a cross-compiler and are not
     
    260214      </varlistentry>
    261215
    262       <varlistentry arch="default">
    263         <term><parameter>--disable-multilib</parameter></term>
    264         <listitem>
    265           <para>On x86_64, LFS does not yet support a multilib configuration.
    266           This switch is harmless for x86.</para>
    267         </listitem>
    268       </varlistentry>
    269 
    270       <varlistentry arch="ml_32,ml_x32,ml_all">
    271         <term><parameter>--enable-multilib,
    272                          --with-multilib-list=m32,m64,mx32</parameter></term>
    273         <listitem>
    274           <para>LFS now supports a multilib configuration. Enable it for the
    275           32bit, the 64-bit, and the mixed mode.</para>
    276         </listitem>
    277       </varlistentry>
    278 
    279216      <varlistentry>
    280217        <term><parameter>--enable-languages=c,c++</parameter></term>
     
    291228<screen><userinput remap="make">make</userinput></screen>
    292229
    293     <para>Compilation is now complete. At this point, the test suite would
    294     normally be run, but, as mentioned before, the test suite framework is
    295     not in place yet. The benefits of running the tests at this point
    296     are minimal since the programs from this first pass will soon be
    297     replaced.</para>
    298 
    299230    <para>Install the package:</para>
    300231
    301 <screen><userinput remap="install">make install</userinput></screen>
    302 <!--
    303     <para>Using <parameter>- -disable-shared</parameter> means that the
    304     <filename>libgcc_eh.a</filename> file isn't created and installed. The
    305     Glibc package depends on this library as it uses
    306     <parameter>-lgcc_eh</parameter> within its build system. This dependency
    307     can be satisfied by creating a symlink to <filename>libgcc.a</filename>,
    308     since that file will end up containing the objects normally contained in
    309     <filename>libgcc_eh.a</filename>:</para>
    310 
    311 <screen><userinput remap="install">ln -sv libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&amp;_eh/'`</userinput></screen>
    312 -->
     232    <screen><userinput remap="install">make install</userinput></screen>
     233
     234    <para>This build of GCC has installed a couple of internal system
     235    headers.  Normally one of them, <filename>limits.h</filename>, would in turn
     236    include the corresponding system <filename>limits.h</filename> header, in
     237    this case, <filename>$LFS/usr/include/limits.h</filename>. However, at the
     238    time of this build of GCC <filename>$LFS/usr/include/limits.h</filename>
     239    does not exist, so the internal header that has just been installed is a
     240    partial, self-contained file and does not include the extended features of
     241    the system header. This is adequate for building glibc, but the full
     242    internal header will be needed later.  Create a full version of the internal
     243    header using a command that is identical to what the GCC build system does
     244    in normal circumstances:</para>
     245
     246<screen><userinput remap="install">cd ..
     247cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
     248  `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h</userinput></screen>
    313249  </sect2>
    314250
Note: See TracChangeset for help on using the changeset viewer.