diff options
author | Matthew Burgess <matthew@linuxfromscratch.org> | 2004-05-03 10:59:46 +0000 |
---|---|---|
committer | Matthew Burgess <matthew@linuxfromscratch.org> | 2004-05-03 10:59:46 +0000 |
commit | 673b0d84ba9591e07c0bdf0ee49d92eba10f502c (patch) | |
tree | 129e27a1450727b440da4378e0117a468eb9c25e /chapter05 | |
parent | 287ea55da70ceb1f0990554b7db921d525fef816 (diff) |
* Merged newxml into HEAD
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3435 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter05')
31 files changed, 1068 insertions, 773 deletions
diff --git a/chapter05/adjusting.xml b/chapter05/adjusting.xml new file mode 100644 index 000000000..b18b6f132 --- /dev/null +++ b/chapter05/adjusting.xml @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> +<sect1 id="ch-tools-adjusting"> +<title>Adjusting the toolchain</title> +<?dbhtml filename="adjusting.html"?> + +<para>Now that the temporary C libraries have been installed, we want all +the tools compiled in the rest of this chapter to be linked against these +libraries. To accomplish this, we need to adjust the linker and the compiler's +specs file. Some people would say that it is <emphasis><quote>black magic juju +below this line</quote></emphasis>, but it is really very simple.</para> + +<para>First install the adjusted linker (adjusted at the end of the first pass +of Binutils) by running the following command from within +the <filename class="directory">binutils-build</filename> directory:</para> + +<screen><userinput>make -C ld install</userinput></screen> + +<para>From this point onwards everything will link <emphasis>only</emphasis> +against the libraries in <filename>/tools/lib</filename>.</para> + +<note><para>If you somehow missed the earlier warning to retain the Binutils +source and build directories from the first pass or otherwise accidentally +deleted them or just don't have access to them, don't worry, all is not lost. +Just ignore the above command. The result is a small chance of the subsequent +testing programs linking against libraries on the host. This is not ideal, but +it's not a major problem. The situation is corrected when we install the +second pass of Binutils a bit further on.</para></note> + +<para>Now that the adjusted linker is installed, you have to +<emphasis>remove</emphasis> the Binutils build and source directories.</para> + +<para>The next thing to do is to amend our GCC specs file so that it points +to the new dynamic linker. A simple sed will accomplish this:</para> + +<!-- Ampersands are needed to allow cut and paste --> + +<screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs && +sed -e 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2@g' \ + $SPECFILE > tempspecfile && +mv -f tempspecfile $SPECFILE && +unset SPECFILE</userinput></screen> + +<para>We recommend that you cut-and-paste the above rather than try and type it +all in. Or you can edit the specs file by hand if you want to: just replace the +occurrence of <quote>/lib/ld-linux.so.2</quote> with +<quote>/tools/lib/ld-linux.so.2</quote>. Be sure to visually inspect the specs +file to verify the intended change was actually made.</para> + +<important><para>If you are working on a platform where the name of the dynamic +linker is something other than <filename>ld-linux.so.2</filename>, you +<emphasis>must</emphasis> replace <filename>ld-linux.so.2</filename> with the +name of your platform's dynamic linker in the above commands. Refer back to +<xref linkend="ch-tools-toolchaintechnotes"/> if necessary.</para></important> + +<para>Lastly, there is a possibility that some include files from the host +system have found their way into GCC's private include dir. This can happen +because of GCC's <quote>fixincludes</quote> process which runs as part of the +GCC build. We'll explain more about this further on in this chapter. For now, +run the following commands to eliminate this possibility:</para> + +<screen><userinput>rm -f /tools/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen> + + +<caution><para>It is imperative at this point to stop and ensure that the basic +functions (compiling and linking) of the new toolchain are working as expected. +For this we are going to perform a simple sanity check:</para> + +<screen><userinput>echo 'main(){}' > dummy.c +cc dummy.c +readelf -l a.out | grep ': /tools'</userinput></screen> + +<para>If everything is working correctly, there should be no errors, and the +output of the last command will be (allowing for platform specific differences +in dynamic linker name):</para> + +<blockquote><screen>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</screen></blockquote> + +<para>Note especially that <filename class="directory">/tools/lib</filename> +appears as the prefix of our dynamic linker.</para> + +<para>If you did not receive the output +as shown above, or received no output at all, then something is seriously wrong. +You will need to investigate and retrace your steps to find out where the +problem is and correct it. There is no point in continuing until this is done. +First, redo the sanity check using <command>gcc</command> instead of +<command>cc</command>. If this works it means the +<filename class="symlink">/tools/bin/cc</filename> symlink is missing. Revisit +<xref linkend="ch-tools-gcc-pass1"/> and fix the symlink. Second, ensure your PATH +is correct. You can check this by running <userinput>echo $PATH</userinput> and +verifying that <filename class="directory">/tools/bin</filename> is at the head +of the list. If the PATH is wrong it could mean you're not logged in as user +<emphasis>lfs</emphasis> or something went wrong back in +<xref linkend="ch-tools-settingenviron"/>. Third, something may have gone wrong with +the specs file amendment above. In this case redo the specs file amendment +ensuring to cut-and-paste the commands as was recommended.</para> + +<para>Once you are satisfied that all is well, clean up the test files:</para> + +<screen><userinput>rm dummy.c a.out</userinput></screen> +</caution> + + +</sect1> diff --git a/chapter05/bash.xml b/chapter05/bash.xml index 45e12e64e..a2ec5683e 100644 --- a/chapter05/bash.xml +++ b/chapter05/bash.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-bash"> -<title>Installing Bash-&bash-version;</title> -<?dbhtml filename="bash.html" dir="chapter05"?> +<title>Bash-&bash-version;</title> +<?dbhtml filename="bash.html"?> -<screen>&buildtime; &bash-time-tools; -&diskspace; &bash-compsize-tools;</screen> +<indexterm zone="ch-tools-bash"> +<primary sortas="a-Bash">Bash</primary> +<secondary>tools</secondary></indexterm> -&aa-bash-down; -&aa-bash-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bash.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 1.2 SBU +&diskspace; 27 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bash.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Bash</title> @@ -16,7 +25,7 @@ <para>Bash contains several known bugs. Fix these with the following patch:</para> -<screen><userinput>patch -Np1 -i ../&bash-patch;</userinput></screen> +<screen><userinput>patch -Np1 -i ../bash-&bash-version;-2.patch</userinput></screen> <para>Now prepare Bash for compilation:</para> @@ -40,9 +49,8 @@ for a shell:</para> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-bash"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/binutils-pass1.xml b/chapter05/binutils-pass1.xml index 13eac6710..3b362c533 100644 --- a/chapter05/binutils-pass1.xml +++ b/chapter05/binutils-pass1.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-binutils-pass1"> -<title>Installing Binutils-&binutils-version; - Pass 1</title> -<?dbhtml filename="binutils-pass1.html" dir="chapter05"?> +<title>Binutils-&binutils-version; - Pass 1</title> +<?dbhtml filename="binutils-pass1.html"?> -<screen>&buildtime; &binutils-time-tools-pass1; -&diskspace; &binutils-compsize-tools-pass1;</screen> +<indexterm zone="ch-tools-binutils-pass1"> +<primary sortas="a-Binutils">Binutils</primary> +<secondary>tools, pass 1</secondary></indexterm> -&aa-binutils-down; -&aa-binutils-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/binutils.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 1.0 SBU +&diskspace; 194 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/binutils.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Binutils</title> @@ -21,7 +30,7 @@ assembler to determine which of their own features to enable.</para> optimization flags (including the <emphasis>-march</emphasis> and <emphasis>-mcpu</emphasis> options). Therefore, if you have defined any environment variables that override default optimizations, such as CFLAGS and -CXXFLAGS, we recommend unsetting them when building Binutils.</para> +CXXFLAGS, we recommend un-setting them when building Binutils.</para> <para>The Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory:</para> @@ -31,14 +40,14 @@ cd ../binutils-build</userinput></screen> <note><para>If you want the SBU values listed in the rest of the book to be of any use, you will have to measure the time it takes to build this package -- -from the configuration upto and including the first install. To achieve this +from the configuration up to and including the first install. To achieve this easily, you could wrap the four commands in a <command>time</command> command like this: <userinput>time { ./configure ... && ... && ... && make install; }</userinput>.</para></note> <para>Now prepare Binutils for compilation:</para> -<screen><userinput>../&binutils-dir;/configure --prefix=/tools --disable-nls</userinput></screen> +<screen><userinput>../binutils-&binutils-version;/configure --prefix=/tools --disable-nls</userinput></screen> <para>The meaning of the configure options:</para> @@ -79,11 +88,11 @@ yet in place. And there would be little point in running the tests anyhow, since the programs from this first pass will soon be replaced by those from the second.</para> -<para>And install the package:</para> +<para>Now install the package:</para> <screen><userinput>make install</userinput></screen> -<para>Now prepare the linker for the "Adjusting" phase later on:</para> +<para>Now prepare the linker for the <quote>Adjusting</quote> phase later on:</para> <screen><userinput>make -C ld clean make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib</userinput></screen> @@ -92,8 +101,7 @@ make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib</userinput></screen> <itemizedlist> <listitem><para><userinput>-C ld clean</userinput>: This tells the make program -to remove all the compiled files in the <filename -class="directory">ld</filename> subdirectory.</para></listitem> +to remove all the compiled files in the <filename class="directory">ld</filename> subdirectory.</para></listitem> <listitem><para><userinput>-C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib</userinput>: This option rebuilds everything in the @@ -104,21 +112,16 @@ specifies the linker's default library search path. You will see how this preparation is used later on in the chapter.</para></listitem> </itemizedlist> -<!-- HACK - Force some whitespace to appease tidy --> -<literallayout></literallayout> <warning><para><emphasis>Do not yet remove</emphasis> the Binutils build and source directories. You will need them again in their current state a bit further on in this chapter.</para></warning> -<!-- HACK - Force some whitespace to appease tidy --> -<literallayout></literallayout> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-binutils"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/binutils-pass2.xml b/chapter05/binutils-pass2.xml index 2ccd0bf68..32c749b77 100644 --- a/chapter05/binutils-pass2.xml +++ b/chapter05/binutils-pass2.xml @@ -1,14 +1,19 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-binutils-pass2"> -<title>Installing Binutils-&binutils-version; - Pass 2</title> -<?dbhtml filename="binutils-pass2.html" dir="chapter05"?> +<title>Binutils-&binutils-version; - Pass 2</title> +<?dbhtml filename="binutils-pass2.html"?> -<screen>&buildtime; &binutils-time-tools-pass2; -&diskspace; &binutils-compsize-tools-pass2;</screen> +<indexterm zone="ch-tools-binutils-pass2"> +<primary sortas="a-Binutils">Binutils</primary> +<secondary>tools, pass 2</secondary></indexterm> -&aa-binutils-down; -&aa-binutils-dep; +<screen>&buildtime; 1.5 SBU +&diskspace; 108 MB</screen> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Re-installation of Binutils</title> @@ -20,8 +25,8 @@ cd ../binutils-build</userinput></screen> <para>Now prepare Binutils for compilation:</para> -<screen><userinput>../&binutils-dir;/configure --prefix=/tools \ - --enable-shared --with-lib-path=/tools/lib</userinput></screen> +<screen><userinput>../binutils-&binutils-version;/configure --prefix=/tools \ + --enable-shared --with-lib-path=/tools/lib</userinput></screen> <para>The meaning of the new configure option:</para> @@ -64,21 +69,16 @@ chapter:</para> <screen><userinput>make -C ld clean make -C ld LIB_PATH=/usr/lib:/lib</userinput></screen> -<!-- HACK - Force some whitespace to appease tidy --> -<literallayout></literallayout> <warning><para><emphasis>Do not yet remove</emphasis> the Binutils source and build directories. You will need these directories again in the next chapter in the state they are in now.</para></warning> -<!-- HACK - Force some whitespace to appease tidy --> -<literallayout></literallayout> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-binutils"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/bzip2.xml b/chapter05/bzip2.xml index 72cc0310c..11b45b599 100644 --- a/chapter05/bzip2.xml +++ b/chapter05/bzip2.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-bzip2"> -<title>Installing Bzip2-&bzip2-version;</title> -<?dbhtml filename="bzip2.html" dir="chapter05"?> +<title>Bzip2-&bzip2-version;</title> +<?dbhtml filename="bzip2.html"?> -<screen>&buildtime; &bzip2-time-tools; -&diskspace; &bzip2-compsize-tools;</screen> +<indexterm zone="ch-tools-bzip2"> +<primary sortas="a-Bzip2">Bzip2</primary> +<secondary>tools</secondary></indexterm> -&aa-bzip2-down; -&aa-bzip2-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bzip2.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.1 SBU +&diskspace; 2.5 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bzip2.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Bzip2</title> @@ -20,9 +29,8 @@ script. Compile and install it with a straightforward:</para> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-bzip2"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml index f8724b46b..9a939e00e 100644 --- a/chapter05/chapter05.xml +++ b/chapter05/chapter05.xml @@ -1,428 +1,42 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <chapter id="chapter-temporary-tools" xreflabel="Chapter 5"> +<?dbhtml dir="chapter05"?> <title>Constructing a temporary system</title> -<?dbhtml filename="chapter05.html" dir="chapter05"?> - - -<sect1 id="ch-tools-introduction"> -<title>Introduction</title> -<?dbhtml filename="introduction.html" dir="chapter05"?> - -<para>In this chapter we will compile and install a minimal -Linux system. This system will contain just enough tools to be able -to start constructing the final LFS system in the next chapter.</para> - -<para>The building of this minimal system is done in two steps: first we -build a brand-new and host-independent toolchain (compiler, assembler, -linker and libraries), and then use this to build all the other essential -tools.</para> - -<para>The files compiled in this chapter will be installed under the -<filename class="directory">$LFS/tools</filename> directory -to keep them separate from the files installed in the next chapter. -Since the packages compiled here are merely temporary, we don't want -them to pollute the soon-to-be LFS system.</para> - -<para>Before issuing the build instructions for a package you are expected to -have already unpacked it as user <emphasis>lfs</emphasis>, and to have -performed a <userinput>cd</userinput> into the created directory. The build -instructions assume that you are using the <command>bash</command> -shell.</para> - -<para>Several of the packages are patched before compilation, but only when -the patch is needed to circumvent a problem. Often the patch is needed in -both this and the next chapter, but sometimes in only one of them. Therefore, -don't worry when instructions for a downloaded patch seem to be missing. Also, -when applying a patch, you'll occasionally see warning messages about -<emphasis>offset</emphasis> or <emphasis>fuzz</emphasis>. These warnings are -nothing to worry about, as the patch was still successfully applied.</para> - -<para>During the compilation of most packages you will see many warnings -scroll by on your screen. These are normal and can safely be ignored. They are -just what they say they are: warnings -- mostly about deprecated, but not -invalid, use of the C or C++ syntax. It's just that C standards have changed -rather often and some packages still use the older standard, which is not -really a problem.</para> - -<para>After installing each package you should delete its source and build -directories, <emphasis>unless</emphasis> told otherwise. Deleting the sources -saves space, but also prevents misconfiguration when the same package is -reinstalled further on. Only for three packages you will need to keep the -source and build directories around for a while, so their contents can be used -by later commands. Do not miss the reminders.</para> - -</sect1> - - -<sect1 id="tools-technicalnotes"> -<title>Technical notes</title> -<?dbhtml filename="technicalnotes.html" dir="chapter05"?> - -<para>This section attempts to explain some of the rationale and technical -details behind the overall build method. It's not essential that you understand -everything here immediately. Most of it will make sense once you have performed -an actual build. Feel free to refer back here at any time.</para> - -<para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to provide a sane, -temporary environment that we can chroot into, and from which we can produce a -clean, trouble-free build of the target LFS system in -<xref linkend="chapter-building-system"/>. Along the way, we attempt to divorce ourselves -from the host system as much as possible, and in so doing build a -self-contained and self-hosted toolchain. It should be noted that the -build process has been designed in such a way so as to minimize the risks for -new readers and provide maximum educational value at the same time. In other -words, more advanced techniques could be used to build the system.</para> - -<important> -<para>Before continuing, you really should be aware of the name of your working -platform, often also referred to as the <emphasis>target triplet</emphasis>. For -many folks the target triplet will probably be -<emphasis>i686-pc-linux-gnu</emphasis>. A simple way to determine your target -triplet is to run the <filename>config.guess</filename> 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.</para> - -<para>You'll also need to be aware of the name of your platform's -<emphasis>dynamic linker</emphasis>, often also referred to as the -<emphasis>dynamic loader</emphasis>, not to be confused with the standard linker -<emphasis>ld</emphasis> that is part of Binutils. The dynamic linker is provided -by Glibc and has the job of finding and loading the shared libraries needed by a -program, preparing the program to run and then running it. For most folks the -name of the dynamic linker will be <emphasis>ld-linux.so.2</emphasis>. On -platforms that are less prevalent, the name might be -<emphasis>ld.so.1</emphasis> and newer 64 bit platforms might even have -something completely different. You should be able to determine the name -of your platform's dynamic linker by looking in the -<filename class="directory">/lib</filename> directory on your host system. A -surefire way is to inspect a random binary from your host system by running: -<userinput>readelf -l <name of binary> | grep interpreter</userinput> -and noting the output. The authoritative reference covering all platforms is in -the <filename>shlib-versions</filename> file in the root of the Glibc source -tree.</para> -</important> - -<para>Some key technical points of how the <xref linkend="chapter-temporary-tools"/> build -method works:</para> - -<itemizedlist> -<listitem><para>Similar in principle to cross compiling whereby tools installed -into the same prefix work in cooperation and thus utilize a little GNU -"magic".</para></listitem> - -<listitem><para>Careful manipulation of the standard linker's library search -path to ensure programs are linked only against libraries we -choose.</para></listitem> - -<listitem><para>Careful manipulation of <command>gcc</command>'s -<emphasis>specs</emphasis> file to tell the compiler which target dynamic -linker will be used.</para></listitem> -</itemizedlist> - -<para>Binutils is installed first because both GCC and Glibc perform various -feature tests on the assembler and linker during their respective runs of -<command>./configure</command> to determine which software features to enable -or disable. This is more important than one might first realize. An incorrectly -configured GCC or Glibc can result in a subtly broken toolchain where the impact -of such breakage might not show up until near the end of the build of a whole -distribution. Thankfully, a test suite failure will usually alert us before too -much time is wasted.</para> - -<para>Binutils installs its assembler and linker into two locations, -<filename class="directory">/tools/bin</filename> and -<filename class="directory">/tools/$TARGET_TRIPLET/bin</filename>. In reality, -the tools in one location are hard linked to the other. An important facet of -the linker is its library search order. Detailed information can be obtained -from <command>ld</command> by passing it the <emphasis>--verbose</emphasis> -flag. For example: <command>ld --verbose | grep SEARCH</command> will -show you the current search paths and their order. You can see what files are -actually linked by <command>ld</command> by compiling a dummy program and -passing the <emphasis>--verbose</emphasis> switch to the linker. For example: -<command>gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded</command> -will show you all the files successfully opened during the linking.</para> - -<para>The next package installed is GCC and during its run of -<command>./configure</command> you'll see, for example:</para> - -<blockquote><screen>checking what assembler to use... /tools/i686-pc-linux-gnu/bin/as -checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld</screen></blockquote> - -<para>This is important for the reasons mentioned above. It also demonstrates -that GCC's configure script does not search the PATH directories to find which -tools to use. However, during the actual operation of <command>gcc</command> -itself, the same search paths are not necessarily used. You can find out which -standard linker <command>gcc</command> will use by running: -<command>gcc -print-prog-name=ld</command>. -Detailed information can be obtained from <command>gcc</command> by passing -it the <emphasis>-v</emphasis> flag while compiling a dummy program. For -example: <command>gcc -v dummy.c</command> will show you detailed -information about the preprocessor, compilation and assembly stages, including -<command>gcc</command>'s include search paths and their order.</para> - -<para>The next package installed is Glibc. The most important considerations for -building Glibc are the compiler, binary tools and kernel headers. The compiler -is generally no problem as Glibc will always use the <command>gcc</command> -found in a PATH directory. The binary tools and kernel headers can be a little -more troublesome. Therefore we take no risks and use the available configure -switches to enforce the correct selections. After the run of -<command>./configure</command> you can check the contents of the -<filename>config.make</filename> file in the -<filename class="directory">glibc-build</filename> directory for all the -important details. You'll note some interesting items like the use of -<emphasis>CC="gcc -B/tools/bin/"</emphasis> to control which binary tools are -used, and also the use of the <emphasis>-nostdinc</emphasis> and -<emphasis>-isystem</emphasis> flags to control the compiler's include search -path. These items help to highlight an important aspect of the Glibc package: -it is very self-sufficient in terms of its build machinery and generally does -not rely on toolchain defaults.</para> - -<para>After the Glibc installation, we make some adjustments to ensure that -searching and linking take place only within our <filename>/tools</filename> -prefix. We install an adjusted <command>ld</command>, which has a hard-wired -search path limited to <filename class="directory">/tools/lib</filename>. Then -we amend <command>gcc</command>'s specs file to point to our new dynamic -linker in <filename class="directory">/tools/lib</filename>. This last step is -<emphasis>vital</emphasis> to the whole process. As mentioned above, a -hard-wired path to a dynamic linker is embedded into every ELF shared -executable. You can inspect this by running: -<command>readelf -l <name of binary> | grep interpreter</command>. -By amending <command>gcc</command>'s specs file, we are ensuring that every -program compiled from here through the end of this chapter will use our new -dynamic linker in <filename class="directory">/tools/lib</filename>.</para> - -<para>The need to use the new dynamic linker is also the reason why we apply the -Specs patch for the second pass of GCC. Failure to do so will result in the GCC -programs themselves having the name of the dynamic linker from the host system's -<filename class="directory">/lib</filename> directory embedded into them, which -would defeat our goal of getting away from the host.</para> - -<para>During the second pass of Binutils, we are able to utilize the -<emphasis>--with-lib-path</emphasis> configure switch to control -<command>ld</command>'s library search path. From this point onwards, the -core toolchain is self-contained and self-hosted. The remainder of the -<xref linkend="chapter-temporary-tools"/> packages all build against the new Glibc in -<filename class="directory">/tools</filename> and all is well.</para> - -<para>Upon entering the chroot environment in <xref linkend="chapter-building-system"/>, the -first major package we install is Glibc, due to its self-sufficient nature that -we mentioned above. Once this Glibc is installed into -<filename class="directory">/usr</filename>, we perform a quick changeover of -the toolchain defaults, then proceed for real in building the rest of the -target LFS system.</para> - -</sect1> - - -<sect1 id="tools-aboutlinking"> -<title>Notes on static linking</title> -<?dbhtml filename="aboutlinking.html" dir="chapter05"?> - -<para>Most programs have to perform, beside their specific task, many rather -common and sometimes trivial operations. These include allocating memory, -searching directories, reading and writing files, string handling, pattern -matching, arithmetic and many other tasks. Instead of obliging each program to -reinvent the wheel, the GNU system provides all these basic functions in -ready-made libraries. The major library on any Linux system is -<emphasis>Glibc</emphasis>.</para> - -<para>There are two primary ways of linking the functions from a library to a -program that uses them: statically or dynamically. When a program is linked -statically, the code of the used functions is included in the executable, -resulting in a rather bulky program. When a program is dynamically linked, what -is included is a reference to the dynamic linker, the name of the library, and -the name of the function, resulting in a much smaller executable. (A third way -is to use the programming interface of the dynamic linker. See the -<emphasis>dlopen</emphasis> man page for more information.)</para> - -<para>Dynamic linking is the default on Linux and has three major advantages -over static linking. First, you need only one copy of the executable library -code on your hard disk, instead of having many copies of the same code included -into a whole bunch of programs -- thus saving disk space. Second, when several -programs use the same library function at the same time, only one copy of the -function's code is required in core -- thus saving memory space. Third, when a -library function gets a bug fixed or is otherwise improved, you only need to -recompile this one library, instead of having to recompile all the programs that -make use of the improved function.</para> - -<para>If dynamic linking has several advantages, why then do we statically link -the first two packages in this chapter? The reasons are threefold: historical, -educational, and technical. Historical, because earlier versions of LFS -statically linked every program in this chapter. Educational, because knowing -the difference is useful. Technical, because we gain an element of independence -from the host in doing so, meaning that those programs can be used -independently of the host system. However, it's worth noting that an overall -successful LFS build can still be achieved when the first two packages are -built dynamically.</para> - -</sect1> - - -&c5-binutils-pass1; -&c5-gcc-pass1; -&c5-kernelheaders; -&c5-glibc; - - -<sect1 id="ch-tools-adjusting"> -<title>Adjusting the toolchain</title> -<?dbhtml filename="adjusting.html" dir="chapter05"?> - -<para>Now that the temporary C libraries have been installed, we want all -the tools compiled in the rest of this chapter to be linked against these -libraries. To accomplish this, we need to adjust the linker and the compiler's -specs file. Some people would say that it is <emphasis>"black magic juju below -this line"</emphasis>, but it is really very simple.</para> - -<para>First install the adjusted linker (adjusted at the end of the first pass -of Binutils) by running the following command from within -the <filename class="directory">binutils-build</filename> directory:</para> - -<screen><userinput>make -C ld install</userinput></screen> - -<para>From this point onwards everything will link <emphasis>only</emphasis> -against the libraries in <filename>/tools/lib</filename>.</para> - -<note><para>If you somehow missed the earlier warning to retain the Binutils -source and build directories from the first pass or otherwise accidentally -deleted them or just don't have access to them, don't worry, all is not lost. -Just ignore the above command. The result is a small chance of the subsequent -testing programs linking against libraries on the host. This is not ideal, but -it's not a major problem. The situation is corrected when we install the -second pass of Binutils a bit further on.</para></note> - -<para>Now that the adjusted linker is installed, you have to -<emphasis>remove</emphasis> the Binutils build and source directories.</para> - -<para>The next thing to do is to amend our GCC specs file so that it points -to the new dynamic linker. A simple sed will accomplish this:</para> - -<!-- Ampersands are needed to allow cut and paste --> - -<screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs && -sed -e 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2@g' \ - $SPECFILE > tempspecfile && -mv -f tempspecfile $SPECFILE && -unset SPECFILE</userinput></screen> - -<para>We recommend that you cut-and-paste the above rather than try and type it -all in. Or you can edit the specs file by hand if you want to: just replace the -occurrence of "/lib/ld-linux.so.2" with "/tools/lib/ld-linux.so.2". Be sure to -visually inspect the specs file to verify the intended change was actually -made.</para> - -<important><para>If you are working on a platform where the name of the dynamic -linker is something other than <filename>ld-linux.so.2</filename>, you -<emphasis>must</emphasis> substitute <filename>ld-linux.so.2</filename> with the -name of your platform's dynamic linker in the above commands. Refer back to -<xref linkend="tools-technicalnotes"/> if necessary.</para></important> - -<para>Lastly, there is a possibility that some include files from the host -system have found their way into GCC's private include dir. This can happen -because of GCC's "fixincludes" process which runs as part of the GCC build. -We'll explain more about this further on in this chapter. For now, run the -following commands to eliminate this possibility:</para> - -<screen><userinput>rm -f /tools/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen> - -<!-- HACK - Force some whitespace to appease tidy --> -<literallayout></literallayout> - -<caution><para>It is imperative at this point to stop and ensure that the basic -functions (compiling and linking) of the new toolchain are working as expected. -For this we are going to perform a simple sanity check:</para> - -<screen><userinput>echo 'main(){}' > dummy.c -cc dummy.c -readelf -l a.out | grep ': /tools'</userinput></screen> - -<para>If everything is working correctly, there should be no errors, and the -output of the last command will be (allowing for platform specific differences -in dynamic linker name):</para> - -<blockquote><screen>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</screen></blockquote> - -<para>Note especially that <filename class="directory">/tools/lib</filename> -appears as the prefix of our dynamic linker.</para> - -<para>If you did not receive the output -as shown above, or received no output at all, then something is seriously wrong. -You will need to investigate and retrace your steps to find out where the -problem is and correct it. There is no point in continuing until this is done. -First, redo the sanity check using <command>gcc</command> instead of -<command>cc</command>. If this works it means the -<filename class="symlink">/tools/bin/cc</filename> symlink is missing. Revisit -<xref linkend="ch-tools-gcc-pass1"/> and fix the symlink. Second, ensure your PATH -is correct. You can check this by running <userinput>echo $PATH</userinput> and -verifying that <filename class="directory">/tools/bin</filename> is at the head -of the list. If the PATH is wrong it could mean you're not logged in as user -<emphasis>lfs</emphasis> or something went wrong back in <xref -linkend="prepare-settingenvironment"/>. Third, something may have gone wrong -with the specs file amendment above. In this case redo the specs file amendment -ensuring to cut-and-paste the commands as was recommended.</para> - -<para>Once you are satisfied that all is well, clean up the test files:</para> - -<screen><userinput>rm dummy.c a.out</userinput></screen> -</caution> - -<!-- HACK - Force some whitespace to appease tidy --> -<literallayout></literallayout> - -</sect1> - - -&c5-tcl; -&c5-expect; -&c5-dejagnu; -&c5-gcc-pass2; -&c5-binutils-pass2; - -&c5-gawk; -&c5-coreutils; -&c5-bzip2; -&c5-gzip; -&c5-diffutils; -&c5-findutils; -&c5-make; -&c5-grep; -&c5-sed; -&c5-gettext; -&c5-ncurses; -&c5-patch; -&c5-tar; -&c5-texinfo; -&c5-bash; -&c5-perl; - - -<sect1 id="ch-tools-stripping"> -<title>Stripping</title> -<?dbhtml filename="stripping.html" dir="chapter05"?> - -<para>The steps in this section are optional, but if your LFS partition is -rather small, you will be glad to learn that you can remove some unnecessary -things. The executables and libraries you have built so far contain about 130 -MB of unneeded debugging symbols. Remove those symbols with:</para> - -<screen><userinput>strip --strip-debug /tools/lib/* -strip --strip-unneeded /tools/{,s}bin/*</userinput></screen> - -<para>The last of the above commands will skip some twenty files, reporting -that it doesn't recognize their file format. Most of them are scripts instead -of binaries.</para> - -<para>Take care <emphasis>not</emphasis> to use -<emphasis>--strip-unneeded</emphasis> on the libraries -- the static ones -would be destroyed and you would have to build the three toolchain packages -all over again.</para> - -<para>To save another 30 MB, you can remove all the documentation:</para> - -<screen><userinput>rm -rf /tools/{doc,info,man}</userinput></screen> - -<para>You will now need to have at least 850 MB of free space on your LFS -file system to be able to build and install Glibc in the next phase. If you can -build and install Glibc, you can build and install the rest too.</para> - -</sect1> +<?dbhtml filename="chapter05.html"?> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="introduction.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="toolchaintechnotes.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="binutils-pass1.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gcc-pass1.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="kernel-headers.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="glibc.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="adjusting.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="tcl.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="expect.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="dejagnu.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gcc-pass2.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="binutils-pass2.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gawk.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="coreutils.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="bzip2.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gzip.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="diffutils.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="findutils.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="make.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="grep.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="sed.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gettext.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="ncurses.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="patch.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="tar.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="texinfo.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="bash.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="util-linux.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="perl.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="stripping.xml"/> </chapter> - diff --git a/chapter05/coreutils.xml b/chapter05/coreutils.xml index 945a129bb..78833341f 100644 --- a/chapter05/coreutils.xml +++ b/chapter05/coreutils.xml @@ -1,38 +1,45 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-coreutils"> -<title>Installing Coreutils-&coreutils-version;</title> -<?dbhtml filename="coreutils.html" dir="chapter05"?> +<title>Coreutils-&coreutils-version;</title> +<?dbhtml filename="coreutils.html"?> -<screen>&buildtime; &coreutils-time-tools; -&diskspace; &coreutils-compsize-tools;</screen> +<indexterm zone="ch-tools-coreutils"> +<primary sortas="a-Coreutils">Coreutils</primary> +<secondary>tools</secondary></indexterm> -<literallayout>Official download location for Coreutils (&coreutils-version;): -<ulink url="ftp://ftp.gnu.org/gnu/coreutils/"/> -And for the patch: -<ulink url="&patches-root;&coreutils-posixver-patch;"/></literallayout> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/coreutils.xml" xpointer="xpointer(/sect1/para[1])"/> -&aa-coreutils-dep; +<screen>&buildtime; 0.9 SBU +&diskspace; 69 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/coreutils.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Coreutils</title> -<para>This package has an issue when compiled against Glibc-&glibc-version;. -Without the patch below, some of the Coreutils utilities (such as +<para>Prepare Coreutils for compilation:</para> + +<screen><userinput>DEFAULT_POSIX2_VERSION=199209 ./configure --prefix=/tools</userinput></screen> + +<para>This package has an issue when compiled against versions of glibc +later than 2.3.2. Some of the Coreutils utilities (such as (<command>head</command>, <command>tail</command> and <command>sort</command>) will reject their traditional syntax, a syntax that has been in use for approximately 30 years. This old syntax is so pervasive that compatibility -should be preserved until the many places where it is used can be updated. More -details on this are provided in the comments inside the patch itself. Use of -this patch is by no means compulsory, but not using it means you'll have to -deal with the consequences yourself: patch the many packages that still use the -old syntax. Therefore, better apply the patch:</para> - -<screen><userinput>patch -Np1 -i ../&coreutils-posixver-patch;</userinput></screen> - -<para>Now prepare Coreutils for compilation:</para> - -<screen><userinput>./configure --prefix=/tools</userinput></screen> +should be preserved until the many places where it is used can be +updated. Backwards compatibility is achieved by setting the +DEFAULT_POSIX2_VERSION environment variable to "199209" in the above +command. If you don't want coreutils to be backwards compatible +with the traditional syntax, then simply omit setting the DEFAULT_POSIX2_VERSION +environment variable. Realise though, that doing so will mean you'll have +to deal with the consequences yourself: patch the many packages that still use +the old syntax. We therefore recommend using the instructions exactly as given +above.</para> <para>Compile the package:</para> @@ -50,9 +57,8 @@ platforms but generally are not a problem on Linux.)</para> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-coreutils"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/dejagnu.xml b/chapter05/dejagnu.xml index 31d4b7ab6..9a526f212 100644 --- a/chapter05/dejagnu.xml +++ b/chapter05/dejagnu.xml @@ -1,16 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-dejagnu" xreflabel="DejaGnu"> -<title>Installing DejaGnu-&dejagnu-version;</title> -<?dbhtml filename="dejagnu.html" dir="chapter05"?> +<title>DejaGnu-&dejagnu-version;</title> +<?dbhtml filename="dejagnu.html"?> + +<indexterm zone="ch-tools-dejagnu"><primary sortas="a-DejaGnu">DejaGnu</primary></indexterm> <para>The DejaGnu package contains a framework for testing other programs.</para> -<screen>&buildtime; &dejagnu-time-tools; -&diskspace; &dejagnu-compsize-tools;</screen> +<screen>&buildtime; 0.1 SBU +&diskspace; 8.6 MB</screen> + +<para>For its installation Dejagnu depends on: Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, Sed.</para> -&aa-dejagnu-down; -&aa-dejagnu-dep; -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of DejaGnu</title> @@ -25,8 +32,21 @@ </sect2> -&aa-dejagnu-shortdesc; -&aa-dejagnu-desc; -</sect1> +<sect2 id="contents-dejagnu"><title>Contents of DejaGnu</title> + +<para><emphasis>Installed program</emphasis>: runtest</para> + +</sect2> + +<sect2><title>Short description</title> + +<indexterm zone="ch-tools-dejagnu runtest"><primary sortas="b-runtest">runtest</primary></indexterm> +<para id="runtest"><command>runtest</command> is the wrapper script that finds the proper +expect shell and then runs DejaGnu.</para> + +</sect2> + + +</sect1> diff --git a/chapter05/diffutils.xml b/chapter05/diffutils.xml index 7debe4de9..16fee0334 100644 --- a/chapter05/diffutils.xml +++ b/chapter05/diffutils.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-diffutils"> -<title>Installing Diffutils-&diffutils-version;</title> -<?dbhtml filename="diffutils.html" dir="chapter05"?> +<title>Diffutils-&diffutils-version;</title> +<?dbhtml filename="diffutils.html"?> -<screen>&buildtime; &diffutils-time-tools; -&diskspace; &diffutils-compsize-tools;</screen> +<indexterm zone="ch-tools-diffutils"> +<primary sortas="a-Diffutils">Diffutils</primary> +<secondary>tools</secondary></indexterm> -&aa-diffutils-down; -&aa-diffutils-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/diffutils.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.1 SBU +&diskspace; 7.5 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/diffutils.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Diffutils</title> @@ -27,9 +36,8 @@ </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-diffutils"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/expect.xml b/chapter05/expect.xml index 752fcb977..24d1cbcac 100644 --- a/chapter05/expect.xml +++ b/chapter05/expect.xml @@ -1,17 +1,24 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-expect" xreflabel="Expect"> -<title>Installing Expect-&expect-version;</title> -<?dbhtml filename="expect.html" dir="chapter05"?> +<title>Expect-&expect-version;</title> +<?dbhtml filename="expect.html"?> + +<indexterm zone="ch-tools-expect"><primary sortas="a-Expect">Expect</primary></indexterm> <para>The Expect package contains a program for doing scripted dialogues with other interactive programs.</para> -<screen>&buildtime; &expect-time-tools; -&diskspace; &expect-compsize-tools;</screen> +<screen>&buildtime; 0.1 SBU +&diskspace; 3.9 MB</screen> + +<para>Expect installation depends on: Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, Sed, Tcl.</para> -&aa-expect-down; -&aa-expect-dep; -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Expect</title> @@ -19,7 +26,7 @@ other interactive programs.</para> <para>First fix a bug that can result in bogus failures during the GCC test suite run:</para> -<screen><userinput>patch -Np1 -i ../&expect-patch;</userinput></screen> +<screen><userinput>patch -Np1 -i ../expect-&expect-version;-spawn-1.patch</userinput></screen> <para>Now prepare Expect for compilation:</para> @@ -63,8 +70,23 @@ of the supplementary expect scripts which are not needed.</para></listitem> </sect2> -&aa-expect-shortdesc; -&aa-expect-desc; -</sect1> +<sect2 id="contents-expect"><title>Contents of Expect</title> + +<para><emphasis>Installed program</emphasis>: expect</para> + +<para><emphasis>Installed library</emphasis>: libexpect&expect-version;.a</para> + +</sect2> + +<sect2><title>Short description</title> + +<indexterm zone="ch-tools-expect expect"><primary sortas="b-expect">expect</primary></indexterm> +<para id="expect"><command>expect</command> <quote>talks</quote> to other interactive +programs according to a script.</para> + +</sect2> + + +</sect1> diff --git a/chapter05/findutils.xml b/chapter05/findutils.xml index 8d76082e7..544f5441d 100644 --- a/chapter05/findutils.xml +++ b/chapter05/findutils.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-findutils"> -<title>Installing Findutils-&findutils-version;</title> -<?dbhtml filename="findutils.html" dir="chapter05"?> +<title>Findutils-&findutils-version;</title> +<?dbhtml filename="findutils.html"?> -<screen>&buildtime; &findutils-time-tools; -&diskspace; &findutils-compsize-tools;</screen> +<indexterm zone="ch-tools-findutils"> +<primary sortas="a-Findutils">Findutils</primary> +<secondary>tools</secondary></indexterm> -&aa-findutils-down; -&aa-findutils-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/findutils.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.2 SBU +&diskspace; 7.6 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/findutils.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Findutils</title> @@ -30,9 +39,8 @@ </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-findutils"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/gawk.xml b/chapter05/gawk.xml index 62c84523b..a2a22c9a9 100644 --- a/chapter05/gawk.xml +++ b/chapter05/gawk.xml @@ -1,16 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-gawk"> -<title>Installing Gawk-&gawk-version;</title> -<?dbhtml filename="gawk.html" dir="chapter05"?> +<title>Gawk-&gawk-version;</title> +<?dbhtml filename="gawk.html"?> -<screen>&buildtime; &gawk-time-tools; -&diskspace; &gawk-compsize-tools;</screen> +<indexterm zone="ch-tools-gawk"> +<primary sortas="a-Gawk">Gawk</primary> +<secondary>tools</secondary></indexterm> -<literallayout>Official download location for Gawk (&gawk-version;): -<ulink url="ftp://ftp.gnu.org/pub/gnu/gawk/"/></literallayout> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gawk.xml" xpointer="xpointer(/sect1/para[1])"/> -&aa-gawk-dep; +<screen>&buildtime; 0.2 SBU +&diskspace; 17 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gawk.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Gawk</title> @@ -32,9 +39,8 @@ </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-gawk"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 6cb01b4fa..68c429fb0 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -1,28 +1,35 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-gcc-pass1"> -<title>Installing GCC-&gcc-version; - Pass 1</title> -<?dbhtml filename="gcc-pass1.html" dir="chapter05"?> +<title>GCC-&gcc-version; - Pass 1</title> +<?dbhtml filename="gcc-pass1.html"?> -<screen>&buildtime; &gcc-time-tools-pass1; -&diskspace; &gcc-compsize-tools-pass1;</screen> +<indexterm zone="ch-tools-gcc-pass1"> +<primary sortas="a-GCC">GCC</primary> +<secondary>tools, pass 1</secondary></indexterm> -<literallayout>Official download location for GCC (&gcc-version;): -<ulink url="ftp://ftp.gnu.org/pub/gnu/gcc/"/></literallayout> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gcc.xml" xpointer="xpointer(/sect1/para[1])"/> -&aa-gcc-dep; +<screen>&buildtime; 4.4 SBU +&diskspace; 300 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gcc.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of GCC</title> <para>Unpack only the GCC-core tarball, as we won't be needing the C++ compiler -nor the test suite at the moment.</para> +nor the test suite here.</para> <para>This package is known to behave badly when you change its default optimization flags (including the <emphasis>-march</emphasis> and <emphasis>-mcpu</emphasis> options). Therefore, if you have defined any environment variables that override default optimizations, such as CFLAGS and -CXXFLAGS, we recommend unsetting them when building GCC.</para> +CXXFLAGS, we recommend un-setting them when building GCC.</para> <para>The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:</para> @@ -32,10 +39,10 @@ cd ../gcc-build</userinput></screen> <para>Prepare GCC for compilation:</para> -<screen><userinput>../&gcc-dir;/configure --prefix=/tools \ - --with-local-prefix=/tools \ - --disable-nls --enable-shared \ - --enable-languages=c</userinput></screen> +<screen><userinput>../gcc-&gcc-version;/configure --prefix=/tools \ + --with-local-prefix=/tools \ + --disable-nls --enable-shared \ + --enable-languages=c</userinput></screen> <para>The meaning of the configure options:</para> @@ -44,7 +51,7 @@ cd ../gcc-build</userinput></screen> purpose of this switch is to remove <filename>/usr/local/include</filename> from <command>gcc</command>'s include search path. This is not absolutely essential; however, we want to try to minimize the influence of the host -system, thus making this a sensible thing to do.</para></listitem> +system, so this a sensible thing to do.</para></listitem> <listitem><para><userinput>--enable-shared</userinput>: This switch may seem counter-intuitive at first. But using it allows the building of @@ -83,7 +90,7 @@ test suite. But, as mentioned before, the test suite framework is not in place yet. And there would be little point in running the tests anyhow, since the programs from this first pass will soon be replaced.</para> -<para>And install the package:</para> +<para>Now install the package:</para> <screen><userinput>make install</userinput></screen> @@ -98,9 +105,8 @@ C compiler to install, as long as there's a symlink pointing to it:</para> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-gcc"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml index da119311c..d89d82e82 100644 --- a/chapter05/gcc-pass2.xml +++ b/chapter05/gcc-pass2.xml @@ -1,14 +1,19 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-gcc-pass2"> -<title>Installing GCC-&gcc-version; - Pass 2</title> -<?dbhtml filename="gcc-pass2.html" dir="chapter05"?> +<title>GCC-&gcc-version; - Pass 2</title> +<?dbhtml filename="gcc-pass2.html"?> -<screen>&buildtime; &gcc-time-tools-pass2; -&diskspace; &gcc-compsize-tools-pass2;</screen> +<indexterm zone="ch-tools-gcc-pass2"> +<primary sortas="a-GCC">GCC</primary> +<secondary>tools, pass 2</secondary></indexterm> -&aa-gcc-down; -&aa-gcc-dep; +<screen>&buildtime; 11.0 SBU +&diskspace; 274 MB</screen> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Re-installation of GCC</title> @@ -37,24 +42,24 @@ working.</para> <para>This time we will build both the C and the C++ compilers, so you'll have to unpack both the core and the g++ tarballs (and testsuite too, if you want to run the tests). Unpacking them in your working directory, they will all unfold -into a single <filename>&gcc-dir;/</filename> subdirectory.</para> +into a single <filename>gcc-&gcc-version;/</filename> subdirectory.</para> <para>First correct a problem and make an essential adjustment:</para> -<screen><userinput>patch -Np1 -i ../&gcc-nofixincludes-patch; -patch -Np1 -i ../&gcc-specs-patch;</userinput></screen> - -<para>The first patch disables the GCC "fixincludes" script. We mentioned this -briefly earlier, but a slightly more in-depth explanation of the fixincludes -process is warranted here. Under normal circumstances, the GCC fixincludes -script scans your system for header files that need to be fixed. It might find -that some Glibc header files on your host system need to be fixed, fix them and -put them in the GCC private include directory. Then, later on in -<xref linkend="chapter-building-system"/>, after we've installed the newer Glibc, this -private include directory would be searched before the system include -directory, resulting in GCC finding the fixed headers from the host system, -which would most likely not match the Glibc version actually used for the LFS -system.</para> +<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-1.patch +patch -Np1 -i ../gcc-&gcc-version;-specs-1.patch</userinput></screen> + +<para>The first patch disables the GCC <quote>fixincludes</quote> script. We +mentioned this briefly earlier, but a slightly more in-depth explanation of +the fixincludes process is warranted here. Under normal circumstances, the GCC +fixincludes script scans your system for header files that need to be fixed. It +might find that some Glibc header files on your host system need to be fixed, +fix them and put them in the GCC private include directory. Then, later on in +<xref linkend="chapter-building-system"/>, after we've installed the newer +Glibc, this private include directory would be searched before the system +include directory, resulting in GCC finding the fixed headers from the host +system, which would most likely not match the Glibc version actually used for +the LFS system.</para> <para>The second patch changes GCC's default location of the dynamic linker (typically <filename>ld-linux.so.2</filename>). It also removes @@ -77,11 +82,11 @@ variables that override the default optimization flags.</para> <para>Now prepare GCC for compilation:</para> -<screen><userinput>../&gcc-dir;/configure --prefix=/tools \ - --with-local-prefix=/tools \ - --enable-clocale=gnu --enable-shared \ - --enable-threads=posix --enable-__cxa_atexit \ - --enable-languages=c,c++</userinput></screen> +<screen><userinput>../gcc-&gcc-version;/configure --prefix=/tools \ + --with-local-prefix=/tools \ + --enable-clocale=gnu --enable-shared \ + --enable-threads=posix --enable-__cxa_atexit \ + --enable-languages=c,c++</userinput></screen> <para>The meaning of the new configure options:</para> @@ -128,7 +133,7 @@ through to completion and not stop at the first failure. The GCC test suite is very comprehensive and is almost guaranteed to generate a few failures. To get a summary of the test suite results, run this:</para> -<screen><userinput>../&gcc-dir;/contrib/test_summary</userinput></screen> +<screen><userinput>../gcc-&gcc-version;/contrib/test_summary</userinput></screen> <para>(For just the summaries, pipe the output through <userinput>grep -A7 Summ</userinput>.)</para> @@ -146,8 +151,8 @@ current GCC-&gcc-version; should look on i686-pc-linux-gnu, see <para>The unexpected pass for g++ is due to the use of <emphasis>--enable-__cxa_atexit</emphasis>. Apparently not all platforms -supported by GCC have support for "__cxa_atexit" in their C libraries, so this -test is not always expected to pass.</para> +supported by GCC have support for <quote>__cxa_atexit</quote> in their C +libraries, so this test is not always expected to pass.</para> <para>The 24 unexpected passes for libstdc++ are due to the use of <emphasis>--enable-clocale=gnu</emphasis>. This option, which is the correct @@ -160,8 +165,10 @@ tests are not always expected to pass.</para> <para>Having a few unexpected failures often cannot be avoided. The GCC developers are usually aware of these, but haven't yet gotten around to fixing -them. In short, unless your results are vastly different from those at the -above URL, it is safe to continue.</para> +them. One particular case in point is the filebuf_members test in the C++ +standard library testsuite. This test has been observed to fail in some +situations, but succeeed in others. In short, unless your results are vastly +different from those at the above URL, it is safe to continue.</para> <para>And finally install the package:</para> @@ -175,9 +182,8 @@ GCC Specs patch.</para></note> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-gcc"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/gettext.xml b/chapter05/gettext.xml index 880a597c1..cebff68f1 100644 --- a/chapter05/gettext.xml +++ b/chapter05/gettext.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-gettext"> -<title>Installing Gettext-&gettext-version;</title> -<?dbhtml filename="gettext.html" dir="chapter05"?> +<title>Gettext-&gettext-version;</title> +<?dbhtml filename="gettext.html"?> -<screen>&buildtime; &gettext-time-tools; -&diskspace; &gettext-compsize-tools;</screen> +<indexterm zone="ch-tools-gettext"> +<primary sortas="a-Gettext">Gettext</primary> +<secondary>tools</secondary></indexterm> -&aa-gettext-down; -&aa-gettext-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gettext.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.5 SBU +&diskspace; 55 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gettext.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Gettext</title> @@ -34,9 +43,8 @@ project).)</para> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-gettext"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 9eda176a6..22a338164 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-glibc"> -<title>Installing Glibc-&glibc-version;</title> -<?dbhtml filename="glibc.html" dir="chapter05"?> +<title>Glibc-&glibc-version;</title> +<?dbhtml filename="glibc.html"?> -<screen>&buildtime; &glibc-time-tools; -&diskspace; &glibc-compsize-tools;</screen> +<indexterm zone="ch-tools-glibc"> +<primary sortas="a-Glibc">Glibc</primary> +<secondary>tools</secondary></indexterm> -&aa-glibc-down; -&aa-glibc-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/glibc.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 11.8 SBU +&diskspace; 800 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/glibc.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Glibc</title> @@ -17,7 +26,7 @@ optimization flags (including the <emphasis>-march</emphasis> and <emphasis>-mcpu</emphasis> options). Therefore, if you have defined any environment variables that override default optimizations, such as CFLAGS and -CXXFLAGS, we recommend unsetting them when building Glibc.</para> +CXXFLAGS, we recommend un-setting them when building Glibc.</para> <para>Basically, compiling Glibc in any other way than the book suggests is putting the stability of your system at risk.</para> @@ -30,16 +39,16 @@ cd ../glibc-build</userinput></screen> <para>Next, prepare Glibc for compilation:</para> -<screen><userinput>../&glibc-dir;/configure --prefix=/tools \ - --disable-profile --enable-add-ons=linuxthreads \ - --with-binutils=/tools/bin --with-headers=/tools/include \ - --without-gd --without-cvs</userinput></screen> +<screen><userinput>../glibc-&glibc-version;-20031202/configure --prefix=/tools \ + --disable-profile --enable-add-ons=linuxthreads \ + --with-binutils=/tools/bin --with-headers=/tools/include \ + --without-gd --without-cvs</userinput></screen> <para>The meaning of the configure options:</para> <itemizedlist> -<listitem><para><userinput>--disable-profile</userinput>: This disables the -building of the libraries with profiling information. Omit this option if you +<listitem><para><userinput>--disable-profile</userinput>: This +builds the libraries without profiling information. Omit this option if you plan to do profiling on the temporary tools.</para></listitem> <listitem><para><userinput>--enable-add-ons=linuxthreads</userinput>: This @@ -52,8 +61,8 @@ these switches are not required. But they ensure nothing can go wrong with regard to what kernel headers and Binutils programs get used during the Glibc build.</para></listitem> -<listitem><para><userinput>--without-gd</userinput>: This switch ensures -that we don't build the <command>memusagestat</command> program, which +<listitem><para><userinput>--without-gd</userinput>: This prevents +the build of the <command>memusagestat</command> program, which strangely enough insists on linking against the host's libraries (libgd, libpng, libz, and so forth).</para></listitem> @@ -141,8 +150,8 @@ touch /tools/etc/ld.so.conf</userinput></screen> <para>Different countries and cultures have varying conventions for how to communicate. These conventions range from very simple ones, such as the format for representing dates and times, to very complex ones, such as the language -spoken. The "internationalization" of GNU programs works by means of -<emphasis>locales</emphasis>.</para> +spoken. The <quote>internationalization</quote> of GNU programs works by means +of <emphasis>locales</emphasis>.</para> <note><para>If you are not running the test suites here in this chapter as per our recommendation, there is little point in installing the locales now. We'll @@ -177,9 +186,8 @@ localedef -i ja_JP -f EUC-JP ja_JP</userinput></screen> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-glibc"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/grep.xml b/chapter05/grep.xml index c40e7ed84..7e70d0e13 100644 --- a/chapter05/grep.xml +++ b/chapter05/grep.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-grep"> -<title>Installing Grep-&grep-version;</title> -<?dbhtml filename="grep.html" dir="chapter05"?> +<title>Grep-&grep-version;</title> +<?dbhtml filename="grep.html"?> -<screen>&buildtime; &grep-time-tools; -&diskspace; &grep-compsize-tools;</screen> +<indexterm zone="ch-tools-grep"> +<primary sortas="a-Grep">Grep</primary> +<secondary>tools</secondary></indexterm> -&aa-grep-down; -&aa-grep-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/grep.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.1 SBU +&diskspace; 5.8 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/grep.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Grep</title> @@ -16,7 +25,7 @@ <para>Prepare Grep for compilation:</para> <screen><userinput>./configure --prefix=/tools \ - --disable-perl-regexp --with-included-regex</userinput></screen> + --disable-perl-regexp --with-included-regex</userinput></screen> <para>The meaning of the configure options:</para> @@ -43,9 +52,8 @@ use the code from Glibc, which is known to be slightly buggy.</para></listitem> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-grep"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/gzip.xml b/chapter05/gzip.xml index d6020d294..3618e3de4 100644 --- a/chapter05/gzip.xml +++ b/chapter05/gzip.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-gzip"> -<title>Installing Gzip-&gzip-version;</title> -<?dbhtml filename="gzip.html" dir="chapter05"?> +<title>Gzip-&gzip-version;</title> +<?dbhtml filename="gzip.html"?> -<screen>&buildtime; &gzip-time-tools; -&diskspace; &gzip-compsize-tools;</screen> +<indexterm zone="ch-tools-gzip"> +<primary sortas="a-Gzip">Gzip</primary> +<secondary>tools</secondary></indexterm> -&aa-gzip-down; -&aa-gzip-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gzip.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.1 SBU +&diskspace; 2.6 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gzip.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Gzip</title> @@ -27,9 +36,8 @@ </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-gzip"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/introduction.xml b/chapter05/introduction.xml new file mode 100644 index 000000000..78c883ecd --- /dev/null +++ b/chapter05/introduction.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> +<sect1 id="ch-tools-introduction"> +<title>Introduction</title> +<?dbhtml filename="introduction.html"?> + +<para>In this chapter we will compile and install a minimal +Linux system. This system will contain just enough tools to be able +to start constructing the final LFS system in the next chapter and allow +a working environment with a little more user convenience than a minimum +environment.</para> + +<para>The building of this minimal system is done in two steps: first we +build a brand-new and host-independent toolchain (compiler, assembler, +linker, libraries, and a few useful utilities), and then use this to build all the other essential +tools.</para> + +<para>The files compiled in this chapter will be installed under the +<filename class="directory">$LFS/tools</filename> directory +to keep them separate from the files installed in the next chapter and your host's production directories. +Since the packages compiled here are merely temporary, we don't want +them to pollute the soon-to-be LFS system.</para> + +<para>Before issuing the build instructions for a package, you are expected to +have already unpacked it (explained shortly) as user <emphasis>lfs</emphasis>, +and to have performed a <userinput>cd</userinput> into the created directory. +The build instructions assume that you are using the <command>bash</command> +shell.</para> + +<para>Several of the packages are patched before compilation, but only when +the patch is needed to circumvent a problem. Often the patch is needed in +both this and the next chapter, but sometimes in only one of them. Therefore, +don't worry when instructions for a downloaded patch seem to be missing. Also, +when applying a patch, you'll occasionally see warning messages about +<emphasis>offset</emphasis> or <emphasis>fuzz</emphasis>. These warnings are +nothing to worry about, as the patch was still successfully applied.</para> + +<para>During the compilation of most packages you will see many warnings +scroll by on your screen. These are normal and can safely be ignored. They are +just what they say they are: warnings -- mostly about deprecated, but not +invalid, use of the C or C++ syntax. It's just that C standards have changed +rather often and some packages still use the older standard, which is not +really a problem.</para> + +<para>After installing each package you should delete its source and build +directories, <emphasis>unless</emphasis> told otherwise. Deleting the sources +saves space, but also prevents mis-configuration when the same package is +reinstalled further on. Only for three packages you will need to keep the +source and build directories around for a while, so their contents can be used +by later commands. Do not miss the reminders.</para> + +<para>Now first check that your LFS environment variable is set up +properly:</para> + +<screen><userinput>echo $LFS</userinput></screen> + +<para>Make sure the output shows the path to your LFS partition's mount +point, which is <filename class="directory">/mnt/lfs</filename> if you +followed our example.</para> + +</sect1> diff --git a/chapter05/kernelheaders.xml b/chapter05/kernel-headers.xml index 48d4bfd1c..e825fe66d 100644 --- a/chapter05/kernelheaders.xml +++ b/chapter05/kernel-headers.xml @@ -1,11 +1,19 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-kernel-headers"> -<title>Installing Linux-&kernel-version; headers</title> -<?dbhtml filename="kernel-headers.html" dir="chapter05"?> +<title>Linux-&linux-version; headers</title> +<?dbhtml filename="kernel-headers.html"?> -<screen>&buildtime; &kernel-time-headers; -&diskspace; &kernel-compsize-headers;</screen> +<indexterm zone="ch-tools-kernel-headers"> +<primary sortas="a-Linux">Linux</primary> +<secondary>tools, headers</secondary></indexterm> + +<screen>&buildtime; 0.1 SBU +&diskspace; 186 MB</screen> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of the kernel headers</title> @@ -21,7 +29,7 @@ place where <command>gcc</command> can later find them.</para> <para>This ensures that the kernel tree is absolutely clean. The kernel team recommends that this command be issued prior to <emphasis>each</emphasis> kernel compilation. You shouldn't rely on the source tree being clean after -untarring.</para> +un-tarring.</para> <para>Create the <filename>include/linux/version.h</filename> file:</para> @@ -38,11 +46,10 @@ symlink:</para> cp include/asm/* /tools/include/asm cp -R include/asm-generic /tools/include</userinput></screen> -<para>And finally install the cross-platform kernel header files:</para> +<para>Finally, install the cross-platform kernel header files:</para> <screen><userinput>cp -R include/linux /tools/include</userinput></screen> </sect2> </sect1> - diff --git a/chapter05/make.xml b/chapter05/make.xml index fb34e27b1..7f6170d7b 100644 --- a/chapter05/make.xml +++ b/chapter05/make.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-make"> -<title>Installing Make-&make-version;</title> -<?dbhtml filename="make.html" dir="chapter05"?> +<title>Make-&make-version;</title> +<?dbhtml filename="make.html"?> -<screen>&buildtime; &make-time-tools; -&diskspace; &make-compsize-tools;</screen> +<indexterm zone="ch-tools-make"> +<primary sortas="a-Make">Make</primary> +<secondary>tools</secondary></indexterm> -&aa-make-down; -&aa-make-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/make.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.2 SBU +&diskspace; 8.8 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/make.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Make</title> @@ -30,9 +39,8 @@ </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-make"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/ncurses.xml b/chapter05/ncurses.xml index e274cc5c2..9ef4117a1 100644 --- a/chapter05/ncurses.xml +++ b/chapter05/ncurses.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-ncurses"> -<title>Installing Ncurses-&ncurses-version;</title> -<?dbhtml filename="ncurses.html" dir="chapter05"?> +<title>Ncurses-&ncurses-version;</title> +<?dbhtml filename="ncurses.html"?> -<screen>&buildtime; &ncurses-time-tools; -&diskspace; &ncurses-compsize-tools;</screen> +<indexterm zone="ch-tools-ncurses"> +<primary sortas="a-Ncurses">Ncurses</primary> +<secondary>tools</secondary></indexterm> -&aa-ncurses-down; -&aa-ncurses-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/ncurses.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.7 SBU +&diskspace; 26 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/ncurses.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Ncurses</title> @@ -16,7 +25,7 @@ <para>Prepare Ncurses for compilation:</para> <screen><userinput>./configure --prefix=/tools --with-shared \ - --without-debug --without-ada --enable-overwrite</userinput></screen> + --without-debug --without-ada --enable-overwrite</userinput></screen> <para>The meaning of the configure options:</para> @@ -42,9 +51,8 @@ ensure that other packages can find the Ncurses headers successfully.</para> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-ncurses"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/patch.xml b/chapter05/patch.xml index 67ce2da5c..1cf788bff 100644 --- a/chapter05/patch.xml +++ b/chapter05/patch.xml @@ -1,19 +1,28 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-patch"> -<title>Installing Patch-&patch-version;</title> -<?dbhtml filename="patch.html" dir="chapter05"?> +<title>Patch-&patch-version;</title> +<?dbhtml filename="patch.html"?> -<screen>&buildtime; &patch-time-tools; -&diskspace; &patch-compsize-tools;</screen> +<indexterm zone="ch-tools-patch"> +<primary sortas="a-Patch">Patch</primary> +<secondary>tools</secondary></indexterm> -&aa-patch-down; -&aa-patch-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/patch.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.1 SBU +&diskspace; 1.9 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/patch.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Patch</title> -<para>Prepare Patch for compilation (setting the preprocessor flags to +<para>Prepare Patch for compilation (the preprocessor flag <emphasis>-D_GNU_SOURCE</emphasis> is only needed on the PowerPC platform, on other architectures you can leave it out):</para> @@ -29,9 +38,8 @@ other architectures you can leave it out):</para> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-patch"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/perl.xml b/chapter05/perl.xml index d6633ce75..556bb66ea 100644 --- a/chapter05/perl.xml +++ b/chapter05/perl.xml @@ -1,21 +1,30 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-perl"> -<title>Installing Perl-&perl-version;</title> -<?dbhtml filename="perl.html" dir="chapter05"?> +<title>Perl-&perl-version;</title> +<?dbhtml filename="perl.html"?> -<screen>&buildtime; &perl-time-tools; -&diskspace; &perl-compsize-tools;</screen> +<indexterm zone="ch-tools-perl"> +<primary sortas="a-Perl">Perl</primary> +<secondary>tools</secondary></indexterm> -&aa-perl-down; -&aa-perl-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/perl.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.8 SBU +&diskspace; 74 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/perl.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Perl</title> <para>First adapt some hard-wired paths to the C library:</para> -<screen><userinput>patch -Np1 -i ../&perl-libc-patch;</userinput></screen> +<screen><userinput>patch -Np1 -i ../perl-&perl-version;-libc-1.patch</userinput></screen> <para>Perl insists on using the <command>arch</command> program to find out the machine type. Create a little script to mimic this command:</para> @@ -23,17 +32,17 @@ the machine type. Create a little script to mimic this command:</para> <screen><userinput>echo "uname -m" > /tools/bin/arch chmod 755 /tools/bin/arch</userinput></screen> -<para>Now prepare Perl for compilation (make sure you get the 'IO Fcntl' +<para>Now prepare Perl for compilation (make sure you get the 'IO Fcntl POSIX' right, they are all letters):</para> -<screen><userinput>./configure.gnu --prefix=/tools -Dstatic_ext='IO Fcntl'</userinput></screen> +<screen><userinput>./configure.gnu --prefix=/tools -Dstatic_ext='IO Fcntl POSIX'</userinput></screen> <para>The meaning of the configure option:</para> <itemizedlist> -<listitem><para><userinput>-Dstatic_ext='IO Fcntl'</userinput>: This tells -Perl to build the minimum set of static extensions needed for running the -Coreutils test suite in the next chapter.</para></listitem> +<listitem><para><userinput>-Dstatic_ext='IO Fcntl POSIX'</userinput>: This tells +Perl to build the minimum set of static extensions needed for installing and +testing the Coreutils package in the next chapter.</para></listitem> </itemizedlist> <para>Compile only the required tools:</para> @@ -48,9 +57,8 @@ cp -R lib/* /tools/lib/perl5/&perl-version;</userinput></screen> </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-perl"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/sed.xml b/chapter05/sed.xml index 0102760da..215ed3f94 100644 --- a/chapter05/sed.xml +++ b/chapter05/sed.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-sed"> -<title>Installing Sed-&sed-version;</title> -<?dbhtml filename="sed.html" dir="chapter05"?> +<title>Sed-&sed-version;</title> +<?dbhtml filename="sed.html"?> -<screen>&buildtime; &sed-time-tools; -&diskspace; &sed-compsize-tools;</screen> +<indexterm zone="ch-tools-sed"> +<primary sortas="a-Sed">Sed</primary> +<secondary>tools</secondary></indexterm> -&aa-sed-down; -&aa-sed-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/sed.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.2 SBU +&diskspace; 5.2 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/sed.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Sed</title> @@ -30,9 +39,8 @@ </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-sed"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/stripping.xml b/chapter05/stripping.xml new file mode 100644 index 000000000..d5fbd8280 --- /dev/null +++ b/chapter05/stripping.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> +<sect1 id="ch-tools-stripping"> +<title>Stripping</title> +<?dbhtml filename="stripping.html"?> + +<para>The steps in this section are optional, but if your LFS partition is +rather small, you will be glad to learn that you can remove some unnecessary +things. The executables and libraries you have built so far contain about 130 +MB of unneeded debugging symbols. Remove those symbols with:</para> + +<screen><userinput>strip --strip-debug /tools/lib/* +strip --strip-unneeded /tools/{,s}bin/*</userinput></screen> + +<para>The last of the above commands will skip some twenty files, reporting +that it doesn't recognize their file format. Most of them are scripts instead +of binaries.</para> + +<para>Take care <emphasis>not</emphasis> to use +<emphasis>--strip-unneeded</emphasis> on the libraries -- the static ones +would be destroyed and you would have to build the three toolchain packages +all over again.</para> + +<para>To save another 30 MB, you can remove all the documentation:</para> + +<screen><userinput>rm -rf /tools/{doc,info,man}</userinput></screen> + +<para>You will now need to have at least 850 MB of free space on your LFS +file system to be able to build and install Glibc in the next phase. If you can +build and install Glibc, you can build and install the rest too.</para> + +</sect1> diff --git a/chapter05/tar.xml b/chapter05/tar.xml index 384a73d06..6368b2a73 100644 --- a/chapter05/tar.xml +++ b/chapter05/tar.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-tar"> -<title>Installing Tar-&tar-version;</title> -<?dbhtml filename="tar.html" dir="chapter05"?> +<title>Tar-&tar-version;</title> +<?dbhtml filename="tar.html"?> -<screen>&buildtime; &tar-time-tools; -&diskspace; &tar-compsize-tools;</screen> +<indexterm zone="ch-tools-tar"> +<primary sortas="a-Tar">Tar</primary> +<secondary>tools</secondary></indexterm> -&aa-tar-down; -&aa-tar-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/tar.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.2 SBU +&diskspace; 10 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/tar.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Tar</title> @@ -30,9 +39,8 @@ </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-tar"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/tcl.xml b/chapter05/tcl.xml index e8b066b93..4322835e7 100644 --- a/chapter05/tcl.xml +++ b/chapter05/tcl.xml @@ -1,26 +1,33 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-tcl" xreflabel="Tcl"> -<title>Installing Tcl-&tcl-version;</title> -<?dbhtml filename="tcl.html" dir="chapter05"?> +<title>Tcl-&tcl-version;</title> +<?dbhtml filename="tcl.html"?> + +<indexterm zone="ch-tools-tcl"><primary sortas="a-Tcl">Tcl</primary></indexterm> <para>The Tcl package contains the Tool Command Language.</para> -<screen>&buildtime; &tcl-time-tools; -&diskspace; &tcl-compsize-tools;</screen> +<screen>&buildtime; 0.9 SBU +&diskspace; 23 MB</screen> + +<para>Tcl installation depends on: Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, Sed.</para> -&aa-tcl-down; -&aa-tcl-dep; -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Tcl</title> -<para>This package and the next two are only installed to be able to run the +<para>This package and the next two are only installed to support running the test suites for GCC and Binutils. Installing three packages just for testing purposes may seem like overkill, but it is very reassuring, if not essential, -to know that our most important tools are working properly. Even if you are -not running the test suites here in this chapter as per our recommendation, -these packages are still required for running the test suites in the next +to know that our most important tools are working properly. Even if the +the test suites are not run in this chapter (we recommend not running them), +these packages are still required to run the test suites in the next chapter.</para> <para>Prepare Tcl for compilation:</para> @@ -32,7 +39,7 @@ chapter.</para> <screen><userinput>make</userinput></screen> -<para>(If you insist on testing the results, then issue: +<para>If you want to test the results, then issue: <userinput>TZ=UTC make test</userinput>. However, the Tcl test suite is known to experience failures under certain host conditions that are not fully understood. Therefore, test suite failures here are not surprising, and are not @@ -40,30 +47,44 @@ considered critical. The <emphasis>TZ=UTC</emphasis> parameter sets the time zone to Coordinated Universal Time (UTC) also known as Greenwich Mean Time (GMT), but only for the duration of the test suite run. This ensures the clock tests are exercised correctly. More information on the TZ environment variable -will be given later on in <xref linkend="chapter-bootscripts"/>.)</para> +will be given later on in <xref linkend="chapter-bootscripts"/>.</para> <para>Install the package:</para> <screen><userinput>make install</userinput></screen> -<!-- HACK - Force some whitespace to appease tidy --> -<literallayout></literallayout> <warning><para><emphasis>Do not remove</emphasis> the <filename>tcl&tcl-version;</filename> source directory yet, as the next package will need its internal headers.</para></warning> -<!-- HACK - Force some whitespace to appease tidy --> -<literallayout></literallayout> -<para>And make a necessary symbolic link:</para> +<para>Now make a necessary symbolic link:</para> <screen><userinput>ln -s tclsh8.4 /tools/bin/tclsh</userinput></screen> </sect2> -&aa-tcl-shortdesc; -&aa-tcl-desc; -</sect1> +<sect2 id="contents-tcl"><title>Contents of Tcl</title> + +<para><emphasis>Installed programs</emphasis>: tclsh (link to tclsh8.4), +tclsh8.4</para> + +<para><emphasis>Installed library</emphasis>: libtcl8.4.so</para> + +</sect2> + +<sect2><title>Short descriptions</title> + +<indexterm zone="ch-tools-tcl tclsh8.4"><primary sortas="b-tclsh8.4">tclsh8.4</primary></indexterm> +<para id="tclsh8.4"><command>tclsh8.4</command> is the Tcl command shell.</para> + +<indexterm zone="ch-tools-tcl libtcl8.4.so"><primary sortas="c-libtcl8.4.so">libtcl8.4.so</primary></indexterm> +<para id="libtcl8.4.so"><command>libtcl8.4.so</command> is the Tcl library.</para> + +</sect2> + + +</sect1> diff --git a/chapter05/texinfo.xml b/chapter05/texinfo.xml index eee6e2a55..1243b49e4 100644 --- a/chapter05/texinfo.xml +++ b/chapter05/texinfo.xml @@ -1,14 +1,23 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <sect1 id="ch-tools-texinfo"> -<title>Installing Texinfo-&texinfo-version;</title> -<?dbhtml filename="texinfo.html" dir="chapter05"?> +<title>Texinfo-&texinfo-version;</title> +<?dbhtml filename="texinfo.html"?> -<screen>&buildtime; &texinfo-time-tools; -&diskspace; &texinfo-compsize-tools;</screen> +<indexterm zone="ch-tools-texinfo"> +<primary sortas="a-Texinfo">Texinfo</primary> +<secondary>tools</secondary></indexterm> -&aa-texinfo-down; -&aa-texinfo-dep; +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/texinfo.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.2 SBU +&diskspace; 16 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/texinfo.xml" xpointer="xpointer(/sect1/para[2])"/> -<sect2><title> </title><para> </para></sect2> <sect2> <title>Installation of Texinfo</title> @@ -30,9 +39,8 @@ </sect2> -<sect2><title> </title><para> </para> +<sect2><title> </title><para> </para> <para>The details on this package are found in <xref linkend="contents-texinfo"/>.</para> -<para> </para></sect2> +<para> </para></sect2> </sect1> - diff --git a/chapter05/toolchaintechnotes.xml b/chapter05/toolchaintechnotes.xml new file mode 100644 index 000000000..d9ea431d6 --- /dev/null +++ b/chapter05/toolchaintechnotes.xml @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> +<sect1 id="ch-tools-toolchaintechnotes"> +<title>Toolchain technical notes</title> +<?dbhtml filename="toolchaintechnotes.html"?> + +<para>This section attempts to explain some of the rationale and technical +details behind the overall build method. It's not essential that you understand +everything here immediately. Most of it will make sense once you have performed +an actual build. Feel free to refer back here at any time.</para> + +<para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to provide a sane, +temporary environment that we can chroot into, and from which we can produce a +clean, trouble-free build of the target LFS system in +<xref linkend="chapter-building-system"/>. Along the way, we attempt to divorce ourselves +from the host system as much as possible, and in so doing build a +self-contained and self-hosted toolchain. It should be noted that the +build process has been designed to minimize the risks for +new readers and provide maximum educational value at the same time. In other +words, more advanced techniques could be used to build the system.</para> + +<important> +<para>Before continuing, you really should be aware of the name of your working +platform, often also referred to as the <emphasis>target triplet</emphasis>. For +many folks the target triplet will probably be +<emphasis>i686-pc-linux-gnu</emphasis>. A simple way to determine your target +triplet is to run the <filename>config.guess</filename> 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.</para> + +<para>You'll also need to be aware of the name of your platform's +<emphasis>dynamic linker</emphasis>, often also referred to as the +<emphasis>dynamic loader</emphasis>, not to be confused with the standard linker +<emphasis>ld</emphasis> that is part of Binutils. The dynamic linker is provided +by Glibc and has the job of finding and loading the shared libraries needed by a +program, preparing the program to run and then running it. For most folks the +name of the dynamic linker will be <emphasis>ld-linux.so.2</emphasis>. On +platforms that are less prevalent, the name might be +<emphasis>ld.so.1</emphasis> and newer 64 bit platforms might even have +something completely different. You should be able to determine the name +of your platform's dynamic linker by looking in the +<filename class="directory">/lib</filename> directory on your host system. A +sure-fire way is to inspect a random binary from your host system by running: +<userinput>readelf -l <name of binary> | grep interpreter</userinput> +and noting the output. The authoritative reference covering all platforms is in +the <filename>shlib-versions</filename> file in the root of the Glibc source +tree.</para> +</important> + +<para>Some key technical points of how the <xref linkend="chapter-temporary-tools"/> build +method works:</para> + +<itemizedlist> +<listitem><para>Similar in principle to cross compiling whereby tools installed +into the same prefix work in cooperation and thus utilize a little GNU +<quote>magic</quote>.</para></listitem> + +<listitem><para>Careful manipulation of the standard linker's library search +path to ensure programs are linked only against libraries we +choose.</para></listitem> + +<listitem><para>Careful manipulation of <command>gcc</command>'s +<emphasis>specs</emphasis> file to tell the compiler which target dynamic +linker will be used.</para></listitem> +</itemizedlist> + +<para>Binutils is installed first because the <command>./configure</command> runs of both GCC and Glibc perform various +feature tests on the assembler and linker +to determine which software features to enable +or disable. This is more important than one might first realize. An incorrectly +configured GCC or Glibc can result in a subtly broken toolchain where the impact +of such breakage might not show up until near the end of the build of a whole +distribution. Thankfully, a test suite failure will usually alert us before too +much time is wasted.</para> + +<para>Binutils installs its assembler and linker into two locations, +<filename class="directory">/tools/bin</filename> and +<filename class="directory">/tools/$TARGET_TRIPLET/bin</filename>. In reality, +the tools in one location are hard linked to the other. An important facet of +the linker is its library search order. Detailed information can be obtained +from <command>ld</command> by passing it the <emphasis>--verbose</emphasis> +flag. For example: <command>ld --verbose | grep SEARCH</command> will +show you the current search paths and their order. You can see what files are +actually linked by <command>ld</command> by compiling a dummy program and +passing the <emphasis>--verbose</emphasis> switch to the linker. For example: +<command>gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded</command> +will show you all the files successfully opened during the linking.</para> + +<para>The next package installed is GCC and during its run of +<command>./configure</command> you'll see, for example:</para> + +<blockquote><screen>checking what assembler to use... /tools/i686-pc-linux-gnu/bin/as +checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld</screen></blockquote> + +<para>This is important for the reasons mentioned above. It also demonstrates +that GCC's configure script does not search the PATH directories to find which +tools to use. However, during the actual operation of <command>gcc</command> +itself, the same search paths are not necessarily used. You can find out which +standard linker <command>gcc</command> will use by running: +<command>gcc -print-prog-name=ld</command>. +Detailed information can be obtained from <command>gcc</command> by passing +it the <emphasis>-v</emphasis> flag while compiling a dummy program. For +example: <command>gcc -v dummy.c</command> will show you detailed +information about the preprocessor, compilation and assembly stages, including +<command>gcc</command>'s include search paths and their order.</para> + +<para>The next package installed is Glibc. The most important considerations for +building Glibc are the compiler, binary tools and kernel headers. The compiler +is generally no problem as Glibc will always use the <command>gcc</command> +found in a PATH directory. The binary tools and kernel headers can be a little +more troublesome. Therefore we take no risks and use the available configure +switches to enforce the correct selections. After the run of +<command>./configure</command> you can check the contents of the +<filename>config.make</filename> file in the +<filename class="directory">glibc-build</filename> directory for all the +important details. You'll note some interesting items like the use of +<emphasis>CC="gcc -B/tools/bin/"</emphasis> to control which binary tools are +used, and also the use of the <emphasis>-nostdinc</emphasis> and +<emphasis>-isystem</emphasis> flags to control the compiler's include search +path. These items help to highlight an important aspect of the Glibc package: +it is very self-sufficient in terms of its build machinery and generally does +not rely on toolchain defaults.</para> + +<para>After the Glibc installation, we make some adjustments to ensure that +searching and linking take place only within our <filename>/tools</filename> +prefix. We install an adjusted <command>ld</command>, which has a hard-wired +search path limited to <filename class="directory">/tools/lib</filename>. Then +we amend <command>gcc</command>'s specs file to point to our new dynamic +linker in <filename class="directory">/tools/lib</filename>. This last step is +<emphasis>vital</emphasis> to the whole process. As mentioned above, a +hard-wired path to a dynamic linker is embedded into every ELF shared +executable. You can inspect this by running: +<command>readelf -l <name of binary> | grep interpreter</command>. +By amending <command>gcc</command>'s specs file, we are ensuring that every +program compiled from here through the end of this chapter will use our new +dynamic linker in <filename class="directory">/tools/lib</filename>.</para> + +<para>The need to use the new dynamic linker is also the reason why we apply the +Specs patch for the second pass of GCC. Failure to do so will result in the GCC +programs themselves having the name of the dynamic linker from the host system's +<filename class="directory">/lib</filename> directory embedded into them, which +would defeat our goal of getting away from the host.</para> + +<para>During the second pass of Binutils, we are able to utilize the +<emphasis>--with-lib-path</emphasis> configure switch to control +<command>ld</command>'s library search path. From this point onwards, the +core toolchain is self-contained and self-hosted. The remainder of the +<xref linkend="chapter-temporary-tools"/> packages all build against the new Glibc in +<filename class="directory">/tools</filename> and all is well.</para> + +<para>Upon entering the chroot environment in <xref linkend="chapter-building-system"/>, the +first major package we install is Glibc, due to its self-sufficient nature that +we mentioned above. Once this Glibc is installed into +<filename class="directory">/usr</filename>, we perform a quick changeover of +the toolchain defaults, then proceed for real in building the rest of the +target LFS system.</para> + +<sect2> +<title>Notes on static linking</title> + +<para>Most programs have to perform, beside their specific task, many rather +common and sometimes trivial operations. These include allocating memory, +searching directories, reading and writing files, string handling, pattern +matching, arithmetic and many other tasks. Instead of obliging each program to +reinvent the wheel, the GNU system provides all these basic functions in +ready-made libraries. The major library on any Linux system is +<emphasis>Glibc</emphasis>.</para> + +<para>There are two primary ways of linking the functions from a library to a +program that uses them: statically or dynamically. When a program is linked +statically, the code of the used functions is included in the executable, +resulting in a rather bulky program. When a program is dynamically linked, what +is included is a reference to the dynamic linker, the name of the library, and +the name of the function, resulting in a much smaller executable. (A third way +is to use the programming interface of the dynamic linker. See the +<emphasis>dlopen</emphasis> man page for more information.)</para> + +<para>Dynamic linking is the default on Linux and has three major advantages +over static linking. First, you need only one copy of the executable library +code on your hard disk, instead of having many copies of the same code included +into a whole bunch of programs -- thus saving disk space. Second, when several +programs use the same library function at the same time, only one copy of the +function's code is required in core -- thus saving memory space. Third, when a +library function gets a bug fixed or is otherwise improved, you only need to +recompile this one library, instead of having to recompile all the programs that +make use of the improved function.</para> + +<para>If dynamic linking has several advantages, why then do we statically link +the first two packages in this chapter? The reasons are threefold: historical, +educational, and technical. Historical, because earlier versions of LFS +statically linked every program in this chapter. Educational, because knowing +the difference is useful. Technical, because we gain an element of independence +from the host in doing so, meaning that those programs can be used +independently of the host system. However, it's worth noting that an overall +successful LFS build can still be achieved when the first two packages are +built dynamically.</para> + +</sect2> + +</sect1> diff --git a/chapter05/util-linux.xml b/chapter05/util-linux.xml new file mode 100644 index 000000000..d5007d79a --- /dev/null +++ b/chapter05/util-linux.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> +<sect1 id="ch-tools-util-linux"> +<title>Util-linux-&util-linux-version;</title> +<?dbhtml filename="util-linux.html"?> + +<indexterm zone="ch-tools-util-linux"> +<primary sortas="a-Util-linux">Util-linux</primary> +<secondary>tools</secondary></indexterm> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/util-linux.xml" xpointer="xpointer(/sect1/para[1])"/> + +<screen>&buildtime; 0.2 SBU +&diskspace; 16 MB</screen> + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/util-linux.xml" xpointer="xpointer(/sect1/para[2])"/> + + +<sect2> +<title>Installation of Util-linux</title> + +<para>Util-linux doesn't use the freshly installed headers and libraries +from the /tools directory. This is fixed by altering the configure +script:</para> + +<screen><userinput>cp configure configure.backup +sed "s@/usr/include@/tools/include@g" configure.backup > configure</userinput></screen> + +<para>Prepare Util-linux for compilation:</para> + +<screen><userinput>./configure</userinput></screen> + +<para>Compile some support routines:</para> + +<screen><userinput>make -C lib</userinput></screen> + +<para>Since you'll only need a couple of the utilities contained in +this package, build just those:</para> + +<screen><userinput>make -C mount mount umount +make -C text-utils more</userinput></screen> + +<para>Now copy these programs to the temporary tools directory:</para> + +<screen><userinput>cp mount/{,u}mount text-utils/more /tools/bin</userinput></screen> + +</sect2> + +<sect2><title> </title><para> </para> +<para>The details on this package are found in <xref linkend="contents-utillinux"/>.</para> +<para> </para></sect2> +</sect1> |