diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 97e392c47..b49507e8a 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -44,6 +44,61 @@ or as appropriate for the entry or if needed the entire day's listitem. --> + + 2020-04-20 + + + [pierre] - Change -isystem to -idirafter in "Adjusting the + toolchain". This allows to search g++ private headers before + the public ones, which is the normal search order, with the + drawback that it includes the headers in /tools if they exist + in both /usr and /tools. Fix most of + #4641. + + + + + + 2020-04-19 + + + [pierre] - Build util-linux in chapter 5 for both books. + link util-linux libraries and headers from /usr to /tools. + Copy util-linux pkg-config files from /tools to /usr, changing + any occurence of /tools to /usr. Also move eudev before util-linux. + Fixes #4637, + #4638, and + #4642. + + + [pierre] - Reinstate flex in chapter 5, so that ar and ranlib + (binutils) link against libfl. This allows to run tests for bison, + too. Fixes + #4631. + + + [pierre] - Prevent readline.pc from referencing termcap as + a private library by adding --with-curses to configure switches. + Fixes #4635. + + + [pierre] - Allow bison to use the libtextstyle.so library from + gettext, by moving gettext before bison. Fixes + #4634. + + + [pierre] - Allow some shadow programs to use "setcap" by + moving libcap before shadow. Fixes + #4633. + + + [pierre] - Fix a wrong hardcoded path in some programs + from the shadow package. Fixes + #4632. + + + + 2020-04-15 diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml index ebccba382..6f5c9d115 100644 --- a/chapter05/chapter05.xml +++ b/chapter05/chapter05.xml @@ -29,6 +29,7 @@ + diff --git a/chapter05/flex.xml b/chapter05/flex.xml new file mode 100644 index 000000000..5e1afa194 --- /dev/null +++ b/chapter05/flex.xml @@ -0,0 +1,72 @@ + + + %general-entities; +]> + + + + + + flex + &flex-version; +
&flex-url;
+
+ + Flex-&flex-version; + + + Flex + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/flex.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&flex-ch5-sbu;</seg> + <seg>&flex-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Flex + + Prepare Flex for compilation: + +./configure --prefix=/tools + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + + + <para>Details on this package are located in + <xref linkend="contents-flex" role="."/></para> + + </sect2> + +</sect1> diff --git a/chapter05/stripping.xml b/chapter05/stripping.xml index dcbd38edd..354426161 100644 --- a/chapter05/stripping.xml +++ b/chapter05/stripping.xml @@ -38,7 +38,10 @@ <screen><userinput>rm -rf /tools/{,share}/{info,man,doc}</userinput></screen> - <para>Remove unneeded files:</para> + <para>The libtool .la files are only useful when linking with static + libraries. They are unneeded, and potentially harmful, when using dynamic + shared libraries, specially when using also non-autotools build systems. + Remove those files now:</para> <screen arch="default"><userinput>find /tools/{lib,libexec} -name \*.la -delete</userinput></screen> diff --git a/chapter05/util-linux.xml b/chapter05/util-linux.xml index db9b9d468..3ba23638f 100644 --- a/chapter05/util-linux.xml +++ b/chapter05/util-linux.xml @@ -5,7 +5,7 @@ %general-entities; ]> -<sect1 id="ch-tools-util-linux" role="wrap" revision="systemd"> +<sect1 id="ch-tools-util-linux" role="wrap"> <?dbhtml filename="util-linux.html"?> <sect1info condition="script"> diff --git a/chapter06/adjusting.xml b/chapter06/adjusting.xml index 5852d2958..3e6b49e19 100644 --- a/chapter06/adjusting.xml +++ b/chapter06/adjusting.xml @@ -24,15 +24,17 @@ mv -v /tools/$(uname -m)-pc-linux-gnu/bin/{ld,ld-old} mv -v /tools/bin/{ld-new,ld} ln -sv /tools/bin/ld /tools/$(uname -m)-pc-linux-gnu/bin/ld</userinput></screen> - <para>Next, amend the GCC specs file so that it points to the new - dynamic linker. Simply deleting all instances of <quote>/tools</quote> should - leave us with the correct path to the dynamic linker. Also adjust the specs file - so that GCC knows where to find the correct headers and Glibc start files. + <para>the next command amends the GCC specs file to achieve three goals: + first point GCC to the new dynamic linker. Simply deleting all instances of + <quote>/tools</quote> should leave us with the correct path to the dynamic + linker. Second, let GCC know where to find the Glibc start files. Third, + add the /usr/include directory at the end of the default search path, so + that header files added in chapter 6 are found. A <command>sed</command> command accomplishes this:</para> <screen><userinput>gcc -dumpspecs | sed -e 's@/tools@@g' \ -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \ - -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \ + -e '/\*cpp:/{n;s@$@ -idirafter /usr/include@}' > \ `dirname $(gcc --print-libgcc-file-name)`/specs</userinput></screen> <para>It is a good idea to visually inspect the specs file to verify the @@ -72,13 +74,18 @@ readelf -l a.out | grep ': /lib'</userinput></screen> <para os="g">Verify that the compiler is searching for the correct header files:</para> -<screen><userinput>grep -B1 '^ /usr/include' dummy.log</userinput></screen> +<screen><userinput>grep -B4 '^ /usr/include' dummy.log</userinput></screen> <para os="h">This command should return the following output:</para> <screen><computeroutput>#include <...> search starts here: + /tools/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include + /tools/include + /tools/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed /usr/include</computeroutput></screen> + <note><para>On a 32 bit system, x86_64 is replaced with i686.</para></note> + <para os="i">Next, verify that the new linker is being used with the correct search paths:</para> <screen os="j"><userinput>grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'</userinput></screen> diff --git a/chapter06/bison.xml b/chapter06/bison.xml index a5ca3cfc0..e36e323eb 100644 --- a/chapter06/bison.xml +++ b/chapter06/bison.xml @@ -58,16 +58,19 @@ <screen><userinput remap="make">make</userinput></screen> -<!-- - <para>To test the results (about 2.2 SBU), issue:</para> + <para>To test the results (about 5.5 SBU), issue:</para> <screen><userinput remap="test">make check</userinput></screen> ---> + <para>13 tests fail in the "Diagnostics" section, probably because of + missing locales.</para> + +<!-- <para>There is a circular dependency between bison and flex with regard to the checks. If desired, after installing flex in the next section, the bison package can be rebuilt and the bison checks can be run with <command>make check</command>.</para> +--> <para>Install the package:</para> diff --git a/chapter06/chapter06.xml b/chapter06/chapter06.xml index fa5783d32..cb913042c 100644 --- a/chapter06/chapter06.xml +++ b/chapter06/chapter06.xml @@ -39,14 +39,15 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="isl.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="attr.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="acl.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libcap.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="shadow.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="pkgconfig.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ncurses.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libcap.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sed.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="psmisc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="iana-etc.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bison.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="flex.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="grep.xml"/> @@ -62,7 +63,6 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="autoconf.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="automake.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kmod.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libelf.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libffi.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="openssl.xml"/> @@ -93,13 +93,13 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="systemd.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dbus.xml"/> + <!-- sysv only --> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="eudev.xml"/> + <!-- Both sysv on systemd builds --> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="procps.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/> - <!-- sysv only --> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="eudev.xml"/> - <!-- Both sysv and systemd builds --> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="e2fsprogs.xml"/> diff --git a/chapter06/createfiles.xml b/chapter06/createfiles.xml index 42d1ec1fe..a616f679a 100644 --- a/chapter06/createfiles.xml +++ b/chapter06/createfiles.xml @@ -43,32 +43,31 @@ ln -sv /tools/bin/{env,install,perl,printf} /usr/bin ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib ln -sv /tools/lib/libstdc++.{a,so{,.6}} /usr/lib +ln -sv /tools/lib/libfl.so* /usr/lib -ln -sv bash /bin/sh</userinput></screen> +ln -sv bash /bin/sh +for lib in blkid mount uuid fdisk +do + ln -sv /tools/lib/lib$lib.so* /usr/lib + sed 's|/tools|/usr|' /tools/lib/pkgconfig/${lib}.pc \ + > /usr/lib/pkgconfig/${lib}.pc +done +for incdir in blkid libmount uuid libfdisk +do + ln -svf /tools/include/$incdir /usr/include +done</userinput></screen> <para arch="ml_32,ml_all">32-bit builds also require these links:</para> -<screen arch="ml_32,ml_all"><userinput arch="ml_32,ml_all">ln -sv /tools/lib32/libgcc_s.so{,.1} /usr/lib32 +<screen arch="ml_32,ml_all"><userinput>ln -sv /tools/lib32/libgcc_s.so{,.1} /usr/lib32 ln -sv /tools/lib32/libstdc++.{a,so{,.6}} /usr/lib32</userinput></screen> <para arch="ml_x32,ml_all">x32-bit builds also require these links:</para> -<screen arch="ml_x32,ml_all"><userinput arch="ml_x32,ml_all">ln -sv /tools/libx32/libgcc_s.so{,.1} /usr/libx32 +<screen arch="ml_x32,ml_all"><userinput>ln -sv /tools/libx32/libgcc_s.so{,.1} /usr/libx32 ln -sv /tools/libx32/libstdc++.{a,so{,.6}} /usr/libx32 ln -sv /usr/libx32 /</userinput></screen> -<!--for lib in blkid lzma mount uuid -do - ln -sv /tools/lib/lib$lib.so* /usr/lib -done--> -<!--ln -svf /tools/include/blkid /usr/include -ln -svf /tools/include/libmount /usr/include -ln -svf /tools/include/uuid /usr/include--> -<!--for pc in blkid mount uuid -do - sed 's@tools@usr@g' /tools/lib/pkgconfig/${pc}.pc \ - > /usr/lib/pkgconfig/${pc}.pc -done--> <variablelist> <title>The purpose of each link: @@ -175,25 +174,6 @@ done--> for C++ support in GMP.
- - - /bin/sh @@ -202,6 +182,34 @@ done-->
+ + + /usr/lib/libfl.so* + + + This link allows binutils to find the flex library, and to + build enhanced versions of ar and ranlib. + + + + + + + /usr/lib/lib{blkid,fdisk,mount,uuid}.so*, + /usr/include/{blkid,libfdisk,libmount,uuid}, + /usr/lib/pkgconfig/{blkid,fdisk,mount,uuid}.pc + + + + These links and files allow + eudev + systemd to find the + util-linux libraries installed in chapter 5, without creating + wrong references to /tools. The uuid library is also needed for + building a python module. + + + Historically, Linux maintains a list of the mounted file systems in the diff --git a/chapter06/eudev.xml b/chapter06/eudev.xml index 392461610..b3ba1f568 100644 --- a/chapter06/eudev.xml +++ b/chapter06/eudev.xml @@ -49,17 +49,8 @@ sed -i '/keyboard_lookup_key/d' src/udev/udev-builtin-keyboard.c --> - -Prepare Eudev for compilation: + Prepare Eudev for compilation: ./configure --prefix=/usr \ --bindir=/sbin \ @@ -71,35 +62,24 @@ EOF --with-rootlibdir=/lib \ --enable-manpages \ --disable-static - -Compile the package: + Compile the package: make - -Create some directories now that are needed for tests, but -will also be used as a part of installation: + Create some directories now that are needed for tests, but + will also be used as a part of installation: mkdir -pv /lib/udev/rules.d mkdir -pv /etc/udev/rules.d -To test the results, issue: + To test the results, issue: make check - Install the package: make install - Install some custom rules and support files useful in an LFS environment: @@ -201,7 +181,6 @@ rm -rf DESTDIR into a binary database /etc/udev/hwdb.bin. Create the initial database: - udevadm hwdb --update This command needs to be run each time the hardware information is diff --git a/chapter06/gettext.xml b/chapter06/gettext.xml index ef4b24741..2c4683804 100644 --- a/chapter06/gettext.xml +++ b/chapter06/gettext.xml @@ -76,7 +76,22 @@ sed -i 's/test-lock..EXEEXT.//' gettext-tools/gnulib-tests/Makefile.inCompile the package: -make +make BISON_LOCALEDIR=/usr/share/locale + + + The meaning of the make parameter: + + + BISON_LOCALEDIR=/usr/share/locale + + Since bison is not yet installed in /usr, configure hardcodes + the directory containing translations for the bison program (the + "locale" directory) as /tools/share/locale. Passing this variable + to make allows overriding the choice made by configure. + + + + To test the results (this takes a long time, around 3 SBUs), issue: diff --git a/chapter06/readline.xml b/chapter06/readline.xml index 16e1f4cb8..8cd3759b5 100644 --- a/chapter06/readline.xml +++ b/chapter06/readline.xml @@ -53,8 +53,24 @@ sed -i '/{OLDSUFF}/c:' support/shlib-install ./configure --prefix=/usr \ --disable-static \ + --with-curses \ --docdir=/usr/share/doc/readline-&readline-version; + + The meaning of the configure option: + + + --with-curses" + + This option tells Readline that it can find the termcap + library functions in the curses library, rather than a separate + termcap library. It allows generating a correct + readline.pc file. + + + + + Compile the package: make SHLIB_LIBS="-L/tools/lib -lncursesw" diff --git a/chapter06/revisedchroot.xml b/chapter06/revisedchroot.xml index d534e504e..0a3339e64 100644 --- a/chapter06/revisedchroot.xml +++ b/chapter06/revisedchroot.xml @@ -59,8 +59,10 @@ rm -f /usr/lib/libz.a There are also several files installed in the /usr/lib and /usr/libexec directories with a file name extention of .la. These are "libtool archive" - files and generally unneeded on a linux system. None of these are necessary - at this point. To remove them, run: + files. As already said, they are only useful when linking with static + libraries. They are unneeded, and potentially harmful, when using dynamic + shared libraries, specially when using also non-autotools build systems. + To remove them, run: find /usr/lib /usr/libexec -name \*.la -delete find /usr/lib{,32} /usr/libexec -name \*.la -delete diff --git a/chapter06/shadow.xml b/chapter06/shadow.xml index b052ab3ab..7fd621bdb 100644 --- a/chapter06/shadow.xml +++ b/chapter06/shadow.xml @@ -83,11 +83,20 @@ find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;Prepare Shadow for compilation: -./configure --sysconfdir=/etc --with-group-name-max-length=32 +touch /usr/bin/passwd +./configure --sysconfdir=/etc --with-group-name-max-length=32 The meaning of the configure option: + + touch /usr/bin/passwd + + The file /usr/bin/passwd needs + to exist because its location is harcoded in some programs, and + the default location if it does not exist is not right. + + --with-group-name-max-length=32 diff --git a/chapter06/systemd.xml b/chapter06/systemd.xml index 6e2bca319..b37b8e067 100644 --- a/chapter06/systemd.xml +++ b/chapter06/systemd.xml @@ -50,13 +50,6 @@ ln -sf /tools/bin/true /usr/bin/xsltproc - Because we have not yet installed the final version of Util-Linux, - create links to the libraries in the appropriate location: - -for file in /tools/lib/lib{blkid,mount,uuid}.so*; do - ln -sf $file /usr/lib/ -done - Set up the man pages: tar -xf ../systemd-man-pages-&systemd-version;.tar.xz @@ -76,7 +69,6 @@ done mkdir -p build cd build -PKG_CONFIG_PATH="/usr/lib/pkgconfig:/tools/lib/pkgconfig" \ LANG=en_US.UTF-8 \ meson --prefix=/usr \ --sysconfdir=/etc \ @@ -234,9 +226,6 @@ meson --prefix=/usr \ rm -f /usr/lib/sysctl.d/50-pid-max.conf - Cleanup symbolic links to Util-Linux libraries: - -rm -fv /usr/lib/lib{blkid,uuid,mount}.so* - + Remove the earlier created symlinks and files: + +rm -vf /usr/include/{blkid,libfdisk,libmount,uuid} +rm -vf /usr/lib/lib{blkid,fdisk,mount,uuid}.so* +rm -vf /usr/lib/pkgconfig/{blkid,fdisk,mount,uuid}.pc + Prepare Util-linux for compilation: ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ @@ -110,7 +112,7 @@ coverage, other BLFS packages must be installed. If desired, this test can be run after rebooting into the completed LFS system and running: -bash tests/run.sh --srcdir=$PWD --builddir=$PWD +bash tests/run.sh --srcdir=$PWD --builddir=$PWD chown -Rv nobody . diff --git a/general.ent b/general.ent index 8b7e110ab..ebd59a1dd 100644 --- a/general.ent +++ b/general.ent @@ -1,13 +1,13 @@ - + - + - + diff --git a/packages.ent b/packages.ent index ef55abed7..63e3af7fe 100644 --- a/packages.ent +++ b/packages.ent @@ -77,8 +77,8 @@ - - + + @@ -209,6 +209,8 @@ + +