Thursday, April 15, 2010

HOWTO Build ARM Cross-Compiler (crosstool-NG)

[ ]# mkdir /home/crosstool-ng
[ ]# cd /home/crosstool-ng
[ ]# wget http://ymorin.is-a-geek.org/download/crosstool-ng/crosstool-ng-1.6.1.tar.bz2
[ ]# tar jxvf crosstool-ng-1.6.1.tar.bz2
[ ]# cd crosstool-ng-1.6.1
[ ]# ./configure --prefix=/opt/crosstool-ng
[ ]# make
[ ]# make install

[ ]# mkdir -p /home/crosstool-ng/crosstool-ng-build
[ ]# cd /home/crosstool-ng/crosstool-ng-build
[ }# cp /opt/crosstool-ng/lib/ct-ng-1.6.1/samples/armeb-unknown-linux-uclibcgnueabi/* .
[ ]# mv crosstool.config .config

[ ]# export PATH=/opt/crosstool-ng/bin:$PATH

[ ]# ct-ng menuconfig
[ ]# ct-ng build.4

[INFO ] Performing some trivial sanity checks
[INFO ] Build started 20100415.195352
[INFO ] Building environment variables
[WARN ] Directory '/root/src' does not exist.
[WARN ] Will not save downloaded tarballs to local storage.
[EXTRA] Preparing working directories
[WARN ] You did not specify the build system. That's OK, I can guess...
[EXTRA] Installing user-supplied crosstool-NG configuration
[EXTRA] =================================================================
[EXTRA] Dumping internal crosstool-NG configuration
[EXTRA] Building a toolchain for:
[EXTRA] build = i386-redhat-linux
[EXTRA] host = i386-redhat-linux
[EXTRA] target = armeb-unknown-linux-uclibcgnueabi
[EXTRA] Dumping internal crosstool-NG configuration: done in 0.06s (at 00:01)
[INFO ] =================================================================
[INFO ] Retrieving needed toolchain components' tarballs
[EXTRA] Retrieving 'linux-2.6.31.12'
[EXTRA] Retrieving 'gmp-4.3.1'
[EXTRA] Retrieving 'mpfr-2.4.2'
[EXTRA] Retrieving 'ppl-0.10.2'
[EXTRA] Retrieving 'cloog-ppl-0.15.7'
[EXTRA] Retrieving 'mpc-0.8.1'
[EXTRA] Retrieving 'binutils-2.20'
[EXTRA] Retrieving 'gcc-4.4.2'
[EXTRA] Retrieving 'uClibc-0.9.30.2'
[EXTRA] Retrieving 'libelf-0.8.12'
[EXTRA] Retrieving 'sstrip'
[EXTRA] Retrieving 'dmalloc-5.5.2'
[EXTRA] Retrieving 'duma_2_5_15'
[EXTRA] Retrieving 'gdb-6.8'
[EXTRA] Retrieving 'ncurses-5.7'
[EXTRA] Retrieving 'ltrace_0.5.3.orig'
[EXTRA] Retrieving 'strace-4.5.19'
[INFO ] Retrieving needed toolchain components' tarballs: done in 4518.57s (at 75:20)
[INFO ] =================================================================
[INFO ] Extracting and patching toolchain components
[EXTRA] Extracting 'linux-2.6.31.12'
[EXTRA] Patching 'linux-2.6.31.12'
[EXTRA] Extracting 'gmp-4.3.1'
[EXTRA] Patching 'gmp-4.3.1'
[EXTRA] Extracting 'mpfr-2.4.2'
[EXTRA] Patching 'mpfr-2.4.2'
[EXTRA] Extracting 'ppl-0.10.2'
[EXTRA] Patching 'ppl-0.10.2'
[EXTRA] Extracting 'cloog-ppl-0.15.7'
[EXTRA] Patching 'cloog-ppl-0.15.7'
[EXTRA] Extracting 'mpc-0.8.1'
[EXTRA] Patching 'mpc-0.8.1'
[EXTRA] Extracting 'binutils-2.20'
[EXTRA] Patching 'binutils-2.20'
[EXTRA] Extracting 'gcc-4.4.2'
[EXTRA] Patching 'gcc-4.4.2'
[EXTRA] Extracting 'uClibc-0.9.30.2'
[EXTRA] Patching 'uClibc-0.9.30.2'
[EXTRA] Extracting 'libelf-0.8.12'
[EXTRA] Patching 'libelf-0.8.12'
[EXTRA] Extracting 'dmalloc-5.5.2'
[EXTRA] Patching 'dmalloc-5.5.2'
[EXTRA] Extracting 'duma_2_5_15'
[EXTRA] Patching 'duma-2_5_15'
[EXTRA] Extracting 'gdb-6.8'
[EXTRA] Patching 'gdb-6.8'
[EXTRA] Extracting 'ncurses-5.7'
[EXTRA] Patching 'ncurses-5.7'
[EXTRA] Extracting 'ltrace-0.5.3'
[EXTRA] Patching 'ltrace-0.5.3'
[EXTRA] Extracting 'strace-4.5.19'
[EXTRA] Patching 'strace-4.5.19'
[INFO ] Extracting and patching toolchain components: done in 300.63s (at 80:20)
[INFO ] =================================================================
[INFO ] Checking C library configuration
[EXTRA] Munging uClibc configuration
[INFO ] Checking C library configuration: done in 0.13s (at 80:21)
[INFO ] =================================================================
[INFO ] Installing kernel headers
[EXTRA] Installing kernel headers
[EXTRA] Checking installed headers
[INFO ] Installing kernel headers: done in 9.72s (at 80:30)
[INFO ] =================================================================
[INFO ] Installing GMP
[EXTRA] Configuring GMP
[EXTRA] Building GMP
[EXTRA] Installing GMP
[INFO ] Installing GMP: done in 71.62s (at 81:42)
[INFO ] =================================================================
[INFO ] Installing MPFR
[EXTRA] Configuring MPFR
[EXTRA] Building MPFR
[EXTRA] Installing MPFR
[INFO ] Installing MPFR: done in 19.64s (at 82:02)
[INFO ] =================================================================
[INFO ] Installing PPL
[EXTRA] Configuring PPL
[EXTRA] Building PPL
[EXTRA] Installing PPL
[INFO ] Installing PPL: done in 392.81s (at 88:34)
[INFO ] Installing MPC
[EXTRA] Configuring MPC
[EXTRA] Building MPC
[EXTRA] Installing MPC
[INFO ] Installing MPC: done in 7.93s (at 88:49)
[INFO ] =================================================================
[INFO ] Installing binutils
[EXTRA] Configuring binutils
[EXTRA] Building binutils
[EXTRA] Installing binutils
[INFO ] Installing binutils: done in 48.30s (at 89:37)
[INFO ] =================================================================
[INFO ] Installing C library headers
[EXTRA] Copying sources to build dir
[EXTRA] Applying configuration
[EXTRA] Building headers
[EXTRA] Installing headers
[INFO ] Installing C library headers: done in 14.52s (at 89:52)
[INFO ] =================================================================
[INFO ] Installing static core C compiler
[EXTRA] Configuring static core C compiler
[EXTRA] Building static core C compiler
[EXTRA] Installing static core C compiler
[INFO ] Installing static core C compiler: done in 157.37s (at 92:29)
[INFO ] =================================================================
[INFO ] Installing C library
[EXTRA] Copying sources to build dir
[EXTRA] Applying configuration
[EXTRA] Building C library
[EXTRA] Installing C library
[EXTRA] Building C library cross-ldd
[EXTRA] Installing C library cross-ldd
[INFO ] Installing C library: done in 56.79s (at 93:26)
[INFO ] =================================================================
[INFO ] Installing final compiler
[EXTRA] Configuring final compiler
[EXTRA] Building final compiler
[ERROR] checking the name lister (/home/crosstool-ng/crosstool-ng-1.6.1-build/targets/armeb-unknown-linux-uclibcgnueabi/build/build-cc/./gcc/nm) interface... libtool.m4: error: problem compiling FC test program
[EXTRA] Installing final compiler
[INFO ] Installing final compiler: done in 214.53s (at 97:00)
[INFO ] =================================================================
[INFO ] Installing GMP for the target
[EXTRA] Configuring GMP
[EXTRA] Building GMP
[EXTRA] Installing GMP
[INFO ] Installing GMP for the target: done in 59.09s (at 97:59)
[INFO ] Installing MPFR for the target
[EXTRA] Configuring MPFR
[EXTRA] Building MPFR
[EXTRA] Installing MPFR
[INFO ] Installing MPFR for the target: done in 21.58s (at 98:21)
[INFO ] =================================================================
[INFO ] Installing binutils for target
[EXTRA] Configuring binutils for target
[EXTRA] Building binutils' libraries (libiberty bfd) for target
[EXTRA] Installing binutils' libraries (libiberty bfd) for target
[INFO ] Installing binutils for target: done in 77.79s (at 99:39)
[INFO ] =================================================================
[INFO ] Installing libelf
[EXTRA] Configuring libelf
[EXTRA] Building libelf
[EXTRA] Installing libelf
[INFO ] Installing libelf: done in 11.39s (at 99:50)
[INFO ] =================================================================
[INFO ] Installing sstrip
[EXTRA] Building sstrip
[EXTRA] Installing sstrip
[INFO ] Installing sstrip: done in 0.17s (at 99:50)
[INFO ] =================================================================
[INFO ] Installing dmalloc
[EXTRA] Configuring dmalloc
[EXTRA] Building dmalloc
[EXTRA] Installing dmalloc
[INFO ] Installing dmalloc: done in 8.56s (at 99:59)
[INFO ] =================================================================
[INFO ] Installing D.U.M.A.
[EXTRA] Copying sources
[EXTRA] Building libraries 'libduma.a libduma.so.0.0.0'
[EXTRA] Installing libraries 'libduma.a libduma.so.0.0.0'
[EXTRA] Installing shared library link
[EXTRA] Installing wrapper script
[INFO ] Installing D.U.M.A.: done in 1.93s (at 100:01)
[INFO ] =================================================================
[INFO ] Installing cross-gdb
[EXTRA] Configuring cross-gdb
[EXTRA] Building cross-gdb
[EXTRA] Installing cross-gdb
[INFO ] Installing cross-gdb: done in 117.00s (at 101:58)
[INFO ] =================================================================
[INFO ] Installing native gdb
[INFO ] =================================================================
[INFO ] Installing ncurses library
[INFO ] =================================================================
[INFO ] Installing native ncurses tic
[EXTRA] Configuring ncurses tic
[EXTRA] Building ncurses tic
[EXTRA] Installing ncurses tic
[INFO ] Installing native ncurses tic: done in 27.87s (at 102:26)
[EXTRA] Configuring ncurses
[EXTRA] Building ncurses
[EXTRA] Installing ncurses
[INFO ] Installing ncurses library: done in 98.99s (at 103:37)
[EXTRA] Configuring native gdb
[EXTRA] Building native gdb
[EXTRA] Installing native gdb
[EXTRA] Cleaning up ncurses
[INFO ] Installing native gdb: done in 196.27s (at 105:14)
[INFO ] =================================================================
[INFO ] Installing gdbserver
[EXTRA] Configuring gdbserver
[EXTRA] Building gdbserver
[EXTRA] Installing gdbserver
[INFO ] Installing gdbserver: done in 7.07s (at 105:21)
[INFO ] =================================================================
[INFO ] Installing ltrace
[EXTRA] Copying sources to build dir
[EXTRA] Configuring ltrace
[EXTRA] Building ltrace
[EXTRA] Installing ltrace
[INFO ] Installing ltrace: done in 5.01s (at 105:26)
[INFO ] =================================================================
[INFO ] Installing strace
[EXTRA] Configuring strace
[EXTRA] Building strace
[EXTRA] Installing strace
[INFO ] Installing strace: done in 17.78s (at 105:44)
[INFO ] =================================================================
[INFO ] Cleaning-up the toolchain's directory
[EXTRA] Installing the populate helper
[EXTRA] Creating toolchain aliases
[EXTRA] Installing toolchain wrappers
[EXTRA] Removing access to the build system tools
[EXTRA] Removing installed documentation
[INFO ] Cleaning-up the toolchain's directory: done in 0.50s (at 105:45)
[INFO ] Build completed at 20100415.213937
[INFO ] (elapsed: 105:44.38)
[INFO ] Finishing installation (may take a few seconds)...
[105:45] /

The toolchain is in directory "/root/x-tools/" by default.

PS. buildroot version (Little-Endian) (Big-Endian)

2 comments:

rcamplan said...

You are a genius! i got a working toolchain in 8 minutes! thanks a lot!
I saved several hours of my job with your tool (and your ready-to-use configuration)!

karthik said...

Any idea how to resolve this error?

[ERROR] checking for suffix of object files... configure: error: in `home/KD/bin/crosstool-ng-1.8.2/crosstool-ng-build/targets/armeb-unknown-linux-uclibcgnueabi/build/build-cc-core-static/armeb-unknown-linux-uclibcgnueabi/libgcc':
[ERROR] configure: error: cannot compute suffix of object files: cannot compile
[ERROR] make[1]: *** [configure-target-libgcc] Error 1
[ERROR] Build failed in step 'Installing static core C compiler'

Thanks