Installing Crosstool-ng

Installing Crosstool-ng

  1. Download and build crosstool-ng:
    # Install prerequisites:
    sudo apt-get install flex bison automake libtool ncurses-dev texinfo lzma
    sudo apt-get install gawk cvs patch g++ gcj

    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
    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.6.1-ppc405-nofloat-glibc-config .config
  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. ct-ng build can take a little while so give it some time. (25 minutes on an 8 core system). To save time you can download my precompiled versions: 32bit here and 64bit version here.

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:
  • crosstool1
    crosstool2

    Here are the configuration settings to apply:

      • Paths and misc options
        • Paths
          • Local tarballs directory: ${HOME}/sources
          • Save new tarballs: Yes
          • Prefix directory: /home/daglitch/v2plin/crosstool-ng-1.6.1/${CT_TARGET}
        • Build behavior
          • Number of parallel jobs: 3 or 4 (if you have a quad-core computer)
          • Nice level: 10
        • Logging
          • Maximum log level to see: EXTRA
      • Target options
        • Target Architecture: powerpc
        • Emit assembly for CPU: 405
        • Tune assembly for CPU: 405
        • Floating point: software
      • Toolchain options
        • Vendor string: 405
      • Operating System
        • Target OS: linux
        • Linux kernel version: 2.6.32.7
      • binutils
        • binutils version: 2.20
        • binutils libraries for the target: Yes (libiberty and libbfd)
      • C compiler
        • gcc version: 4.4.3
        • C++: Yes
        • Fortran: Yes (optional)
        • Java: Yes (optional)
        • (Untested: enable any other languages you may want)
      • C-library
        • C library: glibc
        • glibc version: 2.9
        • Threading implementation to use: nptl
        • Use the ports addon: Yes
      • Tools (Optional, Untested!)
        • libelf: Yes
        • sstrip: No (because I couldn’t get it to build)
      • Debug facilities (Optional, Untested!)
        • dmalloc: Yes (5.5.2)
        • duma: Yes (2_5_15)
        • gdb: Yes
          • Build a static cross gdb: Yes
          • Native gdb: Yes
          • Build a static native gdb: Yes
          • Use GMP and MPFR: yes
          • Version: 6.8
        • ltrace: No (couldn’t get it to build)
        • strace: No (because I couldn’t get it to build)
    • Companion Libraries
      • GMP and MPFR
        • Build libraries for target: Yes
        • GMP version: 4.3.1
        • MPFR version: 2.4.2

Useful files

crosstool-ng-1.6.1-ppc405-nofloat-glibc-config
64bit-powerpc-405-linux-gnu.zip
32bit-powerpc-405-linux-gnu.zip

25 thoughts on “Installing Crosstool-ng”

  1. It seems as though the link you posted for the 32bit-powerpc-405-linux zip file doesn’t work. I downloaded it from step for but was not able to unzip it. I am currently download the one that you put under useful files–the size seems to be a bit bigger as well so I will give that a shot. I would have just compiled my own sources but I am getting the following error when I do a ./ct-ng build:

    [INFO ] Retrieving needed toolchain components’ tarballs
    [EXTRA] Retrieving ‘cloog-ppl-0.15.6’
    [ERROR] Could not retrieve ‘cloog-ppl-0.15.6’.
    [00:06] / make: *** [build] Error 1

    I tried changing the verisons of cloog-ppl to the other version but I got the error as well.

    Cheers!

    1. Is this the very first tarball it tries to get? I’m looking in to it, and will report back what i find.

  2. Link under useful files seemed to have downloaded correctly and I was then able to unzip it. I think all is well with that then…

  3. Mitch, It looks as though whatever internet connection I was using at the time must have been blocking the port for retrieving cloog-ppl. I started running it again this morning and found that it was able to retrieve cloog-ppl just fine. I was at the medical library using HSC_Guest at the time—that probably explains a lot right there :).

  4. Mitch, Do you think that your 32bit linux would work on somebody else’s machine if you specified in the kernel in that paths options: /home/daglitch/v2plin/crosstool-ng-1.6.1/${CT_TARGET} this directory? Seems like anyone who wanted to download your pre-compiled source would have to have the same directory structure as you in order for that to work–at least they could create a few directories like home/daglitch/v2plin.

    1. Yea it should work on another person’s machine. You are correct in assuming that you would have to change that path if you used my old config file. I need to change this tutorial around to make it more generic for people that have different home directories

  5. After ./ct-ng build I get the following:

    [INFO ] Performing some trivial sanity checks
    [INFO ] Build started 20100503.221746
    [INFO ] Building environment variables
    [EXTRA] Preparing working directories
    [ERROR] Build failed in step ”
    [ERROR] Error happened in ‘/home/ece595/crosstool-ng-1.6.1/scripts/functions’ in function ‘CT_DoExecLog’ (line unknown, sorry)
    [ERROR] called from ‘/home/ece595/crosstool-ng-1.6.1/scripts/crosstool-NG.sh’ at line # 234 in function ‘main’
    [ERROR] Look at ” for more info on this error.
    [ERROR] (elapsed: 0:01.19)
    [00:02] / make: *** [build] Error 1

    Any Ideas?

  6. After ./ct-ng build I get the following:

    Installing final compiler
    [ERROR] jar: internal error:
    [ERROR] make[4]: *** [libgcj-4.4.3.jar] Error 1
    [ERROR] make[3]: *** [all-recursive] Error 1
    [ERROR] make[2]: *** [all-target-libjava] Error 2
    [ERROR] make[1]: *** [all] Error 2
    [ERROR] Build failed in step ‘Installing final compiler’
    [ERROR] Error happened in ‘/home/ece595/crosstool-ng-1.6.1/scripts/functions’ in function ‘CT_DoExecLog’ (line unknown, sorry)
    [ERROR] called from ‘/home/ece595/crosstool-ng-1.6.1/scripts/build/cc/gcc.sh’ at line # 350 in function ‘do_cc’
    [ERROR] called from ‘/home/ece595/crosstool-ng-1.6.1/scripts/crosstool-NG.sh’ at line # 562 in function ‘main’
    [ERROR] Look at ‘/home/ece595/x-tools/powerpc-405-linux-gnu/build.log’ for more info on this error.
    [ERROR] (elapsed: 276:27.76)
    [276:28] / make: *** [build] Error 2

  7. [INFO ] Build completed at 20100508.161611
    [INFO ] (elapsed: 49:22.61)
    (using Virtual Box on a 2 core system). Very good compared to an 8 core system

  8. Ali,
    Were you able to solve the problem?

    I am getting a similar ERROR:

    [ERROR] Build failed in step ‘Extracting and patching toolchain components’
    [ERROR] Error happened in ‘/home/manoharc/ee276/crosstools/crosstool-ng-1.7.0/scripts/functions’ in function ‘CT_DoExecLog’ (line unknown, sorry)
    [ERROR] called from ‘/home/manoharc/ee276/crosstools/crosstool-ng-1.7.0/scripts/functions’ at line # 648 in function ‘CT_Extract’
    [ERROR] called from ‘/home/manoharc/ee276/crosstools/crosstool-ng-1.7.0/scripts/build/companion_libs/ppl.sh’ at line # 23 in function ‘do_ppl_extract’
    [ERROR] called from ‘/home/manoharc/ee276/crosstools/crosstool-ng-1.7.0/scripts/crosstool-NG.sh’ at line # 542 in function ‘main’
    [ERROR] Look at ‘/home/manoharc/ee276/crosstools/crosstool-ng-1.7.0/x-tools/build.log’ for more info on this error.
    [ERROR] (elapsed: 5:43.49)
    [05:44] / make: *** [build] Error 2

  9. if your build fails with error:

    [EXTRA] Retrieving ‘cloog-ppl-0.15.7’
    [ERROR] Could not retrieve ‘cloog-ppl-0.15.7’.

    Then you can manually download the file from ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-0.15.7.tar.gz and place it in the folder you designated to download the sources (typically ${home}/src ). Also be sure to deactivate the option Force Downloads.

    My build process is now extracting and the cloog tar ball succesfully expanded. Let’s see if no other errors come in.

  10. Hi,I am Moking.
    I have the same prolbem as Manohar Chandrasekhar’s,after reading the file build.log,I know that ct-ng can not find the file libmpfr.so.1(or ,libgmp.so),but it seems delima,in order to build glibc,we need to unset LD_LIBRARY_PATH,but the other compents this env variable to tell ct-ng where these libs.Do you know how to resolve this problem?Please tell me!
    Thank you!!

    1. Yea, the same thing should apply for a different architecture. You just want to be sure to change the correct settings for alpha

  11. I am getting an error stating
    Error happened in ‘/home/pradeep/crosstool-ng-1.6.1/scripts/functions’ in function ‘CT_DoExecLog’ (line unknown, sorry)
    [ERROR] called from ‘/home/pradeep/crosstool-ng-1.6.1/scripts/build/binutils/binutils.sh’ at line # 51 in function ‘do_binutils’
    [ERROR] called from ‘/home/pradeep/crosstool-ng-1.6.1/scripts/crosstool-NG.sh’ at line # 562 in function ‘main’
    [ERROR] Look at ‘/home/pradeep/x-tools/alphaev4-unknown-elf/build.log’ for more info on this error.
    [ERROR] (elapsed: 59:01.00)
    [59:02] / make: *** [build] Error 2
    How should I correct the same

  12. I’m like to try to get this going for gcc 4.6.0 (goland) on powerpc, if anyone gets there, please let me know.

    ron

    1. Thanks for your comments Ron. I have actually gotten a native installation of gcc on to the compact flash. A few people have asked me the same thing, and am thinking about doing a write up on it. It’s a fairly non-trivial process.

  13. Thanks for this tutorial. I would ask you if i can use this tool (crosstool-ng) to generate a toolcahin for a new model wich doesn’t exist in the list of targets available in the section “Target options”
    [Target Architecture: powerpc]

  14. Am getting an error like this am not root user…
    please help me how to solve this issu

    CONF config/config.in

    Error while writing of the configuration.
    Your configuration changes were NOT saved.

    make: *** [menuconfig] Error 1

    1. Hmm. Not too sure how to solve that particular issue. You may want to try a “make clean” to help try and clean up anything and then try “make” again. About all I can think about right now.

Leave a Reply

Your email address will not be published. Required fields are marked *

Where Engineering is my passion.