mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-18 19:29:21 +01:00
Text updates for cross2 Chapter 5
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11914 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
ee714d385e
commit
79524a0c69
@ -41,7 +41,7 @@
|
||||
compilation time for a package can be reduced by performing a "parallel
|
||||
make" by either setting an environment variable or telling the
|
||||
<command>make</command> program how many processors are available. For
|
||||
instance, an Intel i5-6500 COU can support four simultaneous processes with:</para>
|
||||
instance, an Intel i5-6500 CPU can support four simultaneous processes with:</para>
|
||||
|
||||
<screen role="nodump"><userinput>export MAKEFLAGS='-j4'</userinput></screen>
|
||||
|
||||
|
@ -63,13 +63,10 @@ cd build</userinput></screen>
|
||||
to be of any use, measure the time it takes to build this package from
|
||||
the configuration, up to and including the first install. To achieve
|
||||
this easily, wrap the commands in a <command>time</command>
|
||||
command like this: <userinput>time { ./configure ... && ...
|
||||
command like this: <userinput>time { ./configure ... && make
|
||||
&& make install; }</userinput>.</para>
|
||||
</note>
|
||||
<!--
|
||||
<note><para>The approximate build SBU values and required disk space
|
||||
in Chapter 5 does not include test suite data.</para></note>
|
||||
-->
|
||||
|
||||
<para>Now prepare Binutils for compilation:</para>
|
||||
|
||||
<screen><userinput remap="configure">../configure --prefix=$LFS/tools \
|
||||
@ -85,7 +82,7 @@ cd build</userinput></screen>
|
||||
<term><parameter>--prefix=$LFS/tools</parameter></term>
|
||||
<listitem>
|
||||
<para>This tells the configure script to prepare to install the
|
||||
Binutils programs in the <filename
|
||||
binutils programs in the <filename
|
||||
class="directory">$LFS/tools</filename> directory.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -97,22 +94,14 @@ cd build</userinput></screen>
|
||||
$LFS for the target system libraries as needed.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<!--
|
||||
<varlistentry>
|
||||
<term><parameter>- -with-lib-path=/tools/lib</parameter></term>
|
||||
<listitem>
|
||||
<para>This specifies which library path the linker should be
|
||||
configured to use.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
-->
|
||||
|
||||
<varlistentry>
|
||||
<term><envar>--target=$LFS_TGT</envar></term>
|
||||
<listitem>
|
||||
<para>Because the machine description in the <envar>LFS_TGT</envar>
|
||||
variable is slightly different than the value returned by the
|
||||
<command>config.guess</command> script, this switch will tell the
|
||||
<command>configure</command> script to adjust Binutil's build system
|
||||
<command>configure</command> script to adjust binutil's build system
|
||||
for building a cross linker. </para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -132,36 +132,45 @@ cd build</userinput></screen>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>--disable-shared</parameter></term>
|
||||
<term><parameter>--enable-initfini-array</parameter></term>
|
||||
<listitem>
|
||||
<para>This switch forces GCC to link its internal libraries
|
||||
statically. We need this because the shared libraries require glibc,
|
||||
which is not yet installed on the target system.</para>
|
||||
<para>This switch forces the use of some internal data structures
|
||||
that are needed but cannot be detected when building a cross
|
||||
compiler.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>--disable-decimal-float, --disable-threads,
|
||||
--disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->
|
||||
--disable-libquadmath, --disable-libssp, --disable-libvtv,
|
||||
--disable-libstdcxx</parameter></term>
|
||||
<term><parameter>--disable-shared</parameter></term>
|
||||
<listitem>
|
||||
<para>These switches disable support for the decimal floating point
|
||||
extension, threading, libatomic, libgomp, <!--libmpx, --> libquadmath, libssp,
|
||||
libvtv, and the C++ standard library respectively. These features
|
||||
will fail to compile when building a cross-compiler and are not
|
||||
necessary for the task of cross-compiling the temporary libc.</para>
|
||||
<para>This switch forces GCC to link its internal libraries
|
||||
statically. We need this because the shared libraries require glibc,
|
||||
which is not yet installed on the target system.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>--disable-multilib</parameter></term>
|
||||
<listitem>
|
||||
<para>On x86_64, LFS does not yet support a multilib configuration.
|
||||
<para>On x86_64, LFS does not support a multilib configuration.
|
||||
This switch is harmless for x86.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>--disable-decimal-float, --disable-threads,
|
||||
--disable-libatomic, --disable-libgomp,
|
||||
--disable-libquadmath, --disable-libssp, --disable-libvtv,
|
||||
--disable-libstdcxx</parameter></term>
|
||||
<listitem>
|
||||
<para>These switches disable support for the decimal floating point
|
||||
extension, threading, libatomic, libgomp, libquadmath, libssp,
|
||||
libvtv, and the C++ standard library respectively. These features
|
||||
will fail to compile when building a cross-compiler and are not
|
||||
necessary for the task of cross-compiling the temporary libc.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>--enable-languages=c,c++</parameter></term>
|
||||
<listitem>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<listitem>
|
||||
<para>Several of the packages are patched before compilation, but only when
|
||||
the patch is needed to circumvent a problem. A patch is often needed in
|
||||
both this and the next chapter, but sometimes in only one or the other.
|
||||
both this and the following chapters, but sometimes in only one location.
|
||||
Therefore, do not be concerned if instructions for a downloaded patch seem
|
||||
to be missing. Warning messages about <emphasis>offset</emphasis> or
|
||||
<emphasis>fuzz</emphasis> may also be encountered when applying a patch. Do
|
||||
@ -93,8 +93,8 @@
|
||||
<orderedlist numeration="loweralpha" spacing="compact">
|
||||
<listitem>
|
||||
<para>Using the <command>tar</command> program, extract the package
|
||||
to be built. In Chapter 5, ensure you are the <emphasis>lfs</emphasis>
|
||||
user when extracting the package.</para>
|
||||
to be built. In Chapters 5 and 6, ensure you are
|
||||
the <emphasis>lfs</emphasis> user when extracting the package.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Change to the directory created when the package was
|
||||
|
@ -211,14 +211,14 @@ readelf -l a.out | grep '/ld-linux'</userinput></screen>
|
||||
|
||||
</caution>
|
||||
|
||||
<note><para>Building packages in the next sections will serve as an
|
||||
<note><para>Building packages in the next chapter will serve as an
|
||||
additional check that the toolchain has been built properly. If some
|
||||
package, especially binutils-pass2 or gcc-pass2, fails to build, it is
|
||||
an indication that something has gone wrong with the
|
||||
previous Binutils, GCC, or Glibc installations.</para></note>
|
||||
|
||||
<para>Now that our cross-toolchain is complete, finalize the installation
|
||||
of the limits.h header. For doing so, run an utility provided by the GCC
|
||||
of the limits.h header. For doing so, run a utility provided by the GCC
|
||||
developers:</para>
|
||||
|
||||
<screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen>
|
||||
|
@ -53,12 +53,12 @@
|
||||
<filename>gcc-&gcc-version;</filename> directory.</para>
|
||||
</note>
|
||||
|
||||
<para>Create a separate build directory for Libstdc++ and enter it:</para>
|
||||
<para>Create a separate build directory for libstdc++ and enter it:</para>
|
||||
|
||||
<screen><userinput remap="pre">mkdir -v build
|
||||
cd build</userinput></screen>
|
||||
|
||||
<para>Prepare Libstdc++ for compilation:</para>
|
||||
<para>Prepare libstdc++ for compilation:</para>
|
||||
|
||||
<screen><userinput remap="configure">../libstdc++-v3/configure \
|
||||
--host=$LFS_TGT \
|
||||
@ -75,7 +75,7 @@ cd build</userinput></screen>
|
||||
<varlistentry>
|
||||
<term><parameter>--host=...</parameter></term>
|
||||
<listitem>
|
||||
<para>Indicates to use the cross compiler we have just built
|
||||
<para>Specifies the use the cross compiler we have just built
|
||||
instead of the one in <filename>/usr/bin</filename>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -91,9 +91,9 @@ cd build</userinput></screen>
|
||||
<varlistentry>
|
||||
<term><parameter>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</parameter></term>
|
||||
<listitem>
|
||||
<para>This is the location where the standard include files are
|
||||
searched by the C++ compiler. In a normal build, this information
|
||||
is automatically passed to the Libstdc++ <command>configure</command>
|
||||
<para>This is the location where the C++ compiler should search for the
|
||||
standard include files. In a normal build, this information
|
||||
is automatically passed to the libstdc++ <command>configure</command>
|
||||
options from the top level directory. In our case, this information
|
||||
must be explicitly given.</para>
|
||||
</listitem>
|
||||
|
@ -16,13 +16,14 @@
|
||||
clearer after performing an actual build. This section can be referred
|
||||
to at any time during the process.</para>
|
||||
|
||||
<para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to
|
||||
produce a temporary area that contains a known-good set of tools that can be
|
||||
isolated from the host system. By using <command>chroot</command>, the
|
||||
commands in the remaining chapters will be contained within that environment,
|
||||
ensuring a clean, trouble-free build of the target LFS system. The build
|
||||
process has been designed to minimize the risks for new readers and to provide
|
||||
the most educational value at the same time.</para>
|
||||
<para>The overall goal of this chapter and <xref
|
||||
linkend="chapter-temporary-tools"/> is to produce a temporary area that
|
||||
contains a known-good set of tools that can be isolated from the host system.
|
||||
By using <command>chroot</command>, the commands in the remaining chapters
|
||||
will be contained within that environment, ensuring a clean, trouble-free
|
||||
build of the target LFS system. The build process has been designed to
|
||||
minimize the risks for new readers and to provide the most educational value
|
||||
at the same time.</para>
|
||||
|
||||
<para>The build process is based on the process of
|
||||
<emphasis>cross-compilation</emphasis>. Cross-compilation is normally used
|
||||
@ -143,7 +144,7 @@
|
||||
appearing, that proved insufficient. The word <quote>triplet</quote>
|
||||
remained. A simple way to determine your machine triplet is to run
|
||||
the <command>config.guess</command>
|
||||
script that comes with the source for many packages. Unpack the Binutils
|
||||
script that comes with the source for many packages. Unpack the binutils
|
||||
sources and run the script: <userinput>./config.guess</userinput> and note
|
||||
the output. For example, for a 32-bit Intel processor the
|
||||
output will be <emphasis>i686-pc-linux-gnu</emphasis>. On a 64-bit
|
||||
@ -151,7 +152,7 @@
|
||||
|
||||
<para>Also be aware of the name of the platform's dynamic linker, often
|
||||
referred to as the dynamic loader (not to be confused with the standard
|
||||
linker <command>ld</command> that is part of Binutils). The dynamic linker
|
||||
linker <command>ld</command> that is part of binutils). The dynamic linker
|
||||
provided by Glibc finds and loads the shared libraries needed by a
|
||||
program, prepares the program to run, and then runs it. The name of the
|
||||
dynamic linker for a 32-bit Intel machine will be <filename
|
||||
@ -168,9 +169,9 @@
|
||||
<para>In order to fake a cross compilation, the name of the host triplet
|
||||
is slightly adjusted by changing the "vendor" field in the
|
||||
<envar>LFS_TGT</envar> variable. We also use the
|
||||
<parameter>--with-sysroot</parameter> when building the cross linker and
|
||||
cross compiler, to tell them where to find the needed host files. This
|
||||
ensures none of the other programs built in <xref
|
||||
<parameter>--with-sysroot</parameter> option when building the cross linker and
|
||||
cross compiler to tell them where to find the needed host files. This
|
||||
ensures that none of the other programs built in <xref
|
||||
linkend="chapter-temporary-tools"/> can link to libraries on the build
|
||||
machine. Only two stages are mandatory, and one more for tests:</para>
|
||||
|
||||
@ -215,7 +216,7 @@
|
||||
internal library is named libgcc, and must be linked to the glibc
|
||||
library to be fully functional! Furthermore, the standard library for
|
||||
C++ (libstdc++) also needs being linked to glibc. The solution
|
||||
to this chicken and egg problem is to first build a degraded cc1+libgcc,
|
||||
to this chicken and egg problem is to first build a degraded cc1 based libgcc,
|
||||
lacking some fuctionalities such as threads and exception handling, then
|
||||
build glibc using this degraded compiler (glibc itself is not
|
||||
degraded), then build libstdc++. But this last library will lack the
|
||||
@ -225,8 +226,8 @@
|
||||
paragraph is that cc1 is unable to build a fully functional libstdc++, but
|
||||
this is the only compiler available for building the C/C++ libraries
|
||||
during stage 2! Of course, the compiler built during stage 2, cc-lfs,
|
||||
would be able to build those libraries, but (i) the build system of
|
||||
gcc does not know that it is usable on pc, and (ii) using it on pc
|
||||
would be able to build those libraries, but (1) the build system of
|
||||
gcc does not know that it is usable on pc, and (2) using it on pc
|
||||
would be at risk of linking to the pc libraries, since cc-lfs is a native
|
||||
compiler. So we have to build libstdc++ later, in chroot.</para>
|
||||
|
||||
@ -306,17 +307,18 @@ checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld</compute
|
||||
package—it is very self-sufficient in terms of its build machinery
|
||||
and generally does not rely on toolchain defaults.</para>
|
||||
|
||||
<para>As said above, the standard C++ library is compiled next, followed
|
||||
by all the programs that need themselves to be built. The install step
|
||||
uses the <envar>DESTDIR</envar> variable to have the programs land into
|
||||
the LFS filesystem.</para>
|
||||
<para>As said above, the standard C++ library is compiled next, followed in
|
||||
Chapter 6 by all the programs that need themselves to be built. The install
|
||||
step of libstdc++ uses the <envar>DESTDIR</envar> variable to have the
|
||||
programs land into the LFS filesystem.</para>
|
||||
|
||||
<para>Then the native lfs compiler is built. First Binutils Pass 2, with
|
||||
the same <envar>DESTDIR</envar> install as the other programs, then the
|
||||
second pass of GCC, omitting libstdc++ and other non-important libraries.
|
||||
Due to some weird logic in GCC's configure script,
|
||||
<envar>CC_FOR_TARGET</envar> ends up as <command>cc</command> when host
|
||||
is the same as target, but is different from build. This is why
|
||||
<para>In Chapter 7 the native lfs compiler is built. First binutils-pass2,
|
||||
with the same <envar>DESTDIR</envar> install as the other programs is
|
||||
built, and then the second pass of GCC is constructed, omitting libstdc++
|
||||
and other non-important libraries. Due to some weird logic in GCC's
|
||||
configure script, <envar>CC_FOR_TARGET</envar> ends up as
|
||||
<command>cc</command> when the host is the same as the target, but is
|
||||
different from the build system. This is why
|
||||
<parameter>CC_FOR_TARGET=$LFS_TGT-gcc</parameter> is put explicitely into
|
||||
the configure options.</para>
|
||||
|
||||
|
@ -342,7 +342,7 @@ div.important em, div.warning em, div.caution em {
|
||||
margin-bottom: .3em;
|
||||
}
|
||||
|
||||
.table table {
|
||||
.table table, .informaltable {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user