6.17. Binutils-2.42 - Pass 2

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

Approximate build time: 0.5 SBU
Required disk space: 523 MB

6.17.1. Installation of Binutils

Binutils building system relies on an shipped libtool copy to link against internal static libraries, but the libiberty and zlib copies shipped in the package do not use libtool. This inconsistency may cause produced binaries mistakenly linked against libraries from the host distro. Work around 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           \
    --enable-64-bit-bfd        \
    --enable-default-hash-style=gnu

The meaning of the new configure options:

--enable-shared

Builds libbfd as a shared library.

--enable-64-bit-bfd

Enables 64-bit support (on hosts with smaller word sizes). This may not be needed on 64-bit systems, but it does no harm.

Compile the package:

make

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,sframe}.{a,la}

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