Part of the Fathom-OS Project Log.
This is Part 5 of Chapter 8, the core system build. Part 4 finished the terminal libraries and the shell. This part builds the run of build tooling and supporting libraries the rest of the system leans on, Libtool, GDBM, Gperf, Expat, Inetutils, and Less, closing with the final permanent Perl. Seven packages, ending on Perl and its 1.3 million test suite.
References:
Resuming the Build
Every Chapter 8 session starts the same way, since the snapshot is taken outside the chroot with the virtual filesystems unmounted. Become root on the host, confirm $LFS, check the mount state, remount, and re-enter the chroot. This session it all went clean, no stacked mounts and no surprises, so it is just the standard sequence.
sudo -i
echo $LFS
findmnt | grep /lfs
$LFS came back /lfs and findmnt showed only the /lfs root partition, clean. The remount block and chroot entry then ran first try:
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts -o gid=5,mode=0620 $LFS/dev/pts
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
if [ -h $LFS/dev/shm ]; then
install -v -d -m 1777 $LFS$(realpath /dev/shm)
else
mount -vt tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
fi
chroot "$LFS" /usr/bin/env -i \
HOME=/root TERM="$TERM" \
PS1='(lfs chroot) \u:\w\$ ' \
PATH=/usr/bin:/usr/sbin \
MAKEFLAGS="-j$(nproc)" \
TESTSUITEFLAGS="-j$(nproc)" \
/bin/bash --login
The standing reminder still holds: use sudo -i, not su -, since the Ubuntu host keeps the root account locked.
8.38 Libtool
The GNU generic library support script, which makes shared libraries simpler to use across systems. Plain build, then one cleanup at the end to remove a static library that only the test suite needs.
./configure --prefix=/usr
make
make check
make install
rm -fv /usr/lib/libltdl.a
The test suite runs in two parts. The main Libtool suite reported “144 tests behaved as expected, 32 skipped.” The many entries it lists as “expected failure” are not real failures, they are tests the suite knows will not pass in this kind of environment and counts as expected. The gnulib subset that runs after it passed 4, skipped 2, no real failures. Both halves clean.
The Supporting Libraries and Tools
A run of libraries and small utilities the rest of the build depends on.
8.39 GDBM
The GNU Database Manager, a library of database functions using extensible hashing. The one configure option that matters is --enable-libgdbm-compat, which builds the older DBM compatibility library some packages outside LFS still need.
./configure --prefix=/usr \
--disable-static \
--enable-libgdbm-compat
make
make check
make install
Result: all 38 tests successful. The configure summary confirmed the compatibility library and GNU Readline support both enabled, linking against the readline built back in Part 1.
8.40 Gperf
Generates a perfect hash function from a key set. Short, plain build.
./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.3
make
make check
make install
Gperf’s test suite works by running a series of diff comparisons between expected and actual output. No diff output means every comparison matched, which is what happened. Clean.
8.41 Expat
A stream-oriented C library for parsing XML. Plain build with an optional doc install at the end.
./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/expat-2.7.4
make
make check
make install
install -v -m644 doc/*.{html,css} /usr/share/doc/expat-2.7.4
Result: 2 tests, both passing (runtests and runtests_cxx).
8.42 Inetutils
Basic networking programs (ping, ftp, telnet, traceroute, and others). A gcc compatibility sed for telnet first, then a configure with a long list of disable flags that turn off obsolete or insecure programs and all the network servers, which are not appropriate in a basic system.
sed -i 's/def HAVE_TERMCAP_TGETENT/ 1/' telnet/telnet.c
./configure --prefix=/usr \
--bindir=/usr/bin \
--localstatedir=/var \
--disable-logger \
--disable-whois \
--disable-rcp \
--disable-rexec \
--disable-rlogin \
--disable-rsh \
--disable-servers
make
make check
make install
mv -v /usr/{,s}bin/ifconfig
Result: TOTAL 12, PASS 11, SKIP 1, no failures. Notably libls.sh, which can fail in some environments, passed here. The final mv moves ifconfig to /usr/sbin where it belongs.
8.43 Less
A text file viewer and pager. Plain build pointing its config at /etc.
./configure --prefix=/usr --sysconfdir=/etc
make
make check
make install
Result: 18 tests run with 0 errors. The test framework compiles its own helper first, then runs the checks, all clean.
8.44 Perl
The Practical Extraction and Report Language, and the closing package for this part. This is the full permanent Perl, more complete than the temporary version from Chapter 7, built with threads, the shared library, and version-based library paths.
Two exports first so Perl uses the system zlib and bzip2 already built rather than its bundled copies:
export BUILD_ZLIB=False
export BUILD_BZIP2=0
Then the long Configure block. The -des runs it with defaults and minimal prompting, and the -D options set the install paths, point the pager at less, and enable threads and the shared library:
sh Configure -des \
-D prefix=/usr \
-D vendorprefix=/usr \
-D privlib=/usr/lib/perl5/5.42/core_perl \
-D archlib=/usr/lib/perl5/5.42/core_perl \
-D sitelib=/usr/lib/perl5/5.42/site_perl \
-D sitearch=/usr/lib/perl5/5.42/site_perl \
-D vendorlib=/usr/lib/perl5/5.42/vendor_perl \
-D vendorarch=/usr/lib/perl5/5.42/vendor_perl \
-D man1dir=/usr/share/man/man1 \
-D man3dir=/usr/share/man/man3 \
-D pager="/usr/bin/less -isR" \
-D useshrplib \
-D usethreads
make
The test suite runs in parallel and is the largest in the chapter:
TEST_JOBS=$(nproc) make test_harness
Result: all tests successful. The summary reported Files=2915, Tests=1351091, Result: PASS. Over 1.3 million tests passing clean. The “TODO passed” note on run/todo.t is not a failure, it just means two tests marked as expected-to-fail actually passed.
Install, then clear the two exports:
make install
unset BUILD_ZLIB BUILD_BZIP2
Snapshot
With Perl done, the build tooling and supporting libraries are all in place. This is the checkpoint before the next run of packages. Exit the chroot, unmount the virtual filesystems one at a time with children before parents, verify clean with findmnt (only the /lfs root partition should remain), then snapshot.
exit
umount $LFS/dev/shm
umount $LFS/dev/pts
umount $LFS/{sys,proc,run,dev}
findmnt | grep /lfs
Only the /lfs root partition remained, clean. Snapshot taken.
What Is Next
Part 6 continues the run of system tooling. XML::Parser comes next, then Intltool, Autoconf, Automake, OpenSSL, Kmod, and onward through the rest of the chapter, including the final Python. That run is large, so it will span more than one post as the earlier parts did.
More updates to follow as each build phase completes.
Previous: Chapter 8 Part 4: Terminal Libraries and the Shell | Next: Chapter 8 Part 6: Perl Modules and Python
All session notes and build logs are committed to the private repository at github.com/QuietWireDev/fathom-os.


