5.9. Binutils-2.20 - Pass 2

The Binutils package contains a linker, an assembler, and other tools for handling object files.

Approximate build time: 1.3 SBU
Required disk space: 259 MB

5.9.1. Installation of Binutils

Create a separate build directory again:

mkdir -v ../binutils-build
cd ../binutils-build

Prepare Binutils for compilation:

CC="$LFS_TGT-gcc -B/tools/lib/" \
   AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
   ../binutils-2.20/configure --prefix=/tools \
   --disable-nls --with-lib-path=/tools/lib

The meaning of the new configure options:

CC="$LFS_TGT-gcc -B/tools/lib/" AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib

Because this is really a native build of Binutils, setting these variables ensures that the build system uses the cross-compiler and associated tools instead of the ones on the host system.

--with-lib-path=/tools/lib

This tells the configure script to specify the library search path during the compilation of Binutils, resulting in /tools/lib being passed to the linker. This prevents the linker from searching through library directories on the host.

Compile the package:

make

Install the package:

make install

Now prepare the linker for the “Re-adjusting” phase in the next chapter:

make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new /tools/bin

The meaning of the make parameters:

-C ld clean

This tells the make program to remove all compiled files in the ld subdirectory.

-C ld LIB_PATH=/usr/lib:/lib

This option rebuilds everything in the ld subdirectory. Specifying the LIB_PATH Makefile variable on the command line allows us to override the default value of the temporary tools and point it to the proper final path. The value of this variable specifies the linker's default library search path. This preparation is used in the next chapter.

Details on this package are located in Section 6.12.2, “Contents of Binutils.”