- Timestamp:
- 03/31/2021 10:41:39 AM (3 years ago)
- Branches:
- ml-11.0, multilib
- Children:
- 7610848
- Parents:
- 811b5a39
- git-author:
- Thomas Trepl <thomas@…> (06/29/2020 07:55:01 AM)
- git-committer:
- Xℹ Ruoyao <xry111@…> (03/31/2021 10:41:39 AM)
- Location:
- chapter05
- Files:
-
- 23 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/binutils-pass1.xml
r811b5a39 r6dfcfecc 26 26 27 27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 28 href="../chapter0 6/binutils.xml"28 href="../chapter08/binutils.xml" 29 29 xpointer="xpointer(/sect1/sect2[1]/para[1])"/> 30 30 … … 34 34 35 35 <seglistitem> 36 <seg>&binutils- ch5p1-sbu;</seg>37 <seg>&binutils- ch5p1-du;</seg>36 <seg>&binutils-tmpp1-sbu;</seg> 37 <seg>&binutils-tmpp1-du;</seg> 38 38 </seglistitem> 39 39 </segmentedlist> … … 44 44 <title>Installation of Cross Binutils</title> 45 45 46 <note><para>Go back and re-read the notes in the previous section. 47 Understanding the notes labeled important will save you a lot 46 <note><para>Go back and re-read the notes in the section titled <xref 47 linkend="ch-tools-generalinstructions"/>. 48 Understanding the notes labeled important can save you a lot 48 49 of problems later.</para></note> 49 50 … … 64 65 the configuration, up to and including the first install. To achieve 65 66 this easily, wrap the commands in a <command>time</command> 66 command like this: <userinput>time { ./configure ... && ...67 command like this: <userinput>time { ./configure ... && make 67 68 && make install; }</userinput>.</para> 68 69 </note> 69 70 70 <note><para>The approximate build SBU values and required disk space71 in Chapter 5 does not include test suite data.</para></note>72 73 71 <para>Now prepare Binutils for compilation:</para> 74 72 75 <screen arch="default"><userinput remap="configure">../configure --prefix= /tools\73 <screen arch="default"><userinput remap="configure">../configure --prefix=$LFS/tools \ 76 74 --with-sysroot=$LFS \ 77 --with-lib-path=/tools/lib \78 75 --target=$LFS_TGT \ 79 76 --disable-nls \ 80 77 --disable-werror</userinput></screen> 81 82 <screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">lpath=/tools/lib</userinput> 83 <userinput remap="configure" arch="ml_32,ml_all">lpath="$lpath:/tools/lib32"</userinput> 84 <userinput remap="configure" arch="ml_x32,ml_all">lpath="$lpath:/tools/libx32"</userinput> 85 <userinput remap="configure">../configure --prefix=/tools \ 86 --with-sysroot=$LFS \ 87 --with-lib-path=$lpath \ 88 --target=$LFS_TGT \ 89 --disable-nls \ 90 --disable-werror \ 91 --enable-64-bit-bfd \ 78 <screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=$LFS/tools \ 79 --with-sysroot=$LFS \ 80 --target=$LFS_TGT \ 81 --disable-nls \ 82 --disable-werror \ 92 83 --enable-multilib</userinput></screen> 93 84 … … 96 87 97 88 <varlistentry> 98 <term><parameter>--prefix= /tools</parameter></term>89 <term><parameter>--prefix=$LFS/tools</parameter></term> 99 90 <listitem> 100 91 <para>This tells the configure script to prepare to install the 101 Binutils programs in the <filename class="directory">/tools</filename>102 directory.</para>92 binutils programs in the <filename 93 class="directory">$LFS/tools</filename> directory.</para> 103 94 </listitem> 104 95 </varlistentry> … … 113 104 114 105 <varlistentry> 115 <term><parameter>--with-lib-path=/tools/lib</parameter></term>116 <listitem>117 <para>This specifies which library path the linker should be118 configured to use.</para>119 </listitem>120 </varlistentry>121 122 <varlistentry>123 106 <term><envar>--target=$LFS_TGT</envar></term> 124 107 <listitem> … … 126 109 variable is slightly different than the value returned by the 127 110 <command>config.guess</command> script, this switch will tell the 128 <command>configure</command> script to adjust Binutil's build system111 <command>configure</command> script to adjust binutil's build system 129 112 for building a cross linker. </para> 130 113 </listitem> … … 147 130 </varlistentry> 148 131 132 <varlistentry arch="ml_32,ml_x32,ml_all"> 133 <term><parameter>--enable-multilib</parameter></term> 134 <listitem> 135 <para>Enables multilib support.</para> 136 </listitem> 137 </varlistentry> 138 149 139 </variablelist> 150 140 … … 152 142 153 143 <screen><userinput remap="make">make</userinput></screen> 154 155 <para>Compilation is now complete. Ordinarily we would now run the156 test suite, but at this early stage the test suite framework (Tcl,157 Expect, and DejaGNU) is not yet in place. The benefits of running the158 tests at this point are minimal since the programs from this159 first pass will soon be replaced by those from the second.</para>160 161 <para arch="default">If building on x86_64, create a symlink to ensure the162 sanity of the toolchain:</para>163 164 <para arch="ml_32,ml_x32,ml_all">Create a symlink to ensure the sanity of165 the toolchain:</para>166 167 <screen arch="default"><userinput remap="install">case $(uname -m) in168 x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;;169 esac</userinput></screen>170 171 <screen arch="ml_32,ml_x32,ml_all"><userinput remap="install">mkdir -v /tools/lib &&172 ln -sv lib /tools/lib64</userinput></screen>173 144 174 145 <para>Install the package:</para> -
chapter05/chapter05.xml
r811b5a39 r6dfcfecc 6 6 ]> 7 7 8 <chapter id="chapter- temporary-tools" xreflabel="Chapter 5">8 <chapter id="chapter-cross-tools" xreflabel="Chapter 5"> 9 9 <?dbhtml dir="chapter05"?> 10 10 <?dbhtml filename="chapter05.html"?> 11 11 12 <title>Co nstructing a Temporary System</title>12 <title>Compiling a Cross-Toolchain</title> 13 13 14 14 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/> 15 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="toolchaintechnotes.xml"/>16 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="generalinstructions.xml"/>17 15 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils-pass1.xml"/> 18 16 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass1.xml"/> … … 20 18 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc.xml"/> 21 19 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++.xml"/> 22 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils-pass2.xml"/>23 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="zlib.xml"/>24 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass2.xml"/>25 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tcl.xml"/>26 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="expect.xml"/>27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dejagnu.xml"/>28 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="m4.xml"/>29 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ncurses.xml"/>30 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bash.xml"/>31 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bison.xml"/>32 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="coreutils.xml"/>33 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="diffutils.xml"/>34 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="file.xml"/>35 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="findutils.xml"/>36 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gawk.xml"/>37 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/>38 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="grep.xml"/>39 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gzip.xml"/>40 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="make.xml"/>41 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="patch.xml"/>42 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="perl.xml"/>43 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python.xml"/>44 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sed.xml"/>45 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tar.xml"/>46 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="texinfo.xml"/>47 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>48 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="xz.xml"/>49 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="stripping.xml"/>50 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/>51 20 52 21 </chapter> -
chapter05/gcc-pass1.xml
r811b5a39 r6dfcfecc 26 26 27 27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 28 href="../chapter0 6/gcc.xml"28 href="../chapter08/gcc.xml" 29 29 xpointer="xpointer(/sect1/sect2[1]/para[1])"/> 30 30 … … 34 34 35 35 <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> 38 38 </seglistitem> 39 39 </segmentedlist> … … 44 44 <title>Installation of Cross GCC</title> 45 45 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> 57 51 58 52 <note><para>There are frequent misunderstandings about this chapter. The … … 62 56 proceed with the instructions below.</para></note> 63 57 64 <screen arch="default"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz58 <screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz 65 59 mv -v mpfr-&mpfr-version; mpfr 66 60 tar -xf ../gmp-&gmp-version;.tar.xz 67 61 mv -v gmp-&gmp-version; gmp 68 62 tar -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 63 mv -v mpc-&mpc-version; mpc</userinput> 64 <userinput remap="pre" arch="ml_32,ml_x32,ml_all">tar -xf ../isl-&isl-version;.tar.xz 77 65 mv -v isl-&isl-version; isl</userinput></screen> 78 66 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&@g' \ 89 -e 's@/usr@/tools@g' $file.orig > $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> 114 69 115 70 <screen arch="default"><userinput remap="pre">case $(uname -m) in … … 120 75 esac</userinput></screen> 121 76 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 \&\& \!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 <isl\/schedule_node.h>/ a#include <isl/id.h>\n#include <isl/space.h>" \ 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> 149 84 150 85 <para>The GCC documentation recommends building GCC … … 156 91 <para>Prepare GCC for compilation:</para> 157 92 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 \ 163 94 --target=$LFS_TGT \ 164 --prefix= /tools\95 --prefix=$LFS/tools \ 165 96 --with-glibc-version=2.11 \ 166 97 --with-sysroot=$LFS \ 167 98 --with-newlib \ 168 99 --without-headers \ 169 --with-local-prefix=/tools \ 170 --with-native-system-header-dir=/tools/include \ 100 --enable-initfini-array \ 171 101 --disable-nls \ 172 102 --disable-shared \ 103 --disable-multilib \ 173 104 --disable-decimal-float \ 174 105 --disable-threads \ … … 179 110 --disable-libvtv \ 180 111 --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> 183 137 184 138 <variablelist> … … 214 168 215 169 <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> 236 175 </listitem> 237 176 </varlistentry> … … 241 180 <listitem> 242 181 <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> 245 199 </listitem> 246 200 </varlistentry> … … 248 202 <varlistentry> 249 203 <term><parameter>--disable-decimal-float, --disable-threads, 250 --disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->204 --disable-libatomic, --disable-libgomp, 251 205 --disable-libquadmath, --disable-libssp, --disable-libvtv, 252 206 --disable-libstdcxx</parameter></term> 253 207 <listitem> 254 208 <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, 256 210 libvtv, and the C++ standard library respectively. These features 257 211 will fail to compile when building a cross-compiler and are not … … 260 214 </varlistentry> 261 215 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 the275 32bit, the 64-bit, and the mixed mode.</para>276 </listitem>277 </varlistentry>278 279 216 <varlistentry> 280 217 <term><parameter>--enable-languages=c,c++</parameter></term> … … 291 228 <screen><userinput remap="make">make</userinput></screen> 292 229 293 <para>Compilation is now complete. At this point, the test suite would294 normally be run, but, as mentioned before, the test suite framework is295 not in place yet. The benefits of running the tests at this point296 are minimal since the programs from this first pass will soon be297 replaced.</para>298 299 230 <para>Install the package:</para> 300 231 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/&_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 .. 247 cat 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> 313 249 </sect2> 314 250 -
chapter05/glibc.xml
r811b5a39 r6dfcfecc 26 26 27 27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 28 href="../chapter0 6/glibc.xml"28 href="../chapter08/glibc.xml" 29 29 xpointer="xpointer(/sect1/sect2[1]/para[1])"/> 30 30 … … 34 34 35 35 <seglistitem> 36 <seg>&glibc- ch5-sbu;</seg>37 <seg>&glibc- ch5-du;</seg>36 <seg>&glibc-tmp-sbu;</seg> 37 <seg>&glibc-tmp-du;</seg> 38 38 </seglistitem> 39 39 </segmentedlist> … … 44 44 <title>Installation of Glibc</title> 45 45 46 <para arch="default">First, create a symbolic link for LSB compliance. Additionally, 47 for x86_64, create a compatibility symbolic link required for proper 48 operation of the dynamic library loader:</para> 49 50 <screen arch="default"><userinput remap="pre">case $(uname -m) in 51 i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3 52 ;; 53 x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64 54 ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3 55 ;; 56 esac</userinput></screen> 57 58 <para arch="ml_32,ml_x32,ml_all">First, create symbolic links for LSB compliance 59 and compatibility symbolic links required for proper 60 operation of the dynamic library loader:</para> 61 62 <!-- no ld-linux.so.2 here as multilib is based on x86_64, not on i686 --> 63 <screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64 64 ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen> 65 66 <para>Some of the Glibc programs use the non-FHS compliant 67 <filename class="directory">/var/db</filename> directory to store their 68 runtime data. Apply the following patch to make such programs store their 69 runtime data in the FHS-compliant locations:</para> 70 71 <screen><userinput remap="pre">patch -Np1 -i ../glibc-&glibc-version;-fhs-1.patch</userinput></screen> 72 46 73 <para>The Glibc documentation recommends building Glibc 47 74 in a dedicated build directory:</para> … … 53 80 54 81 <screen arch="default"><userinput remap="configure">../configure \ 55 --prefix=/ tools\82 --prefix=/usr \ 56 83 --host=$LFS_TGT \ 57 84 --build=$(../scripts/config.guess) \ 58 85 --enable-kernel=&min-kernel; \ 59 --with-headers=/tools/include</userinput></screen> 86 --with-headers=$LFS/usr/include \ 87 libc_cv_slibdir=/lib</userinput></screen> 60 88 <screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure \ 61 --prefix=/ tools\89 --prefix=/usr \ 62 90 --host=$LFS_TGT \ 63 91 --build=$(../scripts/config.guess) \ 64 92 --enable-kernel=&min-kernel; \ 93 --with-headers=$LFS/usr/include \ 65 94 --enable-multi-arch \ 66 --with-headers=/tools/include</userinput></screen> 95 --libdir=/usr/lib \ 96 --libexecdir=/usr/lib \ 97 libc_cv_slibdir=/lib</userinput></screen> 67 98 <!-- 68 99 libc_cv_forced_unwind=yes \ … … 76 107 <listitem> 77 108 <para>The combined effect of these switches is that Glibc's build system 78 configures itself to cross-compile, using the cross-linker and79 cross-compiler in <filename class="directory"> /tools</filename>.</para>109 configures itself to be cross-compiled, using the cross-linker and 110 cross-compiler in <filename class="directory">$LFS/tools</filename>.</para> 80 111 </listitem> 81 112 </varlistentry> … … 90 121 </varlistentry> 91 122 92 <varlistentry arch="ml_32,ml_x32,ml_all"> 93 <term><parameter>--enable-multi-arch</parameter></term> 94 <listitem> 95 <para>Enables glibc for multiarch environments.</para> 96 </listitem> 97 </varlistentry> 98 99 <varlistentry> 100 <term><parameter>--with-headers=/tools/include</parameter></term> 101 <listitem> 102 <para>This tells Glibc to compile itself against the headers recently 103 installed to the tools directory, so that it knows exactly what 104 features the kernel has and can optimize itself accordingly.</para> 105 </listitem> 106 </varlistentry> 107 <!-- 108 <varlistentry> 109 <term><parameter>libc_cv_forced_unwind=yes</parameter></term> 110 <listitem> 111 <para>The linker installed during 112 <xref linkend="ch-tools-binutils-pass1"/> was cross-compiled and as 113 such cannot be used until Glibc has been installed. This means that 114 the configure test for force-unwind support will fail, as it relies on 115 a working linker. The libc_cv_forced_unwind=yes variable is passed in 116 order to inform <command>configure</command> that force-unwind 117 support is available without it having to run the test.</para> 118 </listitem> 119 </varlistentry> 120 <varlistentry> 121 <term><parameter>libc_cv_c_cleanup=yes</parameter></term> 122 <listitem> 123 <para>Similarly, we pass libc_cv_c_cleanup=yes through to the 124 <command>configure</command> script so that the test is skipped and C 125 cleanup handling support is configured.</para> 126 </listitem> 127 </varlistentry> 128 --> 129 <!-- <varlistentry> 130 <term><parameter>libc_cv_ctors_header=yes</parameter></term> 131 <listitem> 132 <para>Similarly, we pass libc_cv_ctors_header=yes through to the 133 <command>configure</command> script so that the test is skipped and 134 gcc constructor support is configured.</para> 135 </listitem> 136 </varlistentry>--> 123 <varlistentry> 124 <term><parameter>--with-headers=$LFS/usr/include</parameter></term> 125 <listitem> 126 <para>This tells Glibc to compile itself against the headers 127 recently installed to the $LFS/usr/include directory, so that 128 it knows exactly what features the kernel has and can optimize 129 itself accordingly.</para> 130 </listitem> 131 </varlistentry> 132 133 <varlistentry> 134 <term><parameter>libc_cv_slibdir=/lib</parameter></term> 135 <listitem> 136 <para>This ensures that the library is installed in /lib instead 137 of the default /lib64 on 64 bit machines.</para> 138 </listitem> 139 </varlistentry> 137 140 138 141 </variablelist> … … 162 165 <para>Install the package:</para> 163 166 164 <screen><userinput remap="install">make install</userinput></screen> 165 166 <caution> 167 <para>At this point, it is imperative to stop and ensure that the basic 168 functions (compiling and linking) of the new toolchain are working as 169 expected. To perform a sanity check, run the following commands:</para> 167 <warning><para>If <envar>LFS</envar> is not properly set, and despite the 168 recommendations, you are building as root, the next command will install 169 the newly built glibc to your host system, which most likely will render it 170 unusable. So double check that the environment is correctly set for user 171 <systemitem class="username">lfs</systemitem>.</para></warning> 172 173 <screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> 174 175 <variablelist> 176 <title>The meaning of the <command>make install</command> option:</title> 177 178 <varlistentry> 179 <term><parameter>DESTDIR=$LFS</parameter></term> 180 <listitem> 181 <para>The <envar>DESTDIR</envar> make variable is used by almost all 182 packages to define the location where the package should be 183 installed. If it is not set, it defaults to the root (<filename 184 class="directory">/</filename>) directory. Here we specify that 185 the package be installed in <filename class="directory">$LFS 186 </filename>, which will become the root after <xref linkend= 187 "ch-tools-chroot"/>.</para> 188 </listitem> 189 </varlistentry> 190 191 </variablelist> 192 193 <caution> 194 <para>At this point, it is imperative to stop and ensure that the basic 195 functions (compiling and linking) of the new toolchain are working as 196 expected. To perform a sanity check, run the following commands:</para> 170 197 171 198 <screen><userinput>echo 'int main(){}' > dummy.c 172 199 $LFS_TGT-gcc dummy.c 173 readelf -l a.out | grep ' : /tools'</userinput></screen>174 175 <para>If everything is working correctly, there should be no errors,176 and the output of the last command will be of the form:</para>177 178 <screen><computeroutput>[Requesting program interpreter: / tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>179 180 <para>Note that for 32-bit machines, the interpreter name will be181 <filename>/tools/lib/ld-linux.so.2</filename>.</para>182 183 <para>If the output is not shown as above or there was no output at all,184 then something is wrong. Investigate and retrace the steps to find out185 where the problem is and correct it. This issue must be resolved before186 continuing on.</para>187 188 <para>Once all is well, clean up the test files:</para>200 readelf -l a.out | grep '/ld-linux'</userinput></screen> 201 202 <para>If everything is working correctly, there should be no errors, 203 and the output of the last command will be of the form:</para> 204 205 <screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen> 206 207 <para arch="default">Note that for 32-bit machines, the interpreter name will be 208 <filename>/lib/ld-linux.so.2</filename>.</para> 209 210 <para>If the output is not shown as above or there was no output at all, 211 then something is wrong. Investigate and retrace the steps to find out 212 where the problem is and correct it. This issue must be resolved before 213 continuing on.</para> 214 215 <para>Once all is well, clean up the test files:</para> 189 216 190 217 <screen><userinput>rm -v dummy.c a.out</userinput></screen> 191 218 192 </caution> 193 194 <note><para>Building Binutils in the section after next will serve as an 195 additional check that the toolchain has been built properly. If Binutils 196 fails to build, it is an indication that something has gone wrong with the 197 previous Binutils, GCC, or Glibc installations.</para></note> 219 </caution> 220 221 <note><para>Building packages in the next chapter will serve as an 222 additional check that the toolchain has been built properly. If some 223 package, especially binutils-pass2 or gcc-pass2, fails to build, it is 224 an indication that something has gone wrong with the 225 previous Binutils, GCC, or Glibc installations.</para></note> 226 227 <para>Now that our cross-toolchain is complete, finalize the installation 228 of the limits.h header. For doing so, run a utility provided by the GCC 229 developers:</para> 230 231 <screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen> 198 232 199 233 </sect2> 200 234 201 <sect2 arch="ml_32,ml_all" role="installation"> 202 <title>Installation of Glibc 32-bit</title> 203 204 <para>Clean the build directory for redoing glibc for 32-bit:</para> 205 <screen><userinput remap="pre">mkdir ../build32 206 cd ../build32</userinput></screen> 207 208 <para>Rebuild glibc for 32-bit:</para> 209 <screen><userinput remap="configure">echo slibdir=/tools/lib32 > configparms 210 BUILD_CC="gcc -m32" \ 211 CC="${LFS_TGT}-gcc -m32" \ 212 CXX="${LFS_TGT}-g++ -m32" \ 213 AR="${LFS_TGT}-ar" \ 214 RANLIB="${LFS_TGT}-ranlib" \ 215 ../configure --prefix=/tools \ 216 --build=$(../scripts/config.guess) \ 217 --host=${LFS_TGT32} \ 218 --enable-kernel=&min-kernel; \ 219 --with-headers=/tools/include \ 220 --with-binutils=/tools/bin \ 221 --enable-multi-arch \ 222 --libdir=/tools/lib32 \ 223 --libexecdir=/tools/lib32</userinput></screen> 224 <!-- \ 225 libc_cv_forced_unwind=yes \ 226 libc_cv_c_cleanup=yes</userinput></screen> --> 227 228 <variablelist> 229 <title>The meaning of the extra configure options:</title> 230 231 <varlistentry> 232 <term><parameter>--enable-multi-arch</parameter></term> 233 <listitem> 234 <para>Enables glibc for multiarch environments.</para> 235 </listitem> 236 </varlistentry> 237 238 <varlistentry> 239 <term><parameter>--libdir=/tools/lib32, --libexecdir=/tools/lib32</parameter></term> 240 <listitem> 241 <para>Overrides location for installing 32-bit files.</para> 242 </listitem> 243 </varlistentry> 244 245 <varlistentry> 246 <term><parameter>--with-binutils=/tools/bin</parameter></term> 247 <listitem> 248 <para>This tells Glibc to compile itself against the utilities 249 found within our "tools" heirachy, because otherwise...</para> 250 </listitem> 251 </varlistentry> 252 253 </variablelist> 254 255 <para>Now compile the 32-bit version of glibc:</para> 235 <!-- - - - - - - - - - --> 236 <!-- Multilib - 32bit --> 237 <!-- - - - - - - - - - --> 238 <sect2 arch="ml_32,ml_all"> 239 <title>Building Glibc - 32bit</title> 240 241 <para>Now recompile for m32. The extracted source can be 242 reused but needs to cleaned before installing the m32 243 version of Glibc.</para> 244 245 <para>Clear the build directory and remove artefacts from 246 previous build:</para> 247 248 <screen><userinput remap="pre">make clean 249 find .. -name "*.a" -delete</userinput></screen> 250 251 <para>Configure Glibc for m32 with the following commands:</para> 252 253 <screen><userinput remap="configure">CC="$LFS_TGT-gcc -m32" \ 254 CXX="$LFS_TGT-g++ -m32" \ 255 ../configure \ 256 --prefix=/usr \ 257 --host=$LFS_TGT32 \ 258 --build=$(../scripts/config.guess) \ 259 --enable-kernel=&min-kernel; \ 260 --with-headers=$LFS/usr/include \ 261 --enable-multi-arch \ 262 --libdir=&usr-lib-m32; \ 263 --libexecdir=&usr-lib-m32; \ 264 libc_cv_slibdir=&lib-m32;</userinput></screen> 265 266 <para>Compile the package:</para> 267 256 268 <screen><userinput remap="make">make</userinput></screen> 257 269 258 <para>Install 32-bit version of glibc:</para> 259 <screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install 260 install -vdm755 /tools/lib32 261 cp -Rv DESTDIR/tools/lib32/* /tools/lib32 262 install -vm644 DESTDIR/tools/include/gnu/{lib-names,stubs}-32.h \ 263 /tools/include/gnu/ 264 ln -svf /tools/lib32/ld-linux.so.2 /tools/lib/</userinput></screen> 265 266 </sect2> 267 268 <sect2 arch="ml_x32,ml_all" role="installation"> 269 <title>Installation of Glibc x32-bit</title> 270 271 <para>Create a build directory for redoing glibc for x32-bit:</para> 272 <screen><userinput remap="pre">mkdir ../build32x 273 cd ../build32x</userinput></screen> 274 275 <para>Rebuild glibc for x32-bit:</para> 276 <screen><userinput remap="configure">echo slibdir=/tools/libx32 > configparms 277 BUILD_CC="gcc -mx32" \ 278 CC="${LFS_TGT}-gcc -mx32" \ 279 CXX="${LFS_TGT}-g++ -mx32" \ 280 AR="${LFS_TGT}-ar" \ 281 RANLIB="${LFS_TGT}-ranlib" \ 282 ../configure --prefix=/tools \ 283 --build=$(../scripts/config.guess) \ 284 --host=${LFS_TGTX32} \ 285 --enable-kernel=&min-kernel; \ 286 --with-headers=/tools/include \ 287 --with-binutils=/tools/bin \ 288 --enable-multi-arch \ 289 --libdir=/tools/libx32 \ 290 --libexecdir=/tools/libx32</userinput></screen> 291 <!-- \ 292 libc_cv_forced_unwind=yes \ 293 libc_cv_c_cleanup=yes</userinput></screen> --> 294 295 <variablelist> 296 <title>The meaning of the extra configure options:</title> 297 298 <varlistentry> 299 <term><parameter>--enable-multi-arch</parameter></term> 300 <listitem> 301 <para>Enables glibc for multiarch environments.</para> 302 </listitem> 303 </varlistentry> 304 305 <varlistentry> 306 <term><parameter>--libdir=/tools/libx32, --libexecdir=/tools/libx32</parameter></term> 307 <listitem> 308 <para>Overrides location for installing x32-bit files.</para> 309 </listitem> 310 </varlistentry> 311 312 <varlistentry> 313 <term><parameter>--with-binutils=/tools/bin</parameter></term> 314 <listitem> 315 <para>This tells Glibc to compile itself against the utilities 316 found within our "tools" heirachy, because otherwise...</para> 317 </listitem> 318 </varlistentry> 319 320 </variablelist> 321 322 <para>Now compile the x32-bit version of glibc:</para> 323 <screen><userinput remap="make">make</userinput></screen> 324 325 <para>Install x32-bit version of glibc:</para> 326 <screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install 327 install -vdm755 /tools/libx32 328 cp -Rv DESTDIR/tools/libx32/* /tools/libx32 329 install -vm644 DESTDIR/tools/include/gnu/lib-names-x32.h \ 330 /tools/include/gnu/ 331 [ -e DESTDIR/tools/include/gnu/stubs-x32.h ] \ 332 && install -vm644 DESTDIR/tools/include/gnu/stubs-x32.h /tools/include/gnu/ \ 333 || ln -v /tools/include/gnu/stubs-64.h /tools/include/gnu/stubs-x32.h 334 ln -svf /tools/libx32/ld-linux-x32.so.2 /tools/lib/</userinput></screen> 335 <!-- For whatever reason the stubs-x32.h doesn't get created. The 'ln' above is 336 just a "brute force" workaraound - by copying the stubs-64.h file. --> 337 338 <caution> 339 <para>At this point, it is imperative to stop and ensure that the basic 340 functions (compiling and linking) of the new toolchain are working as 341 expected. To perform a sanity check, run the following commands:</para> 270 <para>Install the package:</para> 271 272 <screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install 273 cp -a DESTDIR&lib-m32;/* $LFS&lib-m32;/ 274 cp -a DESTDIR&usr-lib-m32; $LFS/usr/ 275 install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \ 276 $LFS/usr/include/gnu/ 277 ln -svf ..&lib-m32;/ld-linux.so.2 $LFS/lib/ld-linux.so.2</userinput></screen> 278 279 <caution> 280 <para>At this point, it is imperative to stop and ensure that the basic 281 functions (compiling and linking) of the new toolchain are working as 282 expected. To perform a sanity check, run the following commands:</para> 342 283 343 284 <screen><userinput>echo 'int main(){}' > dummy.c 344 285 $LFS_TGT-gcc -m32 dummy.c 345 readelf -l a.out | grep ': /tools'</userinput></screen> 346 347 <para>If everything is working correctly, there should be no errors, 348 and the output of the last command will be of the form:</para> 349 350 <screen><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen> 351 352 <para>Redo test for x32-ABI:</para> 286 readelf -l a.out | grep '/ld-linux'</userinput></screen> 287 288 <para>If everything is working correctly, there should be no errors, 289 and the output of the last command will be of the form:</para> 290 291 <screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen> 292 293 <para>If the output is not shown as above or there was no output at all, 294 then something is wrong. Investigate and retrace the steps to find out 295 where the problem is and correct it. This issue must be resolved before 296 continuing on.</para> 297 298 <para>Once all is well, clean up the test files:</para> 299 300 <screen><userinput>rm -v dummy.c a.out</userinput></screen> 301 302 </caution> 303 304 </sect2><!-- m32 --> 305 306 <!-- - - - - - - - - - --> 307 <!-- Multilib - x32bit --> 308 <!-- - - - - - - - - - --> 309 310 <sect2 arch="ml_x32,ml_all"> 311 <title>Building Glibc - x32bit</title> 312 313 <para>Now recompile for mx32. The extracted source can be 314 reused but needs to cleaned before installing the mx32 315 version of Glibc.</para> 316 317 <para>Clear the build directory and remove artefacts from 318 previous build:</para> 319 320 <screen><userinput remap="pre">make clean 321 find .. -name "*.a" -delete</userinput></screen> 322 323 <para>Configure Glibc for mx32 with the following commands:</para> 324 325 <screen><userinput remap="configure">CC="$LFS_TGT-gcc -mx32" \ 326 CXX="$LFS_TGT-g++ -mx32" \ 327 ../configure \ 328 --prefix=/usr \ 329 --host=$LFS_TGTX32 \ 330 --build=$(../scripts/config.guess) \ 331 --enable-kernel=&min-kernel; \ 332 --with-headers=$LFS/usr/include \ 333 --enable-multi-arch \ 334 --libdir=&usr-lib-mx32; \ 335 --libexecdir=&usr-lib-mx32; \ 336 libc_cv_slibdir=&lib-mx32;</userinput></screen> 337 338 <para>Compile the package:</para> 339 340 <screen><userinput remap="make">make</userinput></screen> 341 342 <para>Install the package:</para> 343 344 <screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install 345 cp -a DESTDIR&lib-mx32;/* $LFS&lib-mx32;/ 346 cp -a DESTDIR&usr-lib-mx32; $LFS/usr/ 347 install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \ 348 $LFS/usr/include/gnu/ 349 ln -svf ..&lib-mx32;/ld-linux-x32.so.2 $LFS/lib/ld-linux-x32.so.2</userinput></screen> 350 351 <caution> 352 <para>At this point, it is imperative to stop and ensure that the basic 353 functions (compiling and linking) of the new toolchain are working as 354 expected. To perform a sanity check, run the following commands:</para> 353 355 354 356 <screen><userinput>echo 'int main(){}' > dummy.c 355 357 $LFS_TGT-gcc -mx32 dummy.c 356 readelf -l a.out | grep ': /tools'</userinput></screen> 357 358 <para>Output should be like:</para> 359 360 <screen><computeroutput>[Requesting program interpreter: /tools/libx32/ld-linux-x32.so.2]</computeroutput></screen> 361 362 <para>If the output is not shown as above or there was no output at all, 363 then something is wrong. Investigate and retrace the steps to find out 364 where the problem is and correct it. This issue must be resolved before 365 continuing on.</para> 366 367 <para>Once all is well, clean up the test files:</para> 358 readelf -l a.out | grep '/ld-linux-x32'</userinput></screen> 359 360 <para>If everything is working correctly, there should be no errors, 361 and the output of the last command will be of the form:</para> 362 363 <screen><computeroutput>[Requesting program interpreter: /lib/ld-linux-x32.so.2]</computeroutput></screen> 364 365 <para>If the output is not shown as above or there was no output at all, 366 then something is wrong. Investigate and retrace the steps to find out 367 where the problem is and correct it. This issue must be resolved before 368 continuing on.</para> 369 370 <para>Once all is well, clean up the test files:</para> 368 371 369 372 <screen><userinput>rm -v dummy.c a.out</userinput></screen> 370 373 371 </caution> 372 </sect2> 373 374 </caution> 375 376 </sect2><!-- mx32 --> 377 374 378 <sect2 role="content"> 375 379 <title/> -
chapter05/introduction.xml
r811b5a39 r6dfcfecc 11 11 <title>Introduction</title> 12 12 13 <para>This chapter shows how to build a minimal Linux system. 14 This system will contain just enough tools to start constructing the final 15 LFS system in <xref linkend="chapter-building-system"/> and allow a working 16 environment with more user convenience than a minimum environment would.</para> 13 <para>This chapter shows how to build a cross-compiler and its associated 14 tools. Although here cross-compilation is faked, the principles are 15 the same as for a real cross-toolchain.</para> 17 16 18 <para>There are two steps in building this minimal system. The first step 19 is to build a new and host-independent toolchain (compiler, assembler, 20 linker, libraries, and a few useful utilities). The second step uses this 21 toolchain to build the other essential tools.</para> 22 23 <para>The files compiled in this chapter will be installed under the 17 <para>The programs compiled in this chapter will be installed under the 24 18 <filename class="directory">$LFS/tools</filename> directory to keep them 25 separate from the files installed in the next chapter and the host26 production directories. Since the packages compiled here are temporary,27 we do not want them to pollute the soon-to-be LFS system.</para>19 separate from the files installed in the following chapters. The libraries, 20 on the other hand, are installed into their final place, since they pertain 21 to the system we want to build.</para> 28 22 29 23 </sect1> -
chapter05/libstdc++.xml
r811b5a39 r6dfcfecc 6 6 ]> 7 7 8 <sect1 id="ch-tools-libstdcpp " role="wrap">9 <?dbhtml filename="gcc-libstdc++ .html"?>8 <sect1 id="ch-tools-libstdcpp-pass1" role="wrap"> 9 <?dbhtml filename="gcc-libstdc++-pass1.html"?> 10 10 11 11 <sect1info condition="script"> … … 15 15 </sect1info> 16 16 17 <title>Libstdc++ from GCC-&gcc-version; </title>17 <title>Libstdc++ from GCC-&gcc-version;, Pass 1</title> 18 18 19 <indexterm zone="ch-tools-libstdcpp ">19 <indexterm zone="ch-tools-libstdcpp-pass1"> 20 20 <primary sortas="a-GCC">GCC</primary> 21 <secondary>tools, libstdc++ </secondary>21 <secondary>tools, libstdc++ pass 1</secondary> 22 22 </indexterm> 23 23 … … 29 29 (part of GCC is written in C++), but we had to defer its installation 30 30 when we built <xref linkend="ch-tools-gcc-pass1"/> 31 because it depends on glibc, which was not yet available in /tools. 31 because it depends on glibc, which was not yet available in the target 32 directory. 32 33 </para> 33 34 … … 37 38 38 39 <seglistitem> 39 <seg>&libstdcpp- ch5-sbu;</seg>40 <seg>&libstdcpp- ch5-du;</seg>40 <seg>&libstdcpp-tmpp1-sbu;</seg> 41 <seg>&libstdcpp-tmpp1-du;</seg> 41 42 </seglistitem> 42 43 </segmentedlist> … … 53 54 </note> 54 55 55 <para>Create a separate build directory for Libstdc++ and enter it:</para>56 <para>Create a separate build directory for libstdc++ and enter it:</para> 56 57 57 58 <screen><userinput remap="pre">mkdir -v build 58 59 cd build</userinput></screen> 59 60 60 <para>Prepare Libstdc++ for compilation:</para>61 <para>Prepare libstdc++ for compilation:</para> 61 62 62 63 <screen><userinput remap="configure">../libstdc++-v3/configure \ 63 64 --host=$LFS_TGT \ 64 --prefix=/tools \ 65 --build=$(../config.guess) \ 66 --prefix=/usr \ 65 67 --disable-multilib \ 66 --disable-nls \<!-- 67 - -disable-libstdcxx-threads \--> 68 --disable-nls \ 68 69 --disable-libstdcxx-pch \ 69 70 --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen> … … 75 76 <term><parameter>--host=...</parameter></term> 76 77 <listitem> 77 <para> Indicates touse the cross compiler we have just built78 <para>Specifies the use the cross compiler we have just built 78 79 instead of the one in <filename>/usr/bin</filename>.</para> 79 80 </listitem> 80 81 </varlistentry> 81 <!-- 82 <varlistentry >83 <term><parameter>- -disable-libstdcxx-threads</parameter></term>82 83 <varlistentry arch="ml_32,ml_x32,ml_all"> 84 <term><parameter>--disable-multilib</parameter></term> 84 85 <listitem> 85 <para>Since gcc-pass1 is built without thread support, the C++ 86 thread library cannot be built either.</para> 86 <para>Even when building the multilib version, this switch is 87 given. This is because the additionally built libraries are 88 not required in this stage and some disk space and compile 89 time can be saved.</para> 87 90 </listitem> 88 91 </varlistentry> 89 --> 92 90 93 <varlistentry> 91 94 <term><parameter>--disable-libstdcxx-pch</parameter></term> … … 99 102 <term><parameter>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</parameter></term> 100 103 <listitem> 101 <para>This is the location where the standard include files are102 s earched by the C++ compiler. In a normal build, this information103 is automatically passed to the Libstdc++ <command>configure</command>104 <para>This is the location where the C++ compiler should search for the 105 standard include files. In a normal build, this information 106 is automatically passed to the libstdc++ <command>configure</command> 104 107 options from the top level directory. In our case, this information 105 108 must be explicitly given.</para> … … 115 118 <para>Install the library:</para> 116 119 117 <screen><userinput remap="install">make install</userinput></screen>120 <screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> 118 121 119 122 </sect2> -
chapter05/linux-headers.xml
r811b5a39 r6dfcfecc 25 25 <title/> 26 26 27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 28 href="../chapter06/linux-headers.xml" 29 xpointer="xpointer(/sect1/sect2[1]/para[1])"/> 27 <para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the 28 kernel's API for use by Glibc.</para> 30 29 31 30 <segmentedlist> … … 34 33 35 34 <seglistitem> 36 <seg>&linux-headers- ch5-sbu;</seg>37 <seg>&linux-headers- ch5-du;</seg>35 <seg>&linux-headers-tmp-sbu;</seg> 36 <seg>&linux-headers-tmp-du;</seg> 38 37 </seglistitem> 39 38 </segmentedlist> … … 61 60 62 61 <screen><userinput remap="make">make headers 63 </userinput><userinput remap="install">cp -rv usr/include/* /tools/include</userinput></screen> 62 find usr/include -name '.*' -delete 63 rm usr/include/Makefile 64 </userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen> 64 65 65 66 </sect2> 66 67 67 <sect2 role="content"> 68 <title/> 69 70 <para>Details on this package are located in 71 <xref linkend="contents-linux-headers" role="."/></para> 68 <sect2 id="contents-linux-headers" role="content"> 69 <title>Contents of Linux API Headers</title> 70 71 <segmentedlist> 72 <segtitle>Installed headers</segtitle> 73 <segtitle>Installed directories</segtitle> 74 75 <seglistitem> 76 <seg>/usr/include/asm/*.h, /usr/include/asm-generic/*.h, 77 /usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/misc/*.h, 78 /usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h, 79 /usr/include/sound/*.h, /usr/include/video/*.h, 80 and /usr/include/xen/*.h</seg> 81 <seg>/usr/include/asm, /usr/include/asm-generic, /usr/include/drm, 82 /usr/include/linux, /usr/include/misc, /usr/include/mtd, 83 /usr/include/rdma, /usr/include/scsi, /usr/include/sound, 84 /usr/include/video, and /usr/include/xen</seg> 85 </seglistitem> 86 </segmentedlist> 87 88 <variablelist> 89 <bridgehead renderas="sect3">Short Descriptions</bridgehead> 90 <?dbfo list-presentation="list"?> 91 <?dbhtml list-presentation="table"?> 92 93 <varlistentry id="asm"> 94 <term><filename class="headerfile">/usr/include/asm/*.h</filename></term> 95 <listitem> 96 <para>The Linux API ASM Headers</para> 97 <indexterm zone="ch-tools-linux-headers asm"> 98 <primary sortas="e-/usr/include/asm/*.h">/usr/include/asm/*.h</primary> 99 </indexterm> 100 </listitem> 101 </varlistentry> 102 103 <varlistentry id="asm-generic"> 104 <term><filename class="headerfile">/usr/include/asm-generic/*.h</filename></term> 105 <listitem> 106 <para>The Linux API ASM Generic Headers</para> 107 <indexterm zone="ch-tools-linux-headers asm-generic"> 108 <primary sortas="e-/usr/include/asm-generic/*.h">/usr/include/asm-generic/*.h</primary> 109 </indexterm> 110 </listitem> 111 </varlistentry> 112 113 <varlistentry id="drm"> 114 <term><filename class="headerfile">/usr/include/drm/*.h</filename></term> 115 <listitem> 116 <para>The Linux API DRM Headers</para> 117 <indexterm zone="ch-tools-linux-headers drm"> 118 <primary sortas="e-/usr/include/drm/*.h">/usr/include/drm/*.h</primary> 119 </indexterm> 120 </listitem> 121 </varlistentry> 122 123 <varlistentry id="linux"> 124 <term><filename class="headerfile">/usr/include/linux/*.h</filename></term> 125 <listitem> 126 <para>The Linux API Linux Headers</para> 127 <indexterm zone="ch-tools-linux-headers linux"> 128 <primary sortas="e-/usr/include/linux/*.h">/usr/include/linux/*.h</primary> 129 </indexterm> 130 </listitem> 131 </varlistentry> 132 133 <varlistentry id="misc"> 134 <term><filename class="headerfile">/usr/include/misc/*.h</filename></term> 135 <listitem> 136 <para>The Linux API Miscellaneous Headers</para> 137 <indexterm zone="ch-tools-linux-headers misc"> 138 <primary sortas="e-/usr/include/misc/*.h">/usr/include/misc/*.h</primary> 139 </indexterm> 140 </listitem> 141 </varlistentry> 142 143 <varlistentry id="mtd"> 144 <term><filename class="headerfile">/usr/include/mtd/*.h</filename></term> 145 <listitem> 146 <para>The Linux API MTD Headers</para> 147 <indexterm zone="ch-tools-linux-headers mtd"> 148 <primary sortas="e-/usr/include/mtd/*.h">/usr/include/mtd/*.h</primary> 149 </indexterm> 150 </listitem> 151 </varlistentry> 152 153 <varlistentry id="rdma"> 154 <term><filename class="headerfile">/usr/include/rdma/*.h</filename></term> 155 <listitem> 156 <para>The Linux API RDMA Headers</para> 157 <indexterm zone="ch-tools-linux-headers rdma"> 158 <primary sortas="e-/usr/include/rdma/*.h">/usr/include/rdma/*.h</primary> 159 </indexterm> 160 </listitem> 161 </varlistentry> 162 163 <varlistentry id="scsi"> 164 <term><filename class="headerfile">/usr/include/scsi/*.h</filename></term> 165 <listitem> 166 <para>The Linux API SCSI Headers</para> 167 <indexterm zone="ch-tools-linux-headers scsi"> 168 <primary sortas="e-/usr/include/scsi/*.h">/usr/include/scsi/*.h</primary> 169 </indexterm> 170 </listitem> 171 </varlistentry> 172 173 <varlistentry id="sound"> 174 <term><filename class="headerfile">/usr/include/sound/*.h</filename></term> 175 <listitem> 176 <para>The Linux API Sound Headers</para> 177 <indexterm zone="ch-tools-linux-headers sound"> 178 <primary sortas="e-/usr/include/sound/*.h">/usr/include/sound/*.h</primary> 179 </indexterm> 180 </listitem> 181 </varlistentry> 182 183 <varlistentry id="video"> 184 <term><filename class="headerfile">/usr/include/video/*.h</filename></term> 185 <listitem> 186 <para>The Linux API Video Headers</para> 187 <indexterm zone="ch-tools-linux-headers video"> 188 <primary sortas="e-/usr/include/video/*.h">/usr/include/video/*.h</primary> 189 </indexterm> 190 </listitem> 191 </varlistentry> 192 193 <varlistentry id="xen"> 194 <term><filename class="headerfile">/usr/include/xen/*.h</filename></term> 195 <listitem> 196 <para>The Linux API Xen Headers</para> 197 <indexterm zone="ch-tools-linux-headers xen"> 198 <primary sortas="e-/usr/include/xen/*.h">/usr/include/xen/*.h</primary> 199 </indexterm> 200 </listitem> 201 </varlistentry> 202 203 </variablelist> 72 204 73 205 </sect2>
Note:
See TracChangeset
for help on using the changeset viewer.