5.5. Cross Binutils-2.17

#### Cross-Compiled Linux From Scratch - Version 1.0.0rc2-Sparc

### Chapter 5. Constructing Cross-Compile Tools

- Prev

  Linux-Headers-2.6.17.4-07112006

- Next

  Cross GCC-4.1.1 - Static

- Up.
- Home

# 5.5. Cross Binutils-2.17

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

## 5.5.1. Installation of Cross Binutils

It is important that Binutils be the first package compiled because both Glibc and GCC perform various tests on the available linker and assembler to determine which of their own features to enable.

To make sure that the proper syntax is used for a couple of tools, apply the following patch:

    patch -Np1 -i ../binutils-2.17-posix-1.patch

The Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory:

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

Prepare Binutils for compilation:

    ../binutils-2.17/configure --prefix=/cross-tools \
        --host=${CLFS_HOST} --target=${CLFS_TARGET} --with-lib-path=/tools/lib \
        --disable-nls --enable-shared --disable-multilib

The meaning of the configure options:

`--prefix=/cross-tools`

  This tells the configure script to prepare to install the package in the `/cross-tools` directory.

`--host=${CLFS_HOST}`

  When used with --target, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST).

`--target=${CLFS_TARGET}`

  When used with --host, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST).

`--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.

`--disable-nls`

  This disables internationalization as i18n is not needed for the cross-compile tools.

`--enable-shared`

  Enable the creation of the shared libraries.

`--disable-multilib`

  This option disables the building of a multilib capable binutils.

Compile the package:

    make configure-host
    make

The meaning of the make options:

`configure-host`

  This checks the host environment and makes sure all the necessary tools are available to compile binutils.

Install the package:

    make install

Copy the `libiberty.h` file to `/tools/include` directory:

    cp -v ../binutils-2.17/include/libiberty.h /tools/include

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

- Prev

  Linux-Headers-2.6.17.4-07112006

- Next

  Cross GCC-4.1.1 - Static

- Up.
- Home.