back-arrow Go back to Linux on Xilinx FPGA Tutorials

Crosstool-ng 1.6.1

Contents

Installing Crosstool-ng

  1. Download and build crosstool-ng:

    # Install prerequisites:
    sudo apt-get install flex bison automake libtool ncurses-dev
    
    version=crosstool-ng-1.6.1
    wget http://ymorin.is-a-geek.org/download/crosstool-ng/$version.tar.bz2
    tar xjvf $version.tar.bz2
    
    cd $version/
    ./configure --local
    
    # NOTE: The following "make" command only builds the "ct-ng" tool
    #       (not the compilers, libs, and binutils).
    make
    chmod a+rx ct-ng
    
  2. Configure crosstool-ng to build a specific cross-compiler. For some tips on how to do the configuration, see the section Configuration Options for Crosstool-ng (Glibc) for starters:

    # Finally, start crosstool-ng:
    ./ct-ng menuconfig
    # Note: Read the next section for information on how to configure...
    #
    # Alternatively, do this:
    # TODO: I haven't created the glibc config file yet:
    # cp crosstool-ng-1.6.1-ppc405-nofloat-glibc-config .config
    # or
    # cp crosstool-ng-1.6.1-ppc405-nofloat-uclibc-config .config
    #
    # Then run:
    # ./ct-ng oldconfig
    
  3. Instruct crosstool-ng to build the cross-compiler:

    # After configuring (with menuconfig or oldconfig), build the toolchain:
    unset LD_LIBRARY_PATH LIBRARY_PATH CPATH
    export LD_LIBRARY_PATH LIBRARY_PATH CPATH
    ./ct-ng build
    
  4. If you want both glibc and uClibc support, then repeat the process twice. Once for glibc, and once again for uClibc. See the following steps for how to reconfigure crosstool-ng for each. (Hint: you probably do want both uClibc and glibc support).

Configuration Options for Crosstool-ng (Glibc)

Warning

I haven't tested the glibc portion of this tutorial yet. This is copied from the older `crosstool-ng-1.3.2.html`_ tutorial. Please provide feedback on your experiences if you try this. Thanks.

The first two configuration screens, and the options you should choose are displayed here. A more detailed description of the configurations follows these screenshots:

im-edited/crosstool-01.png
im-edited/crosstool-02.png

Here are the configuration settings to apply:

Configuration Options for Crosstool-ng (uClibc)

Special note: do not build uclibc yourself. Crosstool-ng will do this automatically! The instructions go basically like this:

  1. Download and configure uClibc (using make menuconfig) and then save the configuration. This is discussed in more detail below. As a matter of fact, you can skip this step if you just use the provided config file, in which case crosstool-ng itself will download a copy of uClibc. Should you choose to download uClibc and run menuconfig, you can find it here.
  2. Configure crosstool-ng (e.g. using make menuconfig) and instruct crosstool-ng where to find the configuration file you saved in step 1. If you did not specify an alternate name, then then the config file will probably be called .config and will be located in the uclibc directory.

System Message: WARNING/2 (crosstool-ng-1.6.1.rst); backlink

Duplicate explicit target name: "here".

uClibc 0.9.30.1 configuration (available here):

System Message: WARNING/2 (crosstool-ng-1.6.1.rst); backlink

Duplicate explicit target name: "here".

Crosstool configuration (available here):

Errors

"error: C compiler cannot create executables"

I don't yet know what to do about this error...

Downloads

Docutils System Messages

System Message: ERROR/3 (crosstool-ng-1.6.1.rst, line 77); backlink

Unknown target name: "crosstool-ng-1.3.2.html".