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
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
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
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
Repeat the process twice. Once for glibc, and again for uClibc.
The first two configuration screens, and the options you should choose are displayed here. A more detailed description of the configurations follows these screenshots:
Here are the configuration settings to apply:
Special note: do not build uclibc yourself. Crosstool-ng will do this automatically! The instructions go basically like this:
uClibc 0.9.30 configuration (available here):
Crosstool configuration (available here):
Follow the same configuration as for Glibc (described in the previous section), and then apply the following additional configuration listed in the next bullets.
C compiler
C-library:
C library: uClibc
uClibc version: 0.9.30
Configuration file: ${CT_LIB_DIR}/uClibc-0.9.30-ppc405-nofpu-config (available here)
Threading implementation to use: linuxthreads
"error: C compiler cannot create executables"
I don't yet know what to do about this error...