5.6. Installing Diffutils-2.7

Estimated build time:           1 minute
Estimated required disk space:  4 MB

5.6.1. Installation of Diffutils

When installing Diffutils using glibc-2.1.x on your base system, it may be necessary to use a fix to prevent a variable name conflict. The following commands can be used in this case. Note that these commands can also be used for other glibc versions so if you aren't sure, then use the first version.

export CPPFLAGS=-Dre_max_failures=re_max_failures2 &&
./configure --prefix=$LFS/usr &&
unset CPPFLAGS &&
make LDFLAGS=-static &&
make install

If you are using a newer glibc version (2.2.x), you can use the following commands to install Diffutils:

./configure --prefix=$LFS/usr &&
make LDFLAGS=-static &&
make install

5.6.2. Command explanations

CPPFLAGS=-Dre_max_failures=re_max_failures2: The CPPFLAGS variable is a variable that's read by the cpp program (C PreProcessor). The value of this variable tells the preprocessor to replace every instance of re_max_failures it finds by re_max_failures2 before handing the source file to the compiler itself for compilation. This package has problems linking statically on systems that run an older Glibc version and this construction fixes that problem.

5.6.3. Contents

The Diffutils package contains the cmp, diff, diff3 and sdiff programs.

5.6.4. Description

5.6.4.1. cmp and diff

cmp and diff both compare two files and report their differences. Both programs have extra options which compare files in different situations.

5.6.4.2. diff3

The difference between diff and diff3 is that diff compares 2 files, diff3 compares 3 files.

5.6.4.3. sdiff

sdiff merges two files and interactively outputs the results.

5.6.5. Dependencies

Diffutils-2.7 needs the following to be installed:


sh from the bash package

ld from the binutils package
as from the binutils package

chmod from the fileutils package
cp from the fileutils package
mv from the fileutils package
rm from the fileutils package

cc from the gcc package

egrep from the grep package
grep from the grep package

make from the make package

sed from the sed package

basename from the sh-utils package
date from the sh-utils package

cat from the textutils package
tr from the textutils package