6.17. Binutils-2.39 - Pass 2

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

Approximate build time: 1.4 SBU
Required disk space: 514 MB

6.17.1. Installation of Binutils

Binutils ships an outdated libtool copy in the tarball. It lacks sysroot support so the produced binaries will be mistakenly linked to libraries from the host distro. Workaround this issue:

sed '6009s/$add_dir//' -i ltmain.sh

Create a separate build directory again:

mkdir -v build
cd       build

Prepare Binutils for compilation:

../configure                   \
    --prefix=/usr              \
    --build=$(../config.guess) \
    --host=$LFS_TGT            \
    --disable-nls              \
    --enable-shared            \
    --enable-gprofng=no        \
    --disable-werror           \

The meaning of the new configure options:


Builds libbfd as a shared library.


Enables 64-bit support (on hosts with narrower word sizes). May not be needed on 64-bit systems, but does no harm.

Compile the package:


Install the package:

make DESTDIR=$LFS install

Remove the libtool archive files because they are harmful for cross compilation, and remove unnecessary static libraries:

rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la}

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