back-arrow Go back to Linux on Xilinx FPGA Tutorials

Crosstool-ng 1.3.2

Warning

Please refer to the newer Crosstool-ng 1.6.1 tutorial.

This 1.3.2 tutorial is outdated. There are now many problems that are likely to occur to prevent you from using crosstool-ng 1.3.2. These problems include crosstool-ng-1.3.2 dies if you have a more recent version of Bash, and some other problems that I cannot remember.

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.3.2
    wget http://ymorin.is-a-geek.org/download/crosstool-ng/$version.tar.bz2
    tar xjvf $version.tar.bz2
    
    cd $version/
    ./configure --local
    # NOTE: You may get an error that looks like this:
    # Computing version string... 1.3.2
    # Checking for '/bin/bash'... /bin/bash: wrong version string: expecting regexp '^GNU bash, version 3\.'
    # Bailing out...
    #
    # If you get that error, then manually edit the "configure" file
    # and apply this patch to disable the Bash version check:
    #
    # Index: crosstool-ng-1.3.2/configure
    # ===================================================================
    # --- crosstool-ng-1.3.2.orig/configure 2010-04-14 10:50:14.018166725 -0600
    # +++ crosstool-ng-1.3.2/configure  2010-04-14 10:51:47.819250235 -0600
    # @@ -33,7 +33,7 @@
    #  #         - 'autoconf2.50' is to be found in the PATH
    #  #
    #  TOOLS_TO_CHECK='
    # -/bin/bash/^GNU bash, version 3\.
    # +/bin/bash/^GNU bash, version
    #  make/^GNU Make
    #  gcc/
    #  gawk/^GNU Awk
    
    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:
    # cp crosstool-ng-1.3.2-ppc405-nofloat-glibc-config .config
    # or
    # cp crosstool-ng-1.3.2-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. Repeat the process twice. Once for glibc, and again for uClibc.

Configuration Options for Crosstool-ng (Glibc)

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. Configure uclibc (using make menuconfig) and then save the configuration. This is discussed in more detail below.
  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.

uClibc 0.9.30 configuration (available here):

System Message: WARNING/2 (crosstool-ng-1.3.2.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