need to be expanded
to include /usr/pkg/foo
. For
more than a few packages, this scheme becomes unmanageable.
This is a variation of the previous package management
technique. Each package is installed similar to the
previous scheme. But instead of making the symlink, each
file is symlinked into the /usr
hierarchy. This removes the need to
expand the environment variables. Though the symlinks can
be created by the user to automate the creation, many
package managers have been written using this approach. A
few of the popular ones include Stow, Epkg, Graft, and
Depot.
The installation needs to be faked, so that the package
thinks that it is installed in /usr
though in reality it is installed in
the /usr/pkg
hierarchy.
Installing in this manner is not usually a trivial task.
For example, consider that you are installing a package
libfoo-1.1. The following instructions may not install the
package properly:
./configure --prefix=/usr/pkg/libfoo/1.1 make make install
The installation will work, but the dependent packages may
not link to libfoo as you would expect. If you compile a
package that links against libfoo, you may notice that it
is linked to /usr/pkg/libfoo/1.1/lib/libfoo.so.1
instead of /usr/lib/libfoo.so.1
as you would expect.
The correct approach is to use the DESTDIR
strategy to fake installation of the
package. This approach works as follows:
./configure --prefix=/usr make make DESTDIR=/usr/pkg/libfoo/1.1 install
Most packages support this approach, but there are some
which do not. For the non-compliant packages, you may
either need to manually install the package, or you may
find that it is easier to install some problematic packages
into /opt
.
In this technique, a file is timestamped before the installation of the package. After the installation, a simple use of the find command with the appropriate options can generate a log of all the files installed after the timestamp file was created. A package manager written with this approach is install-log.
Though this scheme has the advantage of being simple, it has two drawbacks. If, during installation, the files are installed with any timestamp other than the current time, those files will not be tracked by the package manager. Also, this scheme can only be used when one package is installed at a time. The logs are not reliable if two packages are being installed on two different consoles.
In this approach, the commands that the installation scripts perform are recorded. There are two techniques that one can use:
The LD_PRELOAD
environment
variable can be set to point to a library to be preloaded
before installation. During installation, this library
tracks the packages that are being installed by attaching
itself to various executables such as cp, install, mv and tracking the
system calls that modify the filesystem. For this approach
to work, all the executables need to be dynamically linked
without the suid or sgid bit. Preloading the library may
cause some unwanted side-effects during installation.
Therefore, it is advised that one performs some tests to
ensure that the package manager does not break anything and
logs all the appropriate files.
The second technique is to use strace, which logs all system calls made during the execution of the installation scripts.
In this scheme, the package installation is faked into a separate tree as described in the Symlink style package management. After the installation, a package archive is created using the installed files. This archive is then used to install the package either on the local machine or can even be used to install the package on other machines.
This approach is used by most of the package managers found in the commercial distributions. Examples of package managers that follow this approach are RPM (which, incidentally, is required by the Linux Standard Base Specification), pkg-utils, Debian's apt, and Gentoo's Portage system. A hint describing how to adopt this style of package management for LFS systems is located at http://www.linuxfromscratch.org/hints/downloads/files/fakeroot.txt.
Creation of package files that include dependency information is complex and is beyond the scope of LFS.
Slackware uses a tar based system for package archives. This system purposely does not handle package dependencies as more complex package managers do. For details of Slackware package management, see http://www.slackbook.org/html/package-management.html.
This scheme, unique to LFS, was devised by Matthias Benkmann, and is available from the Hints Project. In this scheme, each package is installed as a separate user into the standard locations. Files belonging to a package are easily identified by checking the user ID. The features and shortcomings of this approach are too complex to describe in this section. For the details please see the hint at http://www.linuxfromscratch.org/hints/downloads/files/more_control_and_pkg_man.txt.
One of the advantages of an LFS system is that there are no
files that depend on the position of files on a disk system.
Cloning an LFS build to another computer with the same
architecture as the base system is as simple as using
tar on the LFS
partition that contains the root directory (about 250MB
uncompressed for a base LFS build), copying that file via
network transfer or CD-ROM to the new system and expanding
it. From that point, a few configuration files will have to
be changed. Configuration files that may need to be updated
include: /etc/hosts
,
/etc/fstab
, /etc/passwd
, /etc/group
, /etc/shadow
,
/etc/ld.so.conf
, /etc/sysconfig/rc.site
, /etc/sysconfig/network
, and /etc/sysconfig/ifconfig.eth0
.
A custom kernel may need to be built for the new system depending on differences in system hardware and the original kernel configuration.
There have been some reports of issues when copying between similar but not identical architectures. For instance, the instruction set for an Intel system is not identical with an AMD processor and later versions of some processors may have instructions that are unavailable in earlier versions.
Finally the new system has to be made bootable via Section 8.4, “Using GRUB to Set Up the Boot Process”.
It is time to enter the chroot environment to begin building
and installing the final LFS system. As user root
, run the following command to enter
the realm that is, at the moment, populated with only the
temporary tools:
chroot "$LFS" /tools/bin/env -i \ HOME=/root \ TERM="$TERM" \ PS1='(lfs chroot) \u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash --login +h
The -i
option given to
the env command
will clear all variables of the chroot environment. After that,
only the HOME
, TERM
, PS1
, and
PATH
variables are set again. The
TERM=$TERM
construct
will set the TERM
variable inside
chroot to the same value as outside chroot. This variable is
needed for programs like vim and less to operate properly. If
other variables are needed, such as CFLAGS
or CXXFLAGS
,
this is a good place to set them again.
From this point on, there is no need to use the LFS
variable anymore, because all work will be
restricted to the LFS file system. This is because the Bash
shell is told that $LFS
is now
the root (/
) directory.
Notice that /tools/bin
comes last
in the PATH
. This means that a
temporary tool will no longer be used once its final version is
installed. This occurs when the shell does not “remember” the locations of executed
binaries—for this reason, hashing is switched off by
passing the +h
option
to bash.
Note that the bash prompt will say
I have no name!
This is
normal because the /etc/passwd
file has not been created yet.
It is important that all the commands throughout the remainder of this chapter and the following chapters are run from within the chroot environment. If you leave this environment for any reason (rebooting for example), ensure that the virtual kernel filesystems are mounted as explained in Section 6.2.2, “Mounting and Populating /dev” and Section 6.2.3, “Mounting Virtual Kernel File Systems” and enter chroot again before continuing with the installation.
It is time to create some structure in the LFS file system. Create a standard directory tree by issuing the following commands:
mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt} mkdir -pv /{media/{floppy,cdrom},sbin,srv,var} install -dv -m 0750 /root install -dv -m 1777 /tmp /var/tmp mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src} mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man} mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo} mkdir -v /usr/libexec mkdir -pv /usr/{,local/}share/man/man{1..8} case $(uname -m) in x86_64) mkdir -v /lib64 ;; esac mkdir -v /var/{log,mail,spool} ln -sv /run /var/run ln -sv /run/lock /var/lock mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}
Directories are, by default, created with permission mode 755,
but this is not desirable for all directories. In the commands
above, two changes are made—one to the home directory of
user root
, and another to the
directories for temporary files.
The first mode change ensures that not just anybody can enter
the /root
directory—the
same as a normal user would do with his or her home directory.
The second mode change makes sure that any user can write to
the /tmp
and /var/tmp
directories, but cannot remove
another user's files from them. The latter is prohibited by the
so-called “sticky
bit,” the highest bit (1) in the 1777 bit
mask.
The directory tree is based on the Filesystem Hierarchy
Standard (FHS) (available at https://wiki.linuxfoundation.org/en/FHS).
The FHS also specifies the optional existence of some
directories such as /usr/local/games
and /usr/share/games
. We create only the
directories that are needed. However, feel free to create
these directories.
Some programs use hard-wired paths to programs which do not exist yet. In order to satisfy these programs, create a number of symbolic links which will be replaced by real files throughout the course of this chapter after the software has been installed:
ln -sv /tools/bin/{bash,cat,dd,echo,ln,pwd,rm,stty} /bin ln -sv /tools/bin/{install,perl} /usr/bin ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib ln -sv /tools/lib/libstdc++.{a,so{,.6}} /usr/lib ln -sv bash /bin/sh
The purpose of each link:
/bin/bash
Many bash
scripts specify /bin/bash
.
/bin/cat
This pathname is hard-coded into Glibc's configure script.
/bin/dd
The path to dd
will be
hard-coded into the /usr/bin/libtool
utility.
/bin/echo
This is to satisfy one of the tests in Glibc's test
suite, which expects /bin/echo
.
/usr/bin/install
The path to install
will be
hard-coded into the /usr/lib/bash/Makefile.inc
file.
/bin/ln
The path to ln
will be
hard-coded into the /usr/lib/perl5/5.26.1/<target-triplet>/Config_heavy.pl
file.
/bin/pwd
Some configure scripts, particularly Glibc's, have this pathname hard-coded.
/bin/rm
The path to rm
will be
hard-coded into the /usr/lib/perl5/5.26.1/<target-triplet>/Config_heavy.pl
file.
/bin/stty
This pathname is hard-coded into Expect, therefore it is needed for Binutils and GCC test suites to pass.
/usr/bin/perl
Many Perl scripts hard-code this path to the perl program.
/usr/lib/libgcc_s.so{,.1}
Glibc needs this for the pthreads library to work.
/usr/lib/libstdc++{,.6}
This is needed by several tests in Glibc's test suite, as well as for C++ support in GMP.
/bin/sh
Many shell scripts hard-code /bin/sh
.
Historically, Linux maintains a list of the mounted file
systems in the file /etc/mtab
.
Modern kernels maintain this list internally and exposes it to
the user via the /proc
filesystem. To satisfy utilities that expect the presence of
/etc/mtab
, create the following
symbolic link:
ln -sv /proc/self/mounts /etc/mtab
In order for user root
to be
able to login and for the name “root” to
be recognized, there must be relevant entries in the
/etc/passwd
and /etc/group
files.
Create the /etc/passwd
file by
running the following command:
cat > /etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
EOF
The actual password for root
(the “x” used here is just a placeholder)
will be set later.
Create the /etc/group
file by
running the following command:
cat > /etc/group << "EOF"
root:x:0:
bin:x:1:daemon
sys:x:2:
kmem:x:3:
tape:x:4:
tty:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
adm:x:16:
messagebus:x:18:
systemd-journal:x:23:
input:x:24:
mail:x:34:
nogroup:x:99:
users:x:999:
EOF
The created groups are not part of any standard—they are
groups decided on in part by the requirements of the Udev
configuration in this chapter, and in part by common convention
employed by a number of existing Linux distributions. In
addition, some test suites rely on specific users or groups.
The Linux Standard Base (LSB, available at http://www.linuxbase.org)
recommends only that, besides the group root
with a Group ID (GID) of 0, a group
bin
with a GID of 1 be present.
All other group names and GIDs can be chosen freely by the
system administrator since well-written programs do not depend
on GID numbers, but rather use the group's name.
To remove the “I
have no name!” prompt, start a new shell.
Since a full Glibc was installed in Chapter 5
and the /etc/passwd
and
/etc/group
files have been
created, user name and group name resolution will now work:
exec /tools/bin/bash --login +h
Note the use of the +h
directive. This tells bash not to use its internal
path hashing. Without this directive, bash would remember the paths
to binaries it has executed. To ensure the use of the newly
compiled binaries as soon as they are installed, the +h
directive will be used for the
duration of this chapter.
The login, agetty, and init programs (and others) use a number of log files to record information such as who was logged into the system and when. However, these programs will not write to the log files if they do not already exist. Initialize the log files and give them proper permissions:
touch /var/log/{btmp,lastlog,faillog,wtmp} chgrp -v utmp /var/log/lastlog chmod -v 664 /var/log/lastlog chmod -v 600 /var/log/btmp
The /var/log/wtmp
file records
all logins and logouts. The /var/log/lastlog
file records when each user
last logged in. The /var/log/faillog
file records failed login
attempts. The /var/log/btmp
file
records the bad login attempts.
The /run/utmp
file records the
users that are currently logged in. This file is created
dynamically in the boot scripts.
The Linux API Headers (in linux-4.15.3.tar.xz) expose the kernel's API for use by Glibc.
The Linux kernel needs to expose an Application Programming Interface (API) for the system's C library (Glibc in LFS) to use. This is done by way of sanitizing various C header files that are shipped in the Linux kernel source tarball.
Make sure there are no stale files and dependencies lying around from previous activity:
make mrproper
Now extract the user-visible kernel headers from the source. They are placed in an intermediate local directory and copied to the needed location because the extraction process removes any existing files in the target directory. There are also some hidden files used by the kernel developers and not needed by LFS that are removed from the intermediate directory.
make INSTALL_HDR_PATH=dest headers_install find dest/include \( -name .install -o -name ..install.cmd \) -delete cp -rv dest/include/* /usr/include
The Man-pages package contains over 2,200 man pages.
Install Man-pages by running:
make install
The Glibc package contains the main C library. This library provides the basic routines for allocating memory, searching directories, opening and closing files, reading and writing files, string handling, pattern matching, arithmetic, and so on.
The Glibc build system is self-contained and will install
perfectly, even though the compiler specs file and linker
are still pointing to /tools
.
The specs and linker cannot be adjusted before the Glibc
install because the Glibc autoconf tests would give false
results and defeat the goal of achieving a clean build.
Some of the Glibc programs use the non-FHS compilant
/var/db
directory to store
their runtime data. Apply the following patch to make such
programs store their runtime data in the FHS-compliant
locations:
patch -Np1 -i ../glibc-2.27-fhs-1.patch
First create a compatibility symlink to avoid references to /tools in our final glibc:
ln -sfv /tools/lib/gcc /usr/lib
Determine the GCC include directory and create a symlink for LSB compliance. Additionally, for x86_64, create a compatibility symlink required for the dynamic loader to function correctly:
case $(uname -m) in i?86) GCC_INCDIR=/usr/lib/gcc/$(uname -m)-pc-linux-gnu/7.3.0/include ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3 ;; x86_64) GCC_INCDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64 ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3 ;; esac
Remove a file that may be left over from a previous build attempt:
rm -f /usr/include/limits.h
The Glibc documentation recommends building Glibc in a dedicated build directory:
mkdir -v build cd build
Prepare Glibc for compilation:
CC="gcc -isystem $GCC_INCDIR -isystem /usr/include" \ ../configure --prefix=/usr \ --disable-werror \ --enable-kernel=3.2 \ --enable-stack-protector=strong \ libc_cv_slibdir=/lib unset GCC_INCDIR
The meaning of the options and new configure parameters:
CC="gcc
-isystem $GCC_INCDIR -isystem
/usr/include"
Setting the location of both gcc and system include directories avoids introduction of invalid paths in debugging symbols.
--disable-werror
This option disables the -Werror option passed to GCC. This is necessary for running the test suite.
--enable-stack-protector=strong
This option increases system security by adding extra code to check for buffer overflows, such as stack smashing attacks.
libc_cv_slibdir=/lib
This variable sets the correct library for all systems. We do not want lib64 to be used.
Compile the package:
make
In this section, the test suite for Glibc is considered critical. Do not skip it under any circumstance.
Generally a few tests do not pass. The test failures listed below are usually safe to ignore.
make check
You may see some test failures. The Glibc test suite is somewhat dependent on the host system. This is a list of the most common issues seen for some versions of LFS:
misc/tst-ttyname is known to fail in the LFS chroot environment.
posix/tst-getaddrinfo4 and posix/tst-getaddrinfo5 may fail on some architectures.
Though it is a harmless message, the install stage of Glibc
will complain about the absence of /etc/ld.so.conf
. Prevent this warning with:
touch /etc/ld.so.conf
Fix the generated Makefile to skip an unneeded sanity check that fails in the LFS partial environment:
sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
Install the package:
make install
Install the configuration file and runtime directory for nscd:
cp -v ../nscd/nscd.conf /etc/nscd.conf mkdir -pv /var/cache/nscd
Next, install the locales that can make the system respond in a different language. None of the locales are required, but if some of them are missing, the test suites of future packages would skip important testcases.
Individual locales can be installed using the localedef program. E.g.,
the first localedef command below
combines the /usr/share/i18n/locales/cs_CZ
charset-independent locale definition with the /usr/share/i18n/charmaps/UTF-8.gz
charmap
definition and appends the result to the /usr/lib/locale/locale-archive
file. The
following instructions will install the minimum set of
locales necessary for the optimal coverage of tests:
mkdir -pv /usr/lib/locale localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8 localedef -i de_DE -f ISO-8859-1 de_DE localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro localedef -i de_DE -f UTF-8 de_DE.UTF-8 localedef -i en_GB -f UTF-8 en_GB.UTF-8 localedef -i en_HK -f ISO-8859-1 en_HK localedef -i en_PH -f ISO-8859-1 en_PH localedef -i en_US -f ISO-8859-1 en_US localedef -i en_US -f UTF-8 en_US.UTF-8 localedef -i es_MX -f ISO-8859-1 es_MX localedef -i fa_IR -f UTF-8 fa_IR localedef -i fr_FR -f ISO-8859-1 fr_FR localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro localedef -i fr_FR -f UTF-8 fr_FR.UTF-8 localedef -i it_IT -f ISO-8859-1 it_IT localedef -i it_IT -f UTF-8 it_IT.UTF-8 localedef -i ja_JP -f EUC-JP ja_JP localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R localedef -i ru_RU -f UTF-8 ru_RU.UTF-8 localedef -i tr_TR -f UTF-8 tr_TR.UTF-8 localedef -i zh_CN -f GB18030 zh_CN.GB18030
In addition, install the locale for your own country, language and character set.
Alternatively, install all locales listed in the glibc-2.27/localedata/SUPPORTED
file (it
includes every locale listed above and many more) at once
with the following time-consuming command:
make localedata/install-locales
Then use the localedef command to create
and install locales not listed in the glibc-2.27/localedata/SUPPORTED
file in the
unlikely case you need them.
The /etc/nsswitch.conf
file
needs to be created because the Glibc defaults do not work
well in a networked environment.
Create a new file /etc/nsswitch.conf
by running the
following:
cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
# End /etc/nsswitch.conf
EOF
Install and set up the time zone data with the following:
tar -xf ../../tzdata2018c.tar.gz ZONEINFO=/usr/share/zoneinfo mkdir -pv $ZONEINFO/{posix,right} for tz in etcetera southamerica northamerica europe africa antarctica \ asia australasia backward pacificnew systemv; do zic -L /dev/null -d $ZONEINFO -y "sh yearistype.sh" ${tz} zic -L /dev/null -d $ZONEINFO/posix -y "sh yearistype.sh" ${tz} zic -L leapseconds -d $ZONEINFO/right -y "sh yearistype.sh" ${tz} done cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO zic -d $ZONEINFO -p America/New_York unset ZONEINFO
The meaning of the zic commands:
zic -L
/dev/null ...
This creates posix time zones, without any leap
seconds. It is conventional to put these in both
zoneinfo
and
zoneinfo/posix
. It is
necessary to put the POSIX time zones in zoneinfo
, otherwise various
test-suites will report errors. On an embedded
system, where space is tight and you do not intend to
ever update the time zones, you could save 1.9MB by
not using the posix
directory, but some applications or test-suites might
produce some failures.
zic -L
leapseconds ...
This creates right time zones, including leap
seconds. On an embedded system, where space is tight
and you do not intend to ever update the time zones,
or care about the correct time, you could save 1.9MB
by omitting the right
directory.
zic ...
-p ...
This creates the posixrules
file. We use New York
because POSIX requires the daylight savings time
rules to be in accordance with US rules.
One way to determine the local time zone is to run the following script:
tzselect
After answering a few questions about the location, the
script will output the name of the time zone (e.g.,
America/Edmonton).
There are also some other possible time zones listed in
/usr/share/zoneinfo
such as
Canada/Eastern or
EST5EDT that are not
identified by the script but can be used.
Then create the /etc/localtime
file by running:
cp -v /usr/share/zoneinfo/<xxx>
/etc/localtime
Replace <xxx>
with the name
of the time zone selected (e.g., Canada/Eastern).
By default, the dynamic loader (/lib/ld-linux.so.2
) searches through
/lib
and /usr/lib
for dynamic libraries that are
needed by programs as they are run. However, if there are
libraries in directories other than /lib
and /usr/lib
, these need to be added to the
/etc/ld.so.conf
file in order
for the dynamic loader to find them. Two directories that
are commonly known to contain additional libraries are
/usr/local/lib
and
/opt/lib
, so add those
directories to the dynamic loader's search path.
Create a new file /etc/ld.so.conf
by running the following:
cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf
/usr/local/lib
/opt/lib
EOF
If desired, the dynamic loader can also search a directory and include the contents of files found there. Generally the files in this include directory are one line specifying the desired library path. To add this capability run the following commands:
cat >> /etc/ld.so.conf << "EOF"
# Add an include directory
include /etc/ld.so.conf.d/*.conf
EOF
mkdir -pv /etc/ld.so.conf.d
|
Can be used to create a stack trace when a program terminates with a segmentation fault |
|
|
Generates message catalogues |
|
|
Displays the system configuration values for file system specific variables |
|
|
Gets entries from an administrative database |
|
|
Performs character set conversion |
|
|
Creates fastloading iconv module configuration files |
|
|
Configures the dynamic linker runtime bindings |
|
|
Reports which shared libraries are required by each given program or shared library |
|
|
Assists ldd with object files |
|
|
Prints various information about the current locale |
|
|
Compiles locale specifications |
|
|
Creates a simple database from textual input |
|
|
Reads and interprets a memory trace file and displays a summary in human-readable format |
|
|
A daemon that provides a cache for the most common name service requests |
|
|
Lists dynamic shared objects used by running processes |
|
|
A statically linked ln program |
|
|
Traces shared library procedure calls of a specified command |
|
|
Reads and displays shared object profiling data |
|
|
Asks the user about the location of the system and reports the corresponding time zone description |
|
|
Traces the execution of a program by printing the currently executed function |
|
|
The time zone dumper |
|
|
The time zone compiler |
|
|
The helper program for shared library executables |
|
|
Used internally by Glibc as a gross hack to get
broken programs (e.g., some Motif applications)
running. See comments in |
|
|
The segmentation fault signal handler, used by catchsegv |
|
|
An asynchronous name lookup library |
|
|
The main C library |
|
|
Used internally by Glibc for handling
internationalized domain names in the |
|
|
The cryptography library |
|
|
The dynamic linking interface library |
|
|
Dummy library containing no functions. Previously was a runtime library for g++ |
|
|
Linking in this module forces error handling rules for math functions as defined by the Institute of Electrical and Electronic Engineers (IEEE). The default is POSIX.1 error handling |
|
|
The mathematical library |
|
|
Turns on memory allocation checking when linked to |
|
|
Used by memusage to help collect information about the memory usage of a program |
|
|
The network services library |
|
|
The Name Service Switch libraries, containing functions for resolving host names, user names, group names, aliases, services, protocols, etc. |
|
|
The POSIX threads library |
|
|
Contains functions for creating, sending, and interpreting packets to the Internet domain name servers |
|
|
Contains functions providing miscellaneous RPC services |
|
|
Contains functions providing most of the interfaces specified by the POSIX.1b Realtime Extension |
|
|
Contains functions useful for building debuggers for multi-threaded programs |
|
|
Contains code for “standard” functions used in many different Unix utilities |
Now that the final C libraries have been installed, it is time to adjust the toolchain so that it will link any newly compiled program against these new libraries.
First, backup the /tools
linker,
and replace it with the adjusted linker we made in chapter 5.
We'll also create a link to its counterpart in /tools/$(uname -m)-pc-linux-gnu/bin
:
mv -v /tools/bin/{ld,ld-old} 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
Next, amend the GCC specs file so that it points to the new dynamic linker. Simply deleting all instances of “/tools” 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. A sed command accomplishes this:
gcc -dumpspecs | sed -e 's@/tools@@g' \ -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \ -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \ `dirname $(gcc --print-libgcc-file-name)`/specs
It is a good idea to visually inspect the specs file to verify the intended change was actually made.
It is imperative at this point to ensure that the basic functions (compiling and linking) of the adjusted toolchain are working as expected. To do this, perform the following sanity checks:
echo 'int main(){}' > dummy.c cc dummy.c -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib'
There should be no errors, and the output of the last command will be (allowing for platform-specific differences in dynamic linker name):
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
Note that on 64-bit systems /lib
is the location of our dynamic linker, but is accessed via a
symbolic link in /lib64.
On 32-bit systems the interpreter should be /lib/ld-linux.so.2.
Now make sure that we're setup to use the correct start files:
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
The output of the last command should be:
/usr/lib/../lib/crt1.o succeeded
/usr/lib/../lib/crti.o succeeded
/usr/lib/../lib/crtn.o succeeded
Verify that the compiler is searching for the correct header files:
grep -B1 '^ /usr/include' dummy.log
This command should return the following output:
#include <...> search starts here:
/usr/include
Next, verify that the new linker is being used with the correct search paths:
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
References to paths that have components with '-linux-gnu' should be ignored, but otherwise the output of the last command should be:
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib")
Next make sure that we're using the correct libc:
grep "/lib.*/libc.so.6 " dummy.log
The output of the last command should be:
attempt to open /lib/libc.so.6 succeeded
Lastly, make sure GCC is using the correct dynamic linker:
grep found dummy.log
The output of the last command should be (allowing for platform-specific differences in dynamic linker name):
found ld-linux-x86-64.so.2 at /lib/ld-linux-x86-64.so.2
If the output does not appear as shown above or is not received at all, then something is seriously wrong. Investigate and retrace the steps to find out where the problem is and correct it. The most likely reason is that something went wrong with the specs file adjustment. Any issues will need to be resolved before continuing with the process.
Once everything is working correctly, clean up the test files:
rm -v dummy.c a.out dummy.log
The Zlib package contains compression and decompression routines used by some programs.
Prepare Zlib for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The shared library needs to be moved to /lib
, and as a result the .so
file in /usr/lib
will need to be recreated:
mv -v /usr/lib/libz.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so
The File package contains a utility for determining the type of a given file or files.
Prepare File for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Readline package is a set of libraries that offers command-line editing and history capabilities.
Reinstalling Readline will cause the old libraries to be moved to <libraryname>.old. While this is normally not a problem, in some cases it can trigger a linking bug in ldconfig. This can be avoided by issuing the following two seds:
sed -i '/MV.*old/d' Makefile.in sed -i '/{OLDSUFF}/c:' support/shlib-install
Prepare Readline for compilation:
./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/readline-7.0
Compile the package:
make SHLIB_LIBS="-L/tools/lib -lncursesw"
The meaning of the make option:
SHLIB_LIBS="-L/tools/lib
-lncursesw"
This option forces Readline to link against the
libncursesw
library.
This package does not come with a test suite.
Install the package:
make SHLIB_LIBS="-L/tools/lib -lncurses" install
Now move the dynamic libraries to a more appropriate location and fix up some symbolic links:
mv -v /usr/lib/lib{readline,history}.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.so ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so
If desired, install the documentation:
install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-7.0
The M4 package contains a macro processor.
Prepare M4 for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
|
Copies the given files while expanding the macros that they contain [These macros are either built-in or user-defined and can take any number of arguments. Besides performing macro expansion, m4 has built-in functions for including named files, running Unix commands, performing integer arithmetic, manipulating text, recursion, etc. The m4 program can be used either as a front-end to a compiler or as a macro processor in its own right.] |
The Bc package contains an arbitrary precision numeric processing language.
First, change an internal script to use sed instead of ed:
cat > bc/fix-libmath_h << "EOF" #! /bin/bash sed -e '1 s/^/{"/' \ -e 's/$/",/' \ -e '2,$ s/^/"/' \ -e '$ d' \ -i libmath.h sed -e '$ s/$/0}/' \ -i libmath.h EOF
Create temporary symbolic links so the package can find the readline library and confirm that its required libncurses library is available. Even though the libraries are in /tools/lib at this point, the system will use /usr/lib at the end of this chapter.
ln -sv /tools/lib/libncursesw.so.6 /usr/lib/libncursesw.so.6 ln -sfv libncurses.so.6 /usr/lib/libncurses.so
Fix an issue in configure due to missing files in the early stages of LFS:
sed -i -e '/flex/s/as_fn_error/: ;; # &/' configure
Prepare Bc for compilation:
./configure --prefix=/usr \ --with-readline \ --mandir=/usr/share/man \ --infodir=/usr/share/info
The meaning of the configure options:
--with-readline
This option tells Bc to use the readline
library that is already
installed on the system rather than using its own
readline version.
Compile the package:
make
To test bc, run the commands below. There is quite a bit of output, so you may want to redirect it to a file. There are a very small percentage of tests (10 of 12,144) that will indicate a round off error at the last digit.
echo "quit" | ./bc/bc -l Test/checklib.b
Install the package:
make install
The Binutils package contains a linker, an assembler, and other tools for handling object files.
Verify that the PTYs are working properly inside the chroot environment by performing a simple test:
expect -c "spawn ls"
This command should output the following:
spawn ls
If, instead, the output includes the message below, then the environment is not set up for proper PTY operation. This issue needs to be resolved before running the test suites for Binutils and GCC:
The system has no more ptys.
Ask your system administrator to create more.
The Binutils documentation recommends building Binutils in a dedicated build directory:
mkdir -v build cd build
Prepare Binutils for compilation:
../configure --prefix=/usr \ --enable-gold \ --enable-ld=default \ --enable-plugins \ --enable-shared \ --disable-werror \ --enable-64-bit-bfd \ --with-system-zlib
The meaning of the configure parameters:
--enable-gold
Build the gold linker and install it as ld.gold (along side the default linker).
--enable-ld=default
Build the original bdf linker and install it as both ld (the default linker) and ld.bfd.
--enable-plugins
Enables plugin support for the linker.
--enable-64-bit-bfd
Enables 64-bit support (on hosts with narrower word sizes). May not be needed on 64-bit systems, but does no harm.
--with-system-zlib
Use the installed zlib library rather than building the included version.
Compile the package:
make tooldir=/usr
The meaning of the make parameter:
tooldir=/usr
Normally, the tooldir (the directory where the
executables will ultimately be located) is set to
$(exec_prefix)/$(target_alias)
. For
example, x86_64 machines would expand that to
/usr/x86_64-unknown-linux-gnu
.
Because this is a custom system, this target-specific
directory in /usr
is not
required. $(exec_prefix)/$(target_alias)
would
be used if the system was used to cross-compile (for
example, compiling a package on an Intel machine that
generates code that can be executed on PowerPC
machines).
The test suite for Binutils in this section is considered critical. Do not skip it under any circumstances.
Test the results:
make -k check
One test, debug_msg.sh, is known to fail.
Install the package:
make tooldir=/usr install
|
Translates program addresses to file names and line numbers; given an address and the name of an executable, it uses the debugging information in the executable to determine which source file and line number are associated with the address |
|
|
Creates, modifies, and extracts from archives |
|
|
An assembler that assembles the output of gcc into object files |
|
|
Used by the linker to de-mangle C++ and Java symbols and to keep overloaded functions from clashing |
|
|
Updates the ELF header of ELF files |
|
|
Displays call graph profile data |
|
|
A linker that combines a number of object and archive files into a single file, relocating their data and tying up symbol references |
|
|
A cut down version of ld that only supports the elf object file format |
|
|
Hard link to ld |
|
|
Lists the symbols occurring in a given object file |
|
|
Translates one type of object file into another |
|
|
Displays information about the given object file, with options controlling the particular information to display; the information shown is useful to programmers who are working on the compilation tools |
|
|
Generates an index of the contents of an archive and stores it in the archive; the index lists all of the symbols defined by archive members that are relocatable object files |
|
|
Displays information about ELF type binaries |
|
|
Lists the section sizes and the total size for the given object files |
|
|
Outputs, for each given file, the sequences of printable characters that are of at least the specified length (defaulting to four); for object files, it prints, by default, only the strings from the initializing and loading sections while for other types of files, it scans the entire file |
|
|
Discards symbols from object files |
|
|
The Binary File Descriptor library |
|
|
A library for dealing with opcodes—the “readable text” versions of instructions for the processor; it is used for building utilities like objdump |
The GMP package contains math libraries. These have useful functions for arbitrary precision arithmetic.
If you are building for 32-bit x86, but you have a CPU
which is capable of running 64-bit code and you have specified
CFLAGS
in the environment, the
configure script will attempt to configure for 64-bits and
fail. Avoid this by invoking the configure command below
with
ABI=32
./configure ...
The default settings of GMP produce libraries optimized for the host processor. If libraries suitable for processors less capable than the host's CPU are desired, generic libraries can be created by running the following:
cp -v configfsf.guess config.guess cp -v configfsf.sub config.sub
Prepare GMP for compilation:
./configure --prefix=/usr \ --enable-cxx \ --disable-static \ --docdir=/usr/share/doc/gmp-6.1.2
The meaning of the new configure options:
--enable-cxx
This parameter enables C++ support
--docdir=/usr/share/doc/gmp-6.1.2
This variable specifies the correct place for the documentation.
Compile the package and generate the HTML documentation:
make make html
The test suite for GMP in this section is considered critical. Do not skip it under any circumstances.
Test the results:
make check 2>&1 | tee gmp-check-log
The code in gmp is highly optimized for the processor where it is built. Occasionally, the code that detects the processor misidentifies the system capabilities and there will be errors in the tests or other applications using the gmp libraries with the message "Illegal instruction". In this case, gmp should be reconfigured with the option --build=x86_64-unknown-linux-gnu and rebuilt.
Ensure that all 190 tests in the test suite passed. Check the results by issuing the following command:
awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log
Install the package and its documentation:
make install make install-html
The MPFR package contains functions for multiple precision math.
Prepare MPFR for compilation:
./configure --prefix=/usr \ --disable-static \ --enable-thread-safe \ --docdir=/usr/share/doc/mpfr-4.0.1
Compile the package and generate the HTML documentation:
make make html
The test suite for MPFR in this section is considered critical. Do not skip it under any circumstances.
Test the results and ensure that all tests passed:
make check
Install the package and its documentation:
make install make install-html
The MPC package contains a library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result.
Prepare MPC for compilation:
./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/mpc-1.1.0
Compile the package and generate the HTML documentation:
make make html
To test the results, issue:
make check
Install the package and its documentation:
make install make install-html
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
If building on x86_64, change the default directory name for 64-bit libraries to “lib”:
case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' \ -i.orig gcc/config/i386/t-linux64 ;; esac
Remove the symlink created earlier as the final gcc includes will be installed here:
rm -f /usr/lib/gcc
The GCC documentation recommends building GCC in a dedicated build directory:
mkdir -v build cd build
Prepare GCC for compilation:
SED=sed \ ../configure --prefix=/usr \ --enable-languages=c,c++ \ --disable-multilib \ --disable-bootstrap \ --with-system-zlib
Note that for other languages, there are some prerequisites that are not yet available. See the BLFS Book for instructions on how to build all of GCC's supported languages.
The meaning of the new configure parameters:
SED=sed
Setting this environment variable prevents a hard-coded path to /tools/bin/sed.
--with-system-zlib
This switch tells GCC to link to the system installed copy of the Zlib library, rather than its own internal copy.
Compile the package:
make
In this section, the test suite for GCC is considered critical. Do not skip it under any circumstance.
One set of tests in the GCC test suite is known to exhaust the stack, so increase the stack size prior to running the tests:
ulimit -s 32768
Test the results, but do not stop at errors:
make -k check
To receive a summary of the test suite results, run:
../contrib/test_summary
For only the summaries, pipe the output through
grep -A7
Summ
.
Results can be compared with those located at http://www.linuxfromscratch.org/lfs/build-logs/8.2/ and http://gcc.gnu.org/ml/gcc-testresults/.
A few unexpected failures cannot always be avoided. The GCC developers are usually aware of these issues, but have not resolved them yet. In particular, six tests in the libstdc++ test suite are known to fail when running as the root user as we do here. Unless the test results are vastly different from those at the above URL, it is safe to continue.
On some combinations of kernel configuration and AMD processors there may be more than 1100 failures in the gcc.target/i386/mpx tests (which are designed to test the MPX option on recent Intel processors). These can safely be ignored on AMD processors.
Install the package:
make install
Create a symlink required by the FHS for "historical" reasons.
ln -sv ../usr/bin/cpp /lib
Many packages use the name cc to call the C compiler. To satisfy those packages, create a symlink:
ln -sv gcc /usr/bin/cc
Add a compatibility symlink to enable building programs with Link Time Optimization (LTO):
install -v -dm755 /usr/lib/bfd-plugins ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/7.3.0/liblto_plugin.so \ /usr/lib/bfd-plugins/
Now that our final toolchain is in place, it is important to again ensure that compiling and linking will work as expected. We do this by performing the same sanity checks as we did earlier in the chapter:
echo 'int main(){}' > dummy.c cc dummy.c -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib'
There should be no errors, and the output of the last command will be (allowing for platform-specific differences in dynamic linker name):
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
Now make sure that we're setup to use the correct start files:
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
The output of the last command should be:
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../lib/crt1.o succeeded
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../lib/crti.o succeeded
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../lib/crtn.o succeeded
Depending on your machine architecture, the above may differ
slightly, the difference usually being the name of the
directory after /usr/lib/gcc
.
The important thing to look for here is that gcc has found all three
crt*.o
files under the
/usr/lib
directory.
Verify that the compiler is searching for the correct header files:
grep -B4 '^ /usr/include' dummy.log
This command should return the following output:
#include <...> search starts here:
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include
/usr/local/include
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include-fixed
/usr/include
Again, note that the directory named after your target triplet may be different than the above, depending on your architecture.
Next, verify that the new linker is being used with the correct search paths:
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
References to paths that have components with '-linux-gnu' should be ignored, but otherwise the output of the last command should be:
SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64")
SEARCH_DIR("/usr/local/lib64")
SEARCH_DIR("/lib64")
SEARCH_DIR("/usr/lib64")
SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/lib");
A 32-bit system may see a few different directories. For example, here is the output from an i686 machine:
SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32")
SEARCH_DIR("/usr/local/lib32")
SEARCH_DIR("/lib32")
SEARCH_DIR("/usr/lib32")
SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/lib");
Next make sure that we're using the correct libc:
grep "/lib.*/libc.so.6 " dummy.log
The output of the last command should be:
attempt to open /lib/libc.so.6 succeeded
Lastly, make sure GCC is using the correct dynamic linker:
grep found dummy.log
The output of the last command should be (allowing for platform-specific differences in dynamic linker name):
found ld-linux-x86-64.so.2 at /lib/ld-linux-x86-64.so.2
If the output does not appear as shown above or is not received at all, then something is seriously wrong. Investigate and retrace the steps to find out where the problem is and correct it. The most likely reason is that something went wrong with the specs file adjustment. Any issues will need to be resolved before continuing with the process.
Once everything is working correctly, clean up the test files:
rm -v dummy.c a.out dummy.log
Finally, move a misplaced file:
mkdir -pv /usr/share/gdb/auto-load/usr/lib mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
|
The C++ compiler |
|
|
The C compiler |
|
|
The C preprocessor; it is used by the compiler to expand the #include, #define, and similar statements in the source files |
|
|
The C++ compiler |
|
|
The C compiler |
|
|
A wrapper around ar that adds a plugin to the command line. This program is only used to add "link time optimization" and is not useful with the default build options |
|
|
A wrapper around nm that adds a plugin to the command line. This program is only used to add "link time optimization" and is not useful with the default build options |
|
|
A wrapper around ranlib that adds a plugin to the command line. This program is only used to add "link time optimization" and is not useful with the default build options |
|
|
A coverage testing tool; it is used to analyze programs to determine where optimizations will have the most effect |
|
|
The Address Sanitizer runtime library |
|
|
Contains run-time support for gcc |
|
|
This library is linked in to a program when GCC is instructed to enable profiling |
|
|
GNU implementation of the OpenMP API for multi-platform shared-memory parallel programming in C/C++ and Fortran |
|
|
Contains routines used by various GNU programs, including getopt, obstack, strerror, strtol, and strtoul |
|
|
GCC's Link Time Optimization (LTO) plugin allows GCC to perform optimizations across compilation units |
|
|
GCC Quad Precision Math Library API |
|
|
Contains routines supporting GCC's stack-smashing protection functionality |
|
|
The standard C++ library |
|
|
Provides supporting routines for the C++ programming language |
|
|
The Thread Sanitizer runtime library |
The Bzip2 package contains programs for compressing and decompressing files. Compressing text files with bzip2 yields a much better compression percentage than with the traditional gzip.
Apply a patch that will install the documentation for this package:
patch -Np1 -i ../bzip2-1.0.6-install_docs-1.patch
The following command ensures installation of symbolic links are relative:
sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
Ensure the man pages are installed into the correct location:
sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
Prepare Bzip2 for compilation with:
make -f Makefile-libbz2_so make clean
The meaning of the make parameter:
-f
Makefile-libbz2_so
This will cause Bzip2 to be built using a different
Makefile
file, in this
case the Makefile-libbz2_so
file, which
creates a dynamic libbz2.so
library and links the Bzip2
utilities against it.
Compile and test the package:
make
Install the programs:
make PREFIX=/usr install
Install the shared bzip2 binary into the
/bin
directory, make some
necessary symbolic links, and clean up:
cp -v bzip2-shared /bin/bzip2 cp -av libbz2.so* /lib ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so rm -v /usr/bin/{bunzip2,bzcat,bzip2} ln -sv bzip2 /bin/bunzip2 ln -sv bzip2 /bin/bzcat
|
Decompresses bzipped files |
|
|
Decompresses to standard output |
|
|
Runs cmp on bzipped files |
|
|
Runs diff on bzipped files |
|
|
Runs egrep on bzipped files |
|
|
Runs fgrep on bzipped files |
|
|
Runs grep on bzipped files |
|
|
Compresses files using the Burrows-Wheeler block sorting text compression algorithm with Huffman coding; the compression rate is better than that achieved by more conventional compressors using “Lempel-Ziv” algorithms, like gzip |
|
|
Tries to recover data from damaged bzipped files |
|
|
Runs less on bzipped files |
|
|
Runs more on bzipped files |
|
|
The library implementing lossless, block-sorting data compression, using the Burrows-Wheeler algorithm |
The pkg-config package contains a tool for passing the include path and/or library paths to build tools during the configure and make file execution.
Prepare Pkg-config for compilation:
./configure --prefix=/usr \ --with-internal-glib \ --disable-host-tool \ --docdir=/usr/share/doc/pkg-config-0.29.2
The meaning of the new configure options:
--with-internal-glib
This will allow pkg-config to use its internal version of Glib because an external version is not available in LFS.
--disable-host-tool
This option disables the creation of an undesired hard link to the pkg-config program.
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Ncurses package contains libraries for terminal-independent handling of character screens.
Don't install a static library that is not handled by configure:
sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in
Prepare Ncurses for compilation:
./configure --prefix=/usr \ --mandir=/usr/share/man \ --with-shared \ --without-debug \ --without-normal \ --enable-pc-files \ --enable-widec
The meaning of the new configure options:
--enable-widec
This switch causes wide-character libraries (e.g.,
libncursesw.so.6.1
) to be
built instead of normal ones (e.g., libncurses.so.6.1
). These
wide-character libraries are usable in both multibyte
and traditional 8-bit locales, while normal libraries
work properly only in 8-bit locales. Wide-character and
normal libraries are source-compatible, but not
binary-compatible.
--enable-pc-files
This switch generates and installs .pc files for pkg-config.
--without-normal
This switch disables building and installing most static libraries.
Compile the package:
make
This package has a test suite, but it can only be run after
the package has been installed. The tests reside in the
test/
directory. See the
README
file in that directory
for further details.
Install the package:
make install
Move the shared libraries to the /lib
directory, where they are expected to
reside:
mv -v /usr/lib/libncursesw.so.6* /lib
Because the libraries have been moved, one symlink points to a non-existent file. Recreate it:
ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so
Many applications still expect the linker to be able to find non-wide-character Ncurses libraries. Trick such applications into linking with wide-character libraries by means of symlinks and linker scripts:
for lib in ncurses form panel menu ; do rm -vf /usr/lib/lib${lib}.so echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc done
Finally, make sure that old applications that look for
-lcurses
at build time are
still buildable:
rm -vf /usr/lib/libcursesw.so echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so ln -sfv libncurses.so /usr/lib/libcurses.so
If desired, install the Ncurses documentation:
mkdir -v /usr/share/doc/ncurses-6.1 cp -v -R doc/* /usr/share/doc/ncurses-6.1
The instructions above don't create non-wide-character Ncurses libraries since no package installed by compiling from sources would link against them at runtime. However, the only known binary-only applications that link against non-wide-character Ncurses libraries require version 5. If you must have such libraries because of some binary-only application or to be compliant with LSB, build the package again with the following commands:
make distclean ./configure --prefix=/usr \ --with-shared \ --without-normal \ --without-debug \ --without-cxx-binding \ --with-abi-version=5 make sources libs cp -av lib/lib*.so.5* /usr/lib
|
Converts a termcap description into a terminfo description |
|
|
Clears the screen, if possible |
|
|
Compares or prints out terminfo descriptions |
|
|
Converts a terminfo description into a termcap description |
|
|
Provides configuration information for ncurses |
|
|
Reinitializes a terminal to its default values |
|
|
Clears and sets tab stops on a terminal |
|
|
The terminfo entry-description compiler that translates a terminfo file from source format into the binary format needed for the ncurses library routines [A terminfo file contains information on the capabilities of a certain terminal.] |
|
|
Lists all available terminal types, giving the primary name and description for each |
|
|
Makes the values of terminal-dependent capabilities available to the shell; it can also be used to reset or initialize a terminal or report its long name |
|
|
Can be used to initialize terminals |
|
|
A link to |
|
|
Contains functions to display text in many complex ways on a terminal screen; a good example of the use of these functions is the menu displayed during the kernel's make menuconfig |
|
|
Contains functions to implement forms |
|
|
Contains functions to implement menus |
|
|
Contains functions to implement panels |
The attr package contains utilities to administer the extended attributes on filesystem objects.
Modify the documentation directory so that it is a versioned directory:
sed -i -e 's|/@pkg_name@|&-@pkg_version@|' include/builddefs.in
Prevent installation of manual pages that were already
installed by the man pages
package:
sed -i -e "/SUBDIRS/s|man[25]||g" man/Makefile
Fix a problem in the test procedures caused by changes in perl-5.26:
sed -i 's:{(:\\{(:' test/run
Prepare Attr for compilation:
./configure --prefix=/usr \ --bindir=/bin \ --disable-static
Compile the package:
make
The tests need to be run on a filesystem that supports extended attributes such as the ext2, ext3, or ext4 filesystems. The tests are also known to fail if running multiple simultaneous tests (-j option greater than 1). To test the results, issue:
make -j1 tests root-tests
Install the package:
make install install-dev install-lib chmod -v 755 /usr/lib/libattr.so
The shared library needs to be moved to /lib
, and as a result the .so
file in /usr/lib
will need to be recreated:
mv -v /usr/lib/libattr.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so
The Acl package contains utilities to administer Access Control Lists, which are used to define more fine-grained discretionary access rights for files and directories.
Modify the documentation directory so that it is a versioned directory:
sed -i -e 's|/@pkg_name@|&-@pkg_version@|' include/builddefs.in
Fix some broken tests:
sed -i "s:| sed.*::g" test/{sbits-restore,cp,misc}.test
Fix a problem in the test procedures caused by changes in perl-5.26:
sed -i 's/{(/\\{(/' test/run
Additionally, fix a bug that causes getfacl -e to segfault on overly long group name:
sed -i -e "/TABS-1;/a if (x > (TABS-1)) x = (TABS-1);" \ libacl/__acl_to_any_text.c
Prepare Acl for compilation:
./configure --prefix=/usr \ --bindir=/bin \ --disable-static \ --libexecdir=/usr/lib
Compile the package:
make
The Acl tests need to be run on a filesystem that supports access controls after Coreutils has been built with the Acl libraries. If desired, return to this package and run make -j1 tests after Coreutils has been built later in this chapter.
Install the package:
make install install-dev install-lib chmod -v 755 /usr/lib/libacl.so
The shared library needs to be moved to /lib
, and as a result the .so
file in /usr/lib
will need to be recreated:
mv -v /usr/lib/libacl.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so
The Libcap package implements the user-space interfaces to the POSIX 1003.1e capabilities available in Linux kernels. These capabilities are a partitioning of the all powerful root privilege into a set of distinct privileges.
Prevent a static library from being installed:
sed -i '/install.*STALIBNAME/d' libcap/Makefile
Compile the package:
make
This package does not come with a test suite.
Install the package:
make RAISE_SETFCAP=no lib=lib prefix=/usr install chmod -v 755 /usr/lib/libcap.so
The meaning of the make option:
RAISE_SETFCAP=no
This parameter skips trying to use setcap on itself. This avoids an installation error if the kernel or file system does not support extended capabilities.
lib=lib
This parameter installs the library in $prefix/lib
rather than $prefix/lib64
on x86_64. It has no
effect on x86.
The shared library needs to be moved to /lib
, and as a result the .so
file in /usr/lib
will need to be recreated:
mv -v /usr/lib/libcap.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libcap.so) /usr/lib/libcap.so
The Sed package contains a stream editor.
First fix an issue in the LFS environment and remove a failing test:
sed -i 's/usr/tools/' build-aux/help2man sed -i 's/testsuite.panic-tests.sh//' Makefile.in
Prepare Sed for compilation:
./configure --prefix=/usr --bindir=/bin
Compile the package and generate the HTML documentation:
make make html
To test the results, issue:
make check
Install the package and its documentation:
make install install -d -m755 /usr/share/doc/sed-4.4 install -m644 doc/sed.html /usr/share/doc/sed-4.4
The Shadow package contains programs for handling passwords in a secure way.
If you would like to enforce the use of strong passwords,
refer to
http://www.linuxfromscratch.org/blfs/view/8.2/postlfs/cracklib.html
for installing CrackLib prior to building Shadow. Then add
--with-libcrack
to
the configure
command below.
Disable the installation of the groups program and its man
pages, as Coreutils provides a better version. Also Prevent
the installation of manual pages that were already installed
by the man pages
package:
sed -i 's/groups$(EXEEXT) //' src/Makefile.in find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
Instead of using the default
crypt method, use the
more secure SHA-512
method of password encryption, which also allows passwords
longer than 8 characters. It is also necessary to change the
obsolete /var/spool/mail
location for user mailboxes that Shadow uses by default to
the /var/mail
location used
currently:
sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \ -e 's@/var/spool/mail@/var/mail@' etc/login.defs
If you chose to build Shadow with Cracklib support, run the following:
sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs
Make a minor change to make the first group number generated by useradd 1000:
sed -i 's/1000/999/' etc/useradd
Prepare Shadow for compilation:
./configure --sysconfdir=/etc --with-group-name-max-length=32
The meaning of the configure option:
--with-group-name-max-length=32
The maximum user name is 32 characters. Make the maximum group name the same.
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
Move a misplaced program to its proper location:
mv -v /usr/bin/passwd /bin
This package contains utilities to add, modify, and delete
users and groups; set and change their passwords; and perform
other administrative tasks. For a full explanation of what
password shadowing
means, see the doc/HOWTO
file
within the unpacked source tree. If using Shadow support,
keep in mind that programs which need to verify passwords
(display managers, FTP programs, pop3 daemons, etc.) must be
Shadow-compliant. That is, they need to be able to work with
shadowed passwords.
To enable shadowed passwords, run the following command:
pwconv
To enable shadowed group passwords, run:
grpconv
Shadow's stock configuration for the useradd utility has a few
caveats that need some explanation. First, the default action
for the useradd
utility is to create the user and a group of the same name as
the user. By default the user ID (UID) and group ID (GID)
numbers will begin with 1000. This means if you don't pass
parameters to useradd, each user will be
a member of a unique group on the system. If this behavior is
undesirable, you'll need to pass the -g
parameter to useradd. The default
parameters are stored in the /etc/default/useradd
file. You may need to
modify two parameters in this file to suit your particular
needs.
/etc/default/useradd
Parameter Explanations
GROUP=1000
This parameter sets the beginning of the group numbers
used in the /etc/group file. You can modify it to
anything you desire. Note that useradd will never
reuse a UID or GID. If the number identified in this
parameter is used, it will use the next available
number after this. Note also that if you don't have a
group 1000 on your system the first time you use
useradd
without the -g
parameter, you'll get a message displayed on the
terminal that says: useradd: unknown GID 1000
. You
may disregard this message and group number 1000 will
be used.
CREATE_MAIL_SPOOL=yes
This parameter causes useradd to create a
mailbox file for the newly created user. useradd will make the
group ownership of this file to the mail
group with 0660 permissions.
If you would prefer that these mailbox files are not
created by useradd, issue the
following command:
sed -i 's/yes/no/' /etc/default/useradd
Choose a password for user root and set it by running:
passwd root
|
Used to change the maximum number of days between obligatory password changes |
|
|
Used to change a user's full name and other information |
|
|
Used to update group passwords in batch mode |
|
|
Used to update user passwords in batch mode |
|
|
Used to change a user's default login shell |
|
|
Checks and enforces the current password expiration policy |
|
|
Is used to examine the log of login failures, to set a maximum number of failures before an account is blocked, or to reset the failure count |
|
|
Is used to add and delete members and administrators to groups |
|
|
Creates a group with the given name |
|
|
Deletes the group with the given name |
|
|
Allows a user to administer his/her own group membership list without the requirement of super user privileges. |
|
|
Is used to modify the given group's name or GID |
|
|
Verifies the integrity of the group files
|
|
|
Creates or updates the shadow group file from the normal group file |
|
|
Updates |
|
|
Reports the most recent login of all users or of a given user |
|
|
Is used by the system to let users sign on |
|
|
Is a daemon used to enforce restrictions on log-on time and ports |
|
|
Is used to set the gid mapping of a user namespace |
|
|
Is used to change the current GID during a login session |
|
|
Is used to set the uid mapping of a user namespace |
|
|
Is used to create or update an entire series of user accounts |
|
|
Displays a message that an account is not available; it is designed to be used as the default shell for accounts that have been disabled |
|
|
Is used to change the password for a user or group account |
|
|
Verifies the integrity of the password files
|
|
|
Creates or updates the shadow password file from the normal password file |
|
|
Updates |
|
|
Executes a given command while the user's GID is set to that of the given group |
|
|
Runs a shell with substitute user and group IDs |
|
|
Creates a new user with the given name, or updates the default new-user information |
|
|
Deletes the given user account |
|
|
Is used to modify the given user's login name, User Identification (UID), shell, initial group, home directory, etc. |
|
|
Edits the |
|
|
Edits the |
The Psmisc package contains programs for displaying information about running processes.
Prepare Psmisc for compilation:
./configure --prefix=/usr
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
Finally, move the killall and fuser programs to the location specified by the FHS:
mv -v /usr/bin/fuser /bin mv -v /usr/bin/killall /bin
|
Reports the Process IDs (PIDs) of processes that use the given files or file systems |
|
|
Kills processes by name; it sends a signal to all processes running any of the given commands |
|
|
Peek at file descriptors of a running process, given its PID |
|
|
Prints information about a process |
|
|
Displays running processes as a tree |
|
|
Same as pstree, except that it waits for confirmation before exiting |
The Iana-Etc package provides data for network services and protocols.
The following command converts the raw data provided by IANA
into the correct formats for the /etc/protocols
and /etc/services
data files:
make
This package does not come with a test suite.
Install the package:
make install
The Bison package contains a parser generator.
Prepare Bison for compilation:
./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.0.4
Compile the package:
make
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 checks can be run with make check. Three tests related to lalr1.cc fail for unknown reasons.
Install the package:
make install
|
Generates, from a series of rules, a program for analyzing the structure of text files; Bison is a replacement for Yacc (Yet Another Compiler Compiler) |
|
|
A wrapper for bison, meant for
programs that still call yacc instead of
bison; it calls
bison
with the |
|
|
The Yacc library containing implementations of
Yacc-compatible |
The Flex package contains a utility for generating programs that recognize patterns in text.
First, fix a problem introduced with glibc-2.26:
sed -i "/math.h/a #include <malloc.h>" src/flexdef.h
The build procedure assumes the help2man program is available to create a man page from the executable --help option. This is not present, so we use an environment variable to skip this process. Now, prepare Flex for compilation:
HELP2MAN=/tools/bin/true \ ./configure --prefix=/usr --docdir=/usr/share/doc/flex-2.6.4
Compile the package:
make
To test the results (about 0.5 SBU), issue:
make check
Install the package:
make install
A few programs do not know about flex yet and try to run its
predecessor, lex. To support those
programs, create a symbolic link named lex
that runs flex
in lex emulation mode:
ln -sv flex /usr/bin/lex
|
A tool for generating programs that recognize patterns in text; it allows for the versatility to specify the rules for pattern-finding, eradicating the need to develop a specialized program |
|
|
An extension of flex, is used for generating C++ code and classes. It is a symbolic link to flex |
|
|
A script that runs flex in lex emulation mode |
|
|
The |
The Grep package contains programs for searching through files.
Prepare Grep for compilation:
./configure --prefix=/usr --bindir=/bin
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Bash package contains the Bourne-Again SHell.
Prepare Bash for compilation:
./configure --prefix=/usr \ --docdir=/usr/share/doc/bash-4.4.18 \ --without-bash-malloc \ --with-installed-readline
The meaning of the new configure option:
--with-installed-readline
This option tells Bash to use the readline
library that is already
installed on the system rather than using its own
readline version.
Compile the package:
make
Skip down to “Install the package” if not running the test suite.
To prepare the tests, ensure that the nobody
user can write to the sources
tree:
chown -Rv nobody .
Now, run the tests as the nobody
user:
su nobody -s /bin/bash -c "PATH=$PATH make tests"
Install the package and move the main executable to
/bin
:
make install mv -vf /usr/bin/bash /bin
Run the newly compiled bash program (replacing the one that is currently being executed):
exec /bin/bash --login +h
The parameters used make the bash process an interactive login shell and continue to disable hashing so that new programs are found as they become available.
|
A widely-used command interpreter; it performs many types of expansions and substitutions on a given command line before executing it, thus making this interpreter a powerful tool |
|
|
A shell script to help the user compose and mail standard formatted bug reports concerning bash |
|
|
A symlink to the bash program; when invoked as sh, bash tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well |
The Libtool package contains the GNU generic library support script. It wraps the complexity of using shared libraries in a consistent, portable interface.
Prepare Libtool for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results (about 11.0 SBU), issue:
make check
The test time for libtool can be reduced significantly on a system with multiple cores. To do this, append TESTSUITEFLAGS=-j<N> to the line above. For instance, using -j4 can reduce the test time by over 60 percent.
Five tests are known to fail in the LFS build environment due to a circular dependency, but all tests pass if rechecked after automake is installed.
Install the package:
make install
The GDBM package contains the GNU Database Manager. It is a library of database functions that use extensible hashing and work similar to the standard UNIX dbm. The library provides primitives for storing key/data pairs, searching and retrieving the data by its key and deleting a key along with its data.
Prepare GDBM for compilation:
./configure --prefix=/usr \ --disable-static \ --enable-libgdbm-compat
The meaning of the configure option:
--enable-libgdbm-compat
This switch enables the libgdbm compatibility library to be built, as some packages outside of LFS may require the older DBM routines it provides.
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Gperf generates a perfect hash function from a key set.
Prepare Gperf for compilation:
./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1
Compile the package:
make
The tests are known to fail if running multiple simultaneous tests (-j option greater than 1). To test the results, issue:
make -j1 check
Install the package:
make install
The Expat package contains a stream oriented C library for parsing XML.
First fix a problem with the regession tests in the LFS environment:
sed -i 's|usr/bin/env |bin/|' run.sh.in
Prepare Expat for compilation:
./configure --prefix=/usr --disable-static
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
If desired, install the documentation:
install -v -dm755 /usr/share/doc/expat-2.2.5 install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-2.2.5
The Inetutils package contains programs for basic networking.
Prepare Inetutils for compilation:
./configure --prefix=/usr \ --localstatedir=/var \ --disable-logger \ --disable-whois \ --disable-rcp \ --disable-rexec \ --disable-rlogin \ --disable-rsh \ --disable-servers
The meaning of the configure options:
--disable-logger
This option prevents Inetutils from installing the logger program, which is used by scripts to pass messages to the System Log Daemon. Do not install it because Util-linux installs a more recent version.
--disable-whois
This option disables the building of the Inetutils whois client, which is out of date. Instructions for a better whois client are in the BLFS book.
--disable-r*
These parameters disable building obsolete programs that should not be used due to security issues. The functions provided by these programs can be provided by the openssh package in the BLFS book.
--disable-servers
This disables the installation of the various network servers included as part of the Inetutils package. These servers are deemed not appropriate in a basic LFS system. Some are insecure by nature and are only considered safe on trusted networks. Note that better replacements are available for many of these servers.
Compile the package:
make
To test the results, issue:
make check
One test, libls.sh, may fail in the initial chroot environment but will pass if the test is rerun after the LFS system is complete.
Install the package:
make install
Move some programs so they are available if /usr
is not accessible:
mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin mv -v /usr/bin/ifconfig /sbin
|
Show the system's DNS domain name |
|
|
Is the file transfer protocol program |
|
|
Reports or sets the name of the host |
|
|
Manages network interfaces |
|
|
Sends echo-request packets and reports how long the replies take |
|
|
A version of ping for IPv6 networks |
|
|
Is used to chat with another user |
|
|
An interface to the TELNET protocol |
|
|
A trivial file transfer program |
|
|
Traces the route your packets take from the host you are working on to another host on a network, showing all the intermediate hops (gateways) along the way |
The Perl package contains the Practical Extraction and Report Language.
First create a basic /etc/hosts
file to be referenced in one of Perl's configuration files as
well as the optional test suite:
echo "<IP_ADDRESS> localhost $(hostname)" > /etc/hosts
This version of Perl now builds the Compress::Raw::Zlib and Compress::Raw::BZip2 modules. By default Perl will use an internal copy of the sources for the build. Issue the following command so that Perl will use the libraries installed on the system:
export BUILD_ZLIB=False export BUILD_BZIP2=0
To have full control over the way Perl is set up, you can remove the “-des” options from the following command and hand-pick the way this package is built. Alternatively, use the command exactly as below to use the defaults that Perl auto-detects:
sh Configure -des -Dprefix=/usr \ -Dvendorprefix=/usr \ -Dman1dir=/usr/share/man/man1 \ -Dman3dir=/usr/share/man/man3 \ -Dpager="/usr/bin/less -isR" \ -Duseshrplib \ -Dusethreads
The meaning of the configure options:
-Dvendorprefix=/usr
This ensures perl knows how to tell packages where they should install their perl modules.
-Dpager="/usr/bin/less
-isR"
This ensures that less
is used instead
of more
.
-Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3
Since Groff is not installed yet, Configure thinks that we do not want man pages for Perl. Issuing these parameters overrides this decision.
-Duseshrplib
Build a shared libperl needed by some perl modules.
-Dusethreads
Build perl with support for threads.
Compile the package:
make
To test the results (approximately 2.5 SBU), issue:
make -k test
Several tests related to zlib will fail due to using the system version of zlib instead of the internal version.
Install the package and clean up:
make install unset BUILD_ZLIB BUILD_BZIP2
|
Dumps C structures as generated from cc -g -S |
|
|
A commandline frontend to Module::CoreList |
|
|
Interact with the Comprehensive Perl Archive Network (CPAN) from the command line |
|
|
Builds a Perl extension for the Encode module from either Unicode Character Mappings or Tcl Encoding Files |
|
|
Guess the encoding type of one or several files |
|
|
Converts |
|
|
Converts |
|
|
Shell script for examining installed Perl modules, and can create a tarball from an installed module |
|
|
Converts data between certain input and output formats |
|
|
Can be used to configure the |
|
|
Combines some of the best features of C, sed, awk and sh into a single swiss-army language |
|
|
A hard link to perl |
|
|
Used to generate bug reports about Perl, or the modules that come with it, and mail them |
|
|
Displays a piece of documentation in pod format that is embedded in the Perl installation tree or in a Perl script |
|
|
The Perl Installation Verification Procedure; it can be used to verify that Perl and its libraries have been installed correctly |
|
|
Used to generate thank you messages to mail to the Perl developers |
|
|
A Perl version of the character encoding converter iconv |
|
|
A rough tool for converting Perl4 |
|
|
Converts files from pod format to HTML format |
|
|
Converts pod data to formatted *roff input |
|
|
Converts pod data to formatted ASCII text |
|
|
Prints usage messages from embedded pod docs in files |
|
|
Checks the syntax of pod format documentation files |
|
|
Displays selected sections of pod documentation |
|
|
Command line tool for running tests against the Test::Harness module |
|
|
Dumps C structures as generated from cc -g -S stabs |
|
|
A tar-like program written in Perl |
|
|
A Perl program that compares an extracted archive with an unextracted one |
|
|
A Perl program that applies pattern matching to the contents of files in a tar archive |
|
|
Prints or checks SHA checksums |
|
|
Is used to force verbose warning diagnostics in Perl |
|
|
Converts Perl XS code into C code |
|
|
Displays details about the internal structure of a Zip file |
The XML::Parser module is a Perl interface to James Clark's XML parser, Expat.
Prepare XML::Parser for compilation:
perl Makefile.PL
Compile the package:
make
To test the results, issue:
make test
Install the package:
make install
The Intltool is an internationalization tool used for extracting translatable strings from source files.
First fix a warning that is caused by perl-5.22 and later:
sed -i 's:\\\${:\\\$\\{:' intltool-update.in
Prepare Intltool for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO
The Autoconf package contains programs for producing shell scripts that can automatically configure source code.
Prepare Autoconf for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
This takes a long time, about 3.2 SBUs. In addition, several tests are skipped that use Automake. For full test coverage, Autoconf can be re-tested after Automake has been installed. In addition, two tests fail due to changes in libtool-2.4.3 and later.
The test time for autoconf can be reduced significantly on a system with multiple cores. To do this, append TESTSUITEFLAGS=-j<N> to the line above. For instance, using -j4 can reduce the test time by over 60 percent.
Install the package:
make install
|
Produces shell scripts that automatically configure software source code packages to adapt to many kinds of Unix-like systems; the configuration scripts it produces are independent—running them does not require the autoconf program |
|
|
A tool for creating template files of C #define statements for configure to use |
|
|
A wrapper for the M4 macro processor |
|
|
Automatically runs autoconf, autoheader, aclocal, automake, gettextize, and libtoolize in the correct order to save time when changes are made to autoconf and automake template files |
|
|
Helps to create a |
|
|
Modifies a |
|
|
Helps when writing |
The Automake package contains programs for generating Makefiles for use with Autoconf.
Prepare Automake for compilation:
./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.15.1
Compile the package:
make
There are a couple of tests that incorrectly link to the wrong version of the flex library, so we temporarily work around the problem. Also, using the -j4 make option speeds up the tests, even on systems with only one processor, due to internal delays in individual tests. To test the results, issue:
sed -i "s:./configure:LEXLIB=/usr/lib/libfl.a &:" t/lex-{clean,depend}-cxx.sh make -j4 check
Two tests are known to fail in the LFS environment: check12.sh and check12-w.sh.
Install the package:
make install
|
Generates |
|
|
A hard link to aclocal |
|
|
A tool for automatically generating |
|
|
A hard link to automake |
The Xz package contains programs for compressing and decompressing files. It provides capabilities for the lzma and the newer xz compression formats. Compressing text files with xz yields a better compression percentage than with the traditional gzip or bzip2 commands.
Prepare Xz for compilation with:
./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/xz-5.2.3
Compile the package:
make
To test the results, issue:
make check
Install the package and make sure that all essential files are in the correct directory:
make install mv -v /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin mv -v /usr/lib/liblzma.so.* /lib ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so
|
Decompresses to standard output |
|
|
Runs cmp on LZMA compressed files |
|
|
Runs diff on LZMA compressed files |
|
|
Runs egrep on LZMA compressed files |
|
|
Runs fgrep on LZMA compressed files |
|
|
Runs grep on LZMA compressed files |
|
|
Runs less on LZMA compressed files |
|
|
Compresses or decompresses files using the LZMA format |
|
|
A small and fast decoder for LZMA compressed files |
|
|
Shows information stored in the LZMA compressed file header |
|
|
Runs more on LZMA compressed files |
|
|
Decompresses files using the LZMA format |
|
|
Decompresses files using the XZ format |
|
|
Compresses or decompresses files using the XZ format |
|
|
Decompresses to standard output |
|
|
Runs cmp on XZ compressed files |
|
|
A small and fast decoder for XZ compressed files |
|
|
Runs diff on XZ compressed files |
|
|
Runs egrep on XZ compressed files files |
|
|
Runs fgrep on XZ compressed files |
|
|
Runs grep on XZ compressed files |
|
|
Runs less on XZ compressed files |
|
|
Runs more on XZ compressed files |
|
|
The library implementing lossless, block-sorting data compression, using the Lempel-Ziv-Markov chain algorithm |
The Kmod package contains libraries and utilities for loading kernel modules
Prepare Kmod for compilation:
./configure --prefix=/usr \ --bindir=/bin \ --sysconfdir=/etc \ --with-rootlibdir=/lib \ --with-xz \ --with-zlib
The meaning of the configure options:
--with-xz,
--with-zlib
These options enable Kmod to handle compressed kernel modules.
--with-rootlibdir=/lib
This option ensures different library related files are placed in the correct directories.
Compile the package:
make
This package does not come with a test suite that can be run in the LFS chroot environment. At a minimum the git program is required and several tests will not run outside of a git repository.
Install the package, and create symlinks for compatibility with Module-Init-Tools (the package that previously handled Linux kernel modules):
make install for target in depmod insmod lsmod modinfo modprobe rmmod; do ln -sfv ../bin/kmod /sbin/$target done ln -sfv kmod /bin/lsmod
|
Creates a dependency file based on the symbols it finds in the existing set of modules; this dependency file is used by modprobe to automatically load the required modules |
|
|
Installs a loadable module in the running kernel |
|
|
Loads and unloads kernel modules |
|
|
Lists currently loaded modules |
|
|
Examines an object file associated with a kernel module and displays any information that it can glean |
|
|
Uses a dependency file, created by depmod, to automatically load relevant modules |
|
|
Unloads modules from the running kernel |
|
|
This library is used by other programs to load and unload kernel modules |
The Gettext package contains utilities for internationalization and localization. These allow programs to be compiled with NLS (Native Language Support), enabling them to output messages in the user's native language.
First, suppress two invocations of test-lock which on some machines can loop forever:
sed -i '/^TESTS =/d' gettext-runtime/tests/Makefile.in && sed -i 's/test-lock..EXEEXT.//' gettext-tools/gnulib-tests/Makefile.in
Prepare Gettext for compilation:
./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/gettext-<IP_ADDRESS>
Compile the package:
make
To test the results (this takes a long time, around 3 SBUs), issue:
make check
Install the package:
make install chmod -v 0755 /usr/lib/preloadable_libintl.so
|
Copies standard Gettext infrastructure files into a source package |
|
|
Substitutes environment variables in shell format strings |
|
|
Translates a natural language message into the user's language by looking up the translation in a message catalog |
|
|
Primarily serves as a shell function library for gettext |
|
|
Copies all standard Gettext files into the given top-level directory of a package to begin internationalizing it |
|
|
Filters the messages of a translation catalog according to their attributes and manipulates the attributes |
|
|
Concatenates and merges the given |
|
|
Compares two |
|
|
Finds the messages that are common to the given
|
|
|
Converts a translation catalog to a different character encoding |
|
|
Creates an English translation catalog |
|
|
Applies a command to all translations of a translation catalog |
|
|
Applies a filter to all translations of a translation catalog |
|
|
Generates a binary message catalog from a translation catalog |
|
|
Extracts all messages of a translation catalog that match a given pattern or belong to some given source files |
|
|
Creates a new |
|
|
Combines two raw translations into a single file |
|
|
Decompiles a binary message catalog into raw translation text |
|
|
Unifies duplicate translations in a translation catalog |
|
|
Displays native language translations of a textual message whose grammatical form depends on a number |
|
|
Recodes Serbian text from Cyrillic to Latin script |
|
|
Extracts the translatable message lines from the given source files to make the first translation template |
|
|
defines the autosprintf class, which makes C formatted output routines usable in C++ programs, for use with the <string> strings and the <iostream> streams |
|
|
a private library containing common routines used by the various Gettext programs; these are not intended for general use |
|
|
Used to write specialized programs that process
|
|
|
A private library containing common routines used by the various Gettext programs; these are not intended for general use |
|
|
A library, intended to be used by LD_PRELOAD that
assists |
Libelf is a library for handling ELF (Executable and Linkable Format) files.
Libelf is part of elfutils-0.170 package. Use the elfutils-0.170.tar.xz as the source tarball.
Prepare Libelf for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue make check.
Install only Libelf:
make -C libelf install install -vm644 config/libelf.pc /usr/lib/pkgconfig
The Libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run time.
Modify the Makefile to install headers into the standard
/usr/include
directory instead
of /usr/lib/libffi-3.2.1/include
.
sed -e '/^includesdir/ s/$(libdir).*$/$(includedir)/' \ -i include/Makefile.in sed -e '/^includedir/ s/=.*$/=@includedir@/' \ -e 's/^Cflags: -I${includedir}/Cflags:/' \ -i libffi.pc.in
Prepare libffi for compilation:
./configure --prefix=/usr --disable-static
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The OpenSSL package contains management tools and libraries relating to cryptography. These are useful for providing cryptographic functions to other packages, such as OpenSSH, email applications and web browsers (for accessing HTTPS sites).
Prepare OpenSSL for compilation:
./config --prefix=/usr \ --openssldir=/etc/ssl \ --libdir=lib \ shared \ zlib-dynamic
Compile the package:
make
To test the results, issue:
make test
One subtest in the test 40-test_rehash.t fails in the lfs chroot environment, but passes when run as a regular user.
Install the package:
sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile make MANSUFFIX=ssl install
If desired, install the documentation:
mv -v /usr/share/doc/openssl /usr/share/doc/openssl-1.1.0g cp -vfr doc/* /usr/share/doc/openssl-1.1.0g
|
is a Perl script that scans all files in a directory and adds symbolic links to their hash values. |
|
|
is a command-line tool for using the various cryptography functions of OpenSSL's crypto library from the shell. It can be used for various functions which are documented in man 1 openssl. |
|
|
implements a wide range of cryptographic algorithms used in various Internet standards. The services provided by this library are used by the OpenSSL implementations of SSL, TLS and S/MIME, and they have also been used to implement OpenSSH, OpenPGP, and other cryptographic standards. |
|
|
implements the Transport Layer Security (TLS v1) protocol. It provides a rich API, documentation on which can be found by running man 3 ssl. |
The Python 3 package contains the Python development environment. It is useful for object-oriented programming, writing scripts, prototyping large programs or developing entire applications.
Prepare Python for compilation:
./configure --prefix=/usr \ --enable-shared \ --with-system-expat \ --with-system-ffi \ --with-ensurepip=yes
The meaning of the configure options:
--with-system-expat
This switch enables linking against system version of Expat.
--with-system-ffi
This switch enables linking against system version of libffi.
--with-ensurepip=yes
This switch enables building pip and setuptools packaging programs.
Compile the package:
make
The test suite requires TK and and X Windows session and cannot be run until Python 3 is reinstalled in BLFS.
Install the package:
make install chmod -v 755 /usr/lib/libpython3.6m.so chmod -v 755 /usr/lib/libpython3.so
The meaning of the install commands:
Fix permissions for libraries to be consistent with other libraries.
If desired, install the preformatted documentation:
install -v -dm755 /usr/share/doc/python-3.6.4/html tar --strip-components=1 \ --no-same-owner \ --no-same-permissions \ -C /usr/share/doc/python-3.6.4/html \ -xvf ../python-3.6.4-docs-html.tar.bz2
The meaning of the documentation install commands:
--no-same-owner
and
--no-same-permissions
Ensure the installed files have the correct ownership and permissions. Without these options, using tar will install the package files with the upstream creator's values.
|
is a Python program that reads Python 2.x source code and applies a series of fixes to transform it into valid Python 3.x code. |
|
|
is a wrapper script that opens a Python aware GUI editor. For this script to run, you must have installed Tk before Python so that the Tkinter Python module is built. |
|
|
is the Python documentation tool. |
|
|
is an interpreted, interactive, object-oriented programming language. |
|
|
creates virtual Python environments in one or more target directories. |
Ninja is a small build system with a focus on speed.
When run, ninja normally runs a maximum number of processes in parallel. By default this is the number of cores on the system plus two. In some cases this can overheat a CPU or run a system out of memory. If run from the command line, passing a -jN parameter will limit the number of parallel processes, but some packages embed the execution of ninja and do not pass a -j parameter.
Using the optional patch below allows a user to limit the number of parallel processes via an environment variable, NINJAJOBS. For example setting:
export NINJAJOBS=4
will limit ninja to four parallel processes.
If desired, install the patch by running:
patch -Np1 -i ../ninja-1.8.2-add_NINJAJOBS_var-1.patch
Build Ninja with:
python3 configure.py --bootstrap
The meaning of the build option:
--bootstrap
This parameter forces ninja to rebuild itself for the current system.
To test the results, issue:
python3 configure.py ./ninja ninja_test ./ninja_test --gtest_filter=-SubprocessTest.SetWithLots
Install the package:
install -vm755 ninja /usr/bin/ install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja
Meson is an open source build system meant to be both extremely fast, and, even more importantly, as user friendly as possible.
Compile Meson with the following command:
python3 setup.py build
This package does not come with a test suite.
Install the package:
python3 setup.py install
The Procps-ng package contains programs for monitoring processes.
Prepare procps-ng for compilation:
./configure --prefix=/usr \ --exec-prefix= \ --libdir=/usr/lib \ --docdir=/usr/share/doc/procps-ng-3.3.12 \ --disable-static \ --disable-kill
The meaning of the configure options:
--disable-kill
This switch disables building the kill command that will be installed by the Util-linux package.
Compile the package:
make
The test suite needs some custom modifications for LFS. Remove a test that fails when scripting does not use a tty device and fix two others. To run the test suite, run the following commands:
sed -i -r 's|(pmap_initname)\\\$|\1|' testsuite/pmap.test/pmap.exp sed -i '/set tty/d' testsuite/pkill.test/pkill.exp rm testsuite/pgrep.test/pgrep.exp make check
One ps test may fail, but passes if the tests are rerun at the end of Chapter 6.
Install the package:
make install
Finally, move essential libraries to a location that can be
found if /usr
is not mounted.
mv -v /usr/lib/libprocps.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so
|
Reports the amount of free and used memory (both physical and swap memory) in the system |
|
|
Looks up processes based on their name and other attributes |
|
|
Reports the PIDs of the given programs |
|
|
Signals processes based on their name and other attributes |
|
|
Reports the memory map of the given process |
|
|
Lists the current running processes |
|
|
Reports the current working directory of a process |
|
|
Displays detailed kernel slab cache information in real time |
|
|
Modifies kernel parameters at run time |
|
|
Prints a graph of the current system load average |
|
|
Displays a list of the most CPU intensive processes; it provides an ongoing look at processor activity in real time |
|
|
Reports how long the system has been running, how many users are logged on, and the system load averages |
|
|
Reports virtual memory statistics, giving information about processes, memory, paging, block Input/Output (IO), traps, and CPU activity |
|
|
Shows which users are currently logged on, where, and since when |
|
|
Runs a given command repeatedly, displaying the first screen-full of its output; this allows a user to watch the output change over time |
|
|
Contains the functions used by most programs in this package |
The E2fsprogs package contains the utilities for handling the
ext2
file system. It also
supports the ext3
and
ext4
journaling file systems.
The E2fsprogs documentation recommends that the package be built in a subdirectory of the source tree:
mkdir -v build cd build
Prepare E2fsprogs for compilation:
LIBS=-L/tools/lib \ CFLAGS=-I/tools/include \ PKG_CONFIG_PATH=/tools/lib/pkgconfig \ ../configure --prefix=/usr \ --bindir=/bin \ --with-root-prefix="" \ --enable-elf-shlibs \ --disable-libblkid \ --disable-libuuid \ --disable-uuidd \ --disable-fsck
The meaning of the environment variable and configure options:
PKG_CONFIG_PATH, LIBS,
CFLAGS
These variables enable e2fsprogs to be built using the Section 5.33, “Util-linux-2.31.1” package built earlier.
--with-root-prefix=""
and
--bindir=/bin
Certain programs (such as the e2fsck program) are
considered essential programs. When, for example,
/usr
is not mounted,
these programs still need to be available. They belong
in directories like /lib
and /sbin
. If this option
is not passed to E2fsprogs' configure, the programs are
installed into the /usr
directory.
--enable-elf-shlibs
This creates the shared libraries which some programs in this package use.
--disable-*
This prevents E2fsprogs from building and installing
the libuuid
and
libblkid
libraries, the
uuidd
daemon, and the
fsck
wrapper, as Util-Linux installs more recent versions.
Compile the package:
make
To set up and run the test suite we need to first link some libraries from /tools/lib to a location where the test programs look. To run the tests, issue:
ln -sfv /tools/lib/lib{blk,uu}id.so.1 lib make LD_LIBRARY_PATH=/tools/lib check
One of the E2fsprogs tests will attempt to allocate 256 MB of memory. If you do not have significantly more RAM than this, be sure to enable sufficient swap space for the test. See Section 2.5, “Creating a File System on the Partition” and Section 2.7, “Mounting the New Partition” for details on creating and enabling swap space.
Install the binaries, documentation, and shared libraries:
make install
Install the static libraries and headers:
make install-libs
Make the installed static libraries writable so debugging symbols can be removed later:
chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
This package installs a gzipped .info
file but doesn't update the
system-wide dir
file. Unzip
this file and then update the system dir
file using the following commands.
gunzip -v /usr/share/info/libext2fs.info.gz install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info
If desired, create and install some additional documentation by issuing the following commands:
makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo install -v -m644 doc/com_err.info /usr/share/info install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info
|
Searches a device (usually a disk partition) for bad blocks |
|
|
Changes the attributes of files on an |
|
|
An error table compiler; it converts a table of
error-code names and messages into a C source file
suitable for use with the |
|
|
A file system debugger; it can be used to examine
and change the state of an |
|
|
Prints the super block and blocks group information for the file system present on a given device |
|
|
Reports free space fragmentation information |
|
|
Is used to check, and optionally repair
|
|
|
Is used to save critical |
|
|
Displays or changes the file system label on the
|
|
|
Replays the undo log undo_log for an ext2/ext3/ext4 filesystem found on a device [This can be used to undo a failed operation by an e2fsprogs program.] |
|
|
Online defragmenter for ext4 filesystems |
|
|
Reports on how badly fragmented a particular file might be |
|
|
By default checks |
|
|
By default checks |
|
|
By default checks |
|
|
By default checks |
|
|
Saves the output of a command in a log file |
|
|
Lists the attributes of files on a second extended file system |
|
|
Converts a table of command names and help messages
into a C source file suitable for use with the
|
|
|
Creates an |
|
|
By default creates |
|
|
By default creates |
|
|
By default creates |
|
|
By default creates |
|
|
Used to create a |
|
|
Can be used to enlarge or shrink an |
|
|
Adjusts tunable file system parameters on an
|
|
|
The common error display routine |
|
|
Used by dumpe2fs, chattr, and lsattr |
|
|
Contains routines to enable user-level programs to
manipulate an |
|
|
Used by debugfs |
The Coreutils package contains utilities for showing and setting the basic system characteristics.
POSIX requires that programs from Coreutils recognize character boundaries correctly even in multibyte locales. The following patch fixes this non-compliance and other internationalization-related bugs.
patch -Np1 -i ../coreutils-8.29-i18n-1.patch
In the past, many bugs were found in this patch. When reporting new bugs to Coreutils maintainers, please check first if they are reproducible without this patch.
Suppress a test which on some machines can loop forever:
sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk
Now prepare Coreutils for compilation:
FORCE_UNSAFE_CONFIGURE=1 ./configure \ --prefix=/usr \ --enable-no-install-program=kill,uptime
The meaning of the configure options:
FORCE_UNSAFE_CONFIGURE=1
This environment variable allows the package to be built as the root user.
--enable-no-install-program=kill,uptime
The purpose of this switch is to prevent Coreutils from installing binaries that will be installed by other packages later.
Compile the package:
FORCE_UNSAFE_CONFIGURE=1 make
Skip down to “Install the package” if not running the test suite.
Now the test suite is ready to be run. First, run the tests
that are meant to be run as user root
:
make NON_ROOT_USERNAME=nobody check-root
We're going to run the remainder of the tests as the
nobody
user. Certain tests,
however, require that the user be a member of more than one
group. So that these tests are not skipped we'll add a
temporary group and make the user nobody
a part of it:
echo "dummy:x:1000:nobody" >> /etc/group
Fix some of the permissions so that the non-root user can compile and run the tests:
chown -Rv nobody .
Now run the tests. Make sure the PATH in the su
environment includes
/tools/bin.
su nobody -s /bin/bash \ -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"
The test program test-getlogin is known to fail in a partially built system environment like the chroot environment here, but passes if run at the end of this chapter. The test program tty.sh is also known to fail.
Remove the temporary group:
sed -i '/dummy/d' /etc/group
Install the package:
make install
Move programs to the locations specified by the FHS:
mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin mv -v /usr/bin/chroot /usr/sbin mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8
Some of the scripts in the LFS-Bootscripts package depend on
head,
sleep, and
nice. As
/usr
may not be available
during the early stages of booting, those binaries need to be
on the root partition:
mv -v /usr/bin/{head,sleep,nice} /bin
|
Encodes and decodes data according to the base32 specification (RFC 4648) |
|
|
Encodes and decodes data according to the base64 specification (RFC 4648) |
|
|
Strips any path and a given suffix from a file name |
|
|
Concatenates files to standard output |
|
|
Changes security context for files and directories |
|
|
Changes the group ownership of files and directories |
|
|
Changes the permissions of each file to the given mode; the mode can be either a symbolic representation of the changes to make or an octal number representing the new permissions |
|
|
Changes the user and/or group ownership of files and directories |
|
|
Runs a command with the specified directory as the
|
|
|
Prints the Cyclic Redundancy Check (CRC) checksum and the byte counts of each specified file |
|
|
Compares two sorted files, outputting in three columns the lines that are unique and the lines that are common |
|
|
Copies files |
|
|
Splits a given file into several new files, separating them according to given patterns or line numbers and outputting the byte count of each new file |
|
|
Prints sections of lines, selecting the parts according to given fields or positions |
|
|
Displays the current time in the given format, or sets the system date |
|
|
Copies a file using the given block size and count, while optionally performing conversions on it |
|
|
Reports the amount of disk space available (and used) on all mounted file systems, or only on the file systems holding the selected files |
|
|
Lists the contents of each given directory (the same as the ls command) |
|
|
Outputs commands to set the |
|
|
Strips the non-directory suffix from a file name |
|
|
Reports the amount of disk space used by the current directory, by each of the given directories (including all subdirectories) or by each of the given files |
|
|
Displays the given strings |
|
|
Runs a command in a modified environment |
|
|
Converts tabs to spaces |
|
|
Evaluates expressions |
|
|
Prints the prime factors of all specified integer numbers |
|
|
Does nothing, unsuccessfully; it always exits with a status code indicating failure |
|
|
Reformats the paragraphs in the given files |
|
|
Wraps the lines in the given files |
|
|
Reports a user's group memberships |
|
|
Prints the first ten lines (or the given number of lines) of each given file |
|
|
Reports the numeric identifier (in hexadecimal) of the host |
|
|
Reports the effective user ID, group ID, and group memberships of the current user or specified user |
|
|
Copies files while setting their permission modes and, if possible, their owner and group |
|
|
Joins the lines that have identical join fields from two separate files |
|
|
Creates a hard link with the given name to a file |
|
|
Makes hard links or soft (symbolic) links between files |
|
|
Reports the current user's login name |
|
|
Lists the contents of each given directory |
|
|
Reports or checks Message Digest 5 (MD5) checksums |
|
|
Creates directories with the given names |
|
|
Creates First-In, First-Outs (FIFOs), a "named pipe" in UNIX parlance, with the given names |
|
|
Creates device nodes with the given names; a device node is a character special file, a block special file, or a FIFO |
|
|
Creates temporary files in a secure manner; it is used in scripts |
|
|
Moves or renames files or directories |
|
|
Runs a program with modified scheduling priority |
|
|
Numbers the lines from the given files |
|
|
Runs a command immune to hangups, with its output redirected to a log file |
|
|
Prints the number of processing units available to a process |
|
|
Converts numbers to or from human-readable strings |
|
|
Dumps files in octal and other formats |
|
|
Merges the given files, joining sequentially corresponding lines side by side, separated by tab characters |
|
|
Checks if file names are valid or portable |
|
|
Is a lightweight finger client; it reports some information about the given users |
|
|
Paginates and columnates files for printing |
|
|
Prints the environment |
|
|
Prints the given arguments according to the given format, much like the C printf function |
|
|
Produces a permuted index from the contents of the given files, with each keyword in its context |
|
|
Reports the name of the current working directory |
|
|
Reports the value of the given symbolic link |
|
|
Prints the resolved path |
|
|
Removes files or directories |
|
|
Removes directories if they are empty |
|
|
Runs a command with specified security context |
|
|
Prints a sequence of numbers within a given range and with a given increment |
|
|
Prints or checks 160-bit Secure Hash Algorithm 1 (SHA1) checksums |
|
|
Prints or checks 224-bit Secure Hash Algorithm checksums |
|
|
Prints or checks 256-bit Secure Hash Algorithm checksums |
|
|
Prints or checks 384-bit Secure Hash Algorithm checksums |
|
|
Prints or checks 512-bit Secure Hash Algorithm checksums |
|
|
Overwrites the given files repeatedly with complex patterns, making it difficult to recover the data |
|
|
Shuffles lines of text |
|
|
Pauses for the given amount of time |
|
|
Sorts the lines from the given files |
|
|
Splits the given file into pieces, by size or by number of lines |
|
|
Displays file or filesystem status |
|
|
Runs commands with altered buffering operations for its standard streams |
|
|
Sets or reports terminal line settings |
|
|
Prints checksum and block counts for each given file |
|
|
Flushes file system buffers; it forces changed blocks to disk and updates the super block |
|
|
Concatenates the given files in reverse |
|
|
Prints the last ten lines (or the given number of lines) of each given file |
|
|
Reads from standard input while writing both to standard output and to the given files |
|
|
Compares values and checks file types |
|
|
Runs a command with a time limit |
|
|
Changes file timestamps, setting the access and modification times of the given files to the current time; files that do not exist are created with zero length |
|
|
Translates, squeezes, and deletes the given characters from standard input |
|
|
Does nothing, successfully; it always exits with a status code indicating success |
|
|
Shrinks or expands a file to the specified size |
|
|
Performs a topological sort; it writes a completely ordered list according to the partial ordering in a given file |
|
|
Reports the file name of the terminal connected to standard input |
|
|
Reports system information |
|
|
Converts spaces to tabs |
|
|
Discards all but one of successive identical lines |
|
|
Removes the given file |
|
|
Reports the names of the users currently logged on |
|
|
Is the same as ls -l |
|
|
Reports the number of lines, words, and bytes for each given file, as well as a total line when more than one file is given |
|
|
Reports who is logged on |
|
|
Reports the user name associated with the current effective user ID |
|
|
Repeatedly outputs “y” or a given string until killed |
|
|
Library used by stdbuf |
Check is a unit testing framework for C.
Prepare Check for compilation:
./configure --prefix=/usr
Build the package:
make
Compilation is now complete. To run the Check test suite, issue the following command:
make check
Note that the Check test suite may take a relatively long (up to 4 SBU) time.
Install the package:
make install
The Diffutils package contains programs that show the differences between files or directories.
Prepare Diffutils for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Gawk package contains programs for manipulating text files.
First, ensure some unneeded files are not installed:
sed -i 's/extras//' Makefile.in
Prepare Gawk for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
If desired, install the documentation:
mkdir -v /usr/share/doc/gawk-4.2.0 cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-4.2.0
The Findutils package contains programs to find files. These programs are provided to recursively search through a directory tree and to create, maintain, and search a database (often faster than the recursive find, but unreliable if the database has not been recently updated).
First, suppress a test which on some machines can loop forever:
sed -i 's/test-lock..EXEEXT.//' tests/Makefile.in
Prepare Findutils for compilation:
./configure --prefix=/usr --localstatedir=/var/lib/locate
The meaning of the configure options:
--localstatedir
This option changes the location of the locate database to be
in /var/lib/locate
, which
is FHS-compliant.
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Some of the scripts in the LFS-Bootscripts package depend on
find. As
/usr
may not be available
during the early stages of booting, this program needs to be
on the root partition. The updatedb script also needs
to be modified to correct an explicit path:
mv -v /usr/bin/find /bin sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb
|
Was formerly used to produce locate databases; it is the ancestor of frcode |
|
|
Searches given directory trees for files matching the specified criteria |
|
|
Searches through a database of file names and reports the names that contain a given string or match a given pattern |
|
|
Older version of find, using a different algorithm |
|
|
Updates the locate database; it scans the entire file system (including other file systems that are currently mounted, unless told not to) and puts every file name it finds into the database |
|
|
Can be used to apply a given command to a list of files |
The Groff package contains programs for processing and formatting text.
Groff expects the environment variable PAGE
to contain the default paper size. For
users in the United States, PAGE=letter
is appropriate.
Elsewhere, PAGE=A4
may be more suitable. While the default paper size is
configured during compilation, it can be overridden later by
echoing either “A4” or “letter” to the /etc/papersize
file.
Prepare Groff for compilation:
PAGE=<paper_size>
./configure --prefix=/usr
This package does not support parallel build. Compile the package:
make -j1
This package does not come with a test suite.
Install the package:
make install
|
Reads a troff font file and adds some additional font-metric information that is used by the groff system |
|
|
Creates a font file for use with groff and grops |
|
|
Groff preprocessor for producing chemical structure diagrams |
|
|
Compiles descriptions of equations embedded within troff input files into commands that are understood by troff |
|
|
Converts a troff EQN (equation) into a cropped image |
|
|
Marks differences between groff/nroff/troff files |
|
|
Transforms sheet music written in the lilypond language into the groff language |
|
|
Preprocesor for groff, allowing addition of perl code into groff files |
|
|
Preprocesor for groff, allowing addition of Chinese European-like language Pinyin into groff files. |
|
|
Converts a grap diagram into a cropped bitmap image |
|
|
A groff preprocessor for gremlin files |
|
|
A driver for groff that produces TeX dvi format |
|
|
A front-end to the groff document formatting system; normally, it runs the troff program and a post-processor appropriate for the selected device |
|
|
Displays groff files and man pages on X and tty terminals |
|
|
Reads files and guesses which of the groff options
|
|
|
Is a groff driver for Canon CAPSL printers (LBP-4 and LBP-8 series laser printers) |
|
|
Is a driver for groff that produces output in PCL5 format suitable for an HP LaserJet 4 printer |
|
|
Translates the output of GNU troff to PDF |
|
|
Translates the output of GNU troff to PostScript |
|
|
Translates the output of GNU troff into a form suitable for typewriter-like devices |
|
|
Creates a font file for use with groff -Tlj4 from an HP-tagged font metric file |
|
|
Creates an inverted index for the bibliographic databases with a specified file for use with refer, lookbib, and lkbib |
|
|
Searches bibliographic databases for references that contain specified keys and reports any references found |
|
|
Prints a prompt on the standard error (unless the standard input is not a terminal), reads a line containing a set of keywords from the standard input, searches the bibliographic databases in a specified file for references containing those keywords, prints any references found on the standard output, and repeats this process until the end of input |
|
|
A simple preprocessor for groff |
|
|
Formats equations for American Standard Code for Information Interchange (ASCII) output |
|
|
A script that emulates the nroff command using groff |
|
|
Is a wrapper around groff that facilitates the production of PDF documents from files formatted with the mom macros. |
|
|
Creates pdf documents using groff |
|
|
Translates a PostScript font in |
|
|
Compiles descriptions of pictures embedded within troff or TeX input files into commands understood by TeX or troff |
|
|
Converts a PIC diagram into a cropped image |
|
|
Translates the output of GNU troff to HTML |
|
|
Converts encoding of input files to something GNU troff understands |
|
|
Translates the output of GNU troff to HTML |
|
|
Copies the contents of a file to the standard output, except that lines between .[ and .] are interpreted as citations, and lines between .R1 and .R2 are interpreted as commands for how citations are to be processed |
|
|
Transforms roff files into DVI format |
|
|
Transforms roff files into HTML format |
|
|
Transforms roff files into PDFs |
|
|
Transforms roff files into ps files |
|
|
Transforms roff files into text files |
|
|
Transforms roff files into other formats |
|
|
Reads files and replaces lines of the form .so file by the contents of the mentioned file |
|
|
Compiles descriptions of tables embedded within troff input files into commands that are understood by troff |
|
|
Creates a font file for use with groff -Tdvi |
|
|
Is highly compatible with Unix troff; it should usually be invoked using the groff command, which will also run preprocessors and post-processors in the appropriate order and with the appropriate options |
The GRUB package contains the GRand Unified Bootloader.
Prepare GRUB for compilation:
./configure --prefix=/usr \ --sbindir=/sbin \ --sysconfdir=/etc \ --disable-efiemu \ --disable-werror
The meaning of the new configure options:
--disable-werror
This allows the build to complete with warnings introduced by more recent Flex versions.
--disable-efiemu
This option minimizes what is built by disabling a feature and testing programs not needed for LFS.
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
Using GRUB to make your LFS system bootable will be discussed in Section 8.4, “Using GRUB to Set Up the Boot Process”.
|
Is a helper program for grub-install |
|
|
A tool to edit the environment block |
|
|
Checks if FILE is of the specified type. |
|
|
Tool to debug the filesystem driver |
|
|
Processes ia32 and amd64 EFI images and glues them according to Apple format. |
|
|
Install GRUB on your drive |
|
|
Script that converts an xkb layout into one recognized by GRUB |
|
|
Mac-style bless on HFS or HFS+ files |
|
|
Converts a GRUB Legacy |
|
|
Generate a grub config file |
|
|
Make a bootable image of GRUB |
|
|
Generates a GRUB keyboard layout file |
|
|
Prepares a GRUB netboot directory |
|
|
Generates an encrypted PBKDF2 password for use in the boot menu |
|
|
Makes a system pathname relative to its root |
|
|
Make a bootable image of GRUB suitable for a floppy disk or CDROM/DVD |
|
|
Generates a standalone image |
|
|
Is a helper program that prints the path of a GRUB device |
|
|
Probe device information for a given path or device |
|
|
Sets the default boot entry for GRUB for the next boot only |
|
|
Render Apple .disk_label for Apple Macs |
|
|
Checks GRUB configuration script for syntax errors |
|
|
Sets the default boot entry for GRUB |
|
|
Is a helper program for grub-setup |
|
|
Transform a syslinux config file into grub.cfg format |
The Less package contains a text file viewer.
Prepare Less for compilation:
./configure --prefix=/usr --sysconfdir=/etc
The meaning of the configure options:
--sysconfdir=/etc
This option tells the programs created by the package
to look in /etc
for the
configuration files.
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
The Gzip package contains programs for compressing and decompressing files.
Prepare Gzip for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Two tests are known to fail in the LFS environment: help-version and zmore.
Install the package:
make install
Move a program that needs to be on the root filesystem:
mv -v /usr/bin/gzip /bin
|
Decompresses gzipped files |
|
|
Creates self-decompressing executable files |
|
|
Compresses the given files using Lempel-Ziv (LZ77) coding |
|
|
Decompresses compressed files |
|
|
Decompresses the given gzipped files to standard output |
|
|
Runs cmp on gzipped files |
|
|
Runs diff on gzipped files |
|
|
Runs egrep on gzipped files |
|
|
Runs fgrep on gzipped files |
|
|
Forces a |
|
|
Runs grep on gzipped files |
|
|
Runs less on gzipped files |
|
|
Runs more on gzipped files |
|
|
Re-compresses files from compress format
to gzip
format— |
The IPRoute2 package contains programs for basic and advanced IPV4-based networking.
The arpd program included in this package will not be built since it is dependent on Berkeley DB, which is not installed in LFS. However, a directory for arpd and a man page will still be installed. Prevent this by running the commands below. If the arpd binary is needed, instructions for compiling Berkeley DB can be found in the BLFS Book at http://www.linuxfromscratch.org/blfs/view/8.2/server/databases.html#db.
sed -i /ARPD/d Makefile rm -fv man/man8/arpd.8
It is also necessary to disable building one module that requires http://www.linuxfromscratch.org/blfs/view/8.2/postlfs/iptables.html.
sed -i 's/m_ipt.o//' tc/Makefile
Compile the package:
make
This package does not have a working test suite.
Install the package:
make DOCDIR=/usr/share/doc/iproute2-4.15.0 install
|
Configures network bridges |
|
|
Connection status utility |
|
|
Generic netlink utility frontend |
|
|
A shell script wrapper for the ip command [Note that it requires the arping and rdisk programs from the iputils package found at http://www.skbuff.net/iputils/.] |
|
|
Shows the interface statistics, including the amount of transmitted and received packets by interface |
|
|
The main executable. It has several different functions:
ip link ip addr allows users to look at addresses and their properties, add new addresses, and delete old ones ip neighbor allows users to look at neighbor bindings and their properties, add new neighbor entries, and delete old ones ip rule allows users to look at the routing policies and change them ip route allows users to look at the routing table and change routing table rules ip tunnel allows users to look at the IP tunnels and their properties, and change them ip maddr allows users to look at the multicast addresses and their properties, and change them ip mroute allows users to set, change, or delete the multicast routing ip monitor allows users to continuously monitor the state of devices, addresses and routes |
|
|
Provides Linux network statistics; it is a generalized and more feature-complete replacement for the old rtstat program |
|
|
Shows network statistics |
|
|
A component of ip route. This is for flushing the routing tables |
|
|
A component of ip route. This is for listing the routing tables |
|
|
Displays the contents of |
|
|
Route monitoring utility |
|
|
Converts the output of ip -o back into a readable form |
|
|
Route status utility |
|
|
Similar to the netstat command; shows active connections |
|
|
Traffic Controlling Executable; this is for Quality Of Service (QOS) and Class Of Service (COS) implementations tc qdisc allows users to setup the queueing discipline tc class allows users to setup classes based on the queuing discipline scheduling tc estimator allows users to estimate the network flow into a network tc filter allows users to setup the QOS/COS packet filtering tc policy allows users to setup the QOS/COS policies |
The Kbd package contains key-table files, console fonts, and keyboard utilities.
The behaviour of the Backspace and Delete keys is not consistent across the keymaps in the Kbd package. The following patch fixes this issue for i386 keymaps:
patch -Np1 -i ../kbd-2.0.4-backspace-1.patch
After patching, the Backspace key generates the character with code 127, and the Delete key generates a well-known escape sequence.
Remove the redundant resizecons program (it requires the defunct svgalib to provide the video mode files - for normal use setfont sizes the console appropriately) together with its manpage.
sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in
Prepare Kbd for compilation:
PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr --disable-vlock
The meaning of the configure options:
--disable-vlock
This option prevents the vlock utility from being built, as it requires the PAM library, which isn't available in the chroot environment.
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
For some languages (e.g., Belarusian) the Kbd package doesn't provide a useful keymap where the stock “by” keymap assumes the ISO-8859-5 encoding, and the CP1251 keymap is normally used. Users of such languages have to download working keymaps separately.
If desired, install the documentation:
mkdir -v /usr/share/doc/kbd-2.0.4 cp -R -v docs/doc/* /usr/share/doc/kbd-2.0.4
|
Changes the foreground virtual terminal |
|
|
Deallocates unused virtual terminals |
|
|
Dumps the keyboard translation tables |
|
|
Prints the number of the active virtual terminal |
|
|
Prints the kernel scancode-to-keycode mapping table |
|
|
Obtains information about the status of a console |
|
|
Reports or sets the keyboard mode |
|
|
Sets the keyboard repeat and delay rates |
|
|
Loads the keyboard translation tables |
|
|
Loads the kernel unicode-to-font mapping table |
|
|
An obsolete program that used to load a user-defined output character mapping table into the console driver; this is now done by setfont |
|
|
Starts a program on a new virtual terminal (VT) |
|
|
Adds a Unicode character table to a console font |
|
|
Extracts the embedded Unicode character table from a console font |
|
|
Removes the embedded Unicode character table from a console font |
|
|
Handles Unicode character tables for console fonts |
|
|
Changes the Enhanced Graphic Adapter (EGA) and Video Graphics Array (VGA) fonts on the console |
|
|
Loads kernel scancode-to-keycode mapping table entries; this is useful if there are unusual keys on the keyboard |
|
|