5.9. Installing Fileutils-4.1

Estimated build time:           3 minutes
Estimated required disk space:  25 MB

5.9.1. Installation of Fileutils

The programs from a statically linked fileutils package may cause segmentation faults on certain systems, if your distribution has Glibc-2.2.3 or higher installed. It also seems to happen mostly on machines powered by an AMD CPU, but there is a case or two where an Intel system is affected as well. If your system falls under this category, try the following fix.

Note that in some cases using these sed commands will result in problems not being able to compile this package at all, even when your system has an AMD CPU and has Glibc-2.2.3 (or higher) installed. If that's the case, you'll need to remove the fileutils-4.1 directory and unpack it again from the tarball before continuing. We believe this may be the case when your distribution has altered Glibc-2.2.3 somehow, but details are unavailable at the time.

To fix this package to compile properly on AMD/Glibc-2.2.3 machines, run the following commands. Do not attempt this fix if you don't have Glibc-2.2.3 installed. It will more than likely result in all kinds of compile time problems.

cp lib/Makefile.in lib/Makefile.in.backup &&
sed -e 's/\(.*\)\(fopen-safer\.c \)\\/\1\2atexit.c \\/' \
   -e 's/\(.*\)\(idcache\$U\.\$.*\)\\/\1\2atexit$U.$(OBJEXT) \\/' \
   lib/Makefile.in.backup > lib/Makefile.in

Install fileutils by running the following commands:

./configure --disable-nls \
   --prefix=$LFS/usr --bindir=$LFS/bin &&
make LDFLAGS=-static &&
make install &&
cd $LFS/usr/bin &&
ln -sf ../../bin/install

Once you have installed fileutils, you can test whether the segmentation fault problem has been avoided by running $LFS/bin/ls. If this works, then you are OK. If not, then you need to re-do the installation using the sed commands if you didn't use them, or without the sed commands if you did use them.

5.9.2. Command explanations

cp lib/Makefile.in lib/Makefile.in.backup : We run this command in order to keep a backup of the file we are about to change.

cp lib/Makefile.in lib/Makefile.in.backup && sed -e 's/\(.*\)\(fopen-safer\.c \)\\/\1\2atexit.c \\/' \    -e 's/\(.*\)\(idcache\$U\.\$.*\)\\/\1\2atexit$U.$(OBJEXT) \\/' \    lib/Makefile.in.backup > lib/Makefile.in: This is used to fix a problem with building fileutils statically on glibc 2.2.3 systems. If this isn't done, then there is the possibility of all of the fileutils programs causing segmentation faults once chroot is entered in chapter 6.

5.9.3. Contents of fileutils-4.1

5.9.3.2. Descriptions

5.9.4. Dependencies

Fileutils-4.1 needs the following to be installed:


bash: sh
binutils: ar, as, ld, ranlib
diffutils: cmp
fileutils: chmod, cp, install, ln, ls, mkdir, mv, rm, rmdir
gettext: msgfmt, xgettext
gcc: cc, cc1, collect2, cpp0, gcc
grep: egrep, fgrep, grep
make: make
perl: perl
sed: sed
sh-utils: basename, echo, expr, hostname, sleep, uname
texinfo: install-info
textutils: cat, tr