EmdebianToolchain - Debian Wiki


: 10

Emdebian toolchains are no longer supported Please note that this page is only for reference. Emdebian toolchains are not supported after squeeze. Modern multiarch-aware cross-toolchains are available from CrossToolchains.

Get the binaries

The emdebian archive keyring is considered to be compromised The updated version of the emdebian-archive-keyring package contains a revocation of the previous key and no replacement key. The old archives signed by this key are therefore to be treated as unsigned.

This page has been created to tell about latest status and what things could be done to improve Emdebian toolchain.

To use this toolchain add to your /etc/apt/sources.list or /etc/apt/sources.list.d/emdebian.sources.list:

Currently, toolchains for Squeeze are preferred.

If using Wheezy or unstable, add a Squeeze source for your own architecture

echo "deb http://ftp.us.debian.org/debian/ squeeze main" >> /etc/apt/sources.list.d/emdebian.list

using your normal Debian mirror for dependencies which are no longer in wheezy or unstable.

If you skip this on Wheezy the following apt-get command will complain with:

The following packages have unmet dependencies:
gcc-4.4-arm-linux-gnueabi : Depends: cpp-4.4-arm-linux-gnueabi (= 4.4.5-8) but it is not going to be installed
# -- Emdebian cross toolchains
# deb http://www.emdebian.org/debian/ unstable main
# deb http://www.emdebian.org/debian/ testing main
deb http://www.emdebian.org/debian/ squeeze main
# deb http://www.emdebian.org/debian/ lenny main

Search and install packages for the $ARCH that you need, for example 'armel':

$ apt-cache search armel

The cross compiler for armel uses the arm-linux-gnueabi triplet name:

apt-get install g++-4.4-arm-linux-gnueabi

Get all the libraries you need

For most users:

apt-get install xapt

For Squeeze, xapt is available in backports. To enable, see the backports instructions.

Fetch any dependencies you might need for your custom software which needs to be built using the cross compiler. e.g. for armel


xapt -a armel libfoo-dev

Wheezy and later

xapt -a armel -m libfoo-dev

Lenny only

Need to install apt-cross on Lenny only

apt-get install apt-cross dpkg-cross


apt-cross -a $ARCH -u

Fetch your cross favorite library

apt-cross -a $ARCH -i $LIBRARY

GDB Cross package

You can also search for gdb cross package.

There is a know issue on gdb cross package (version <7.0).

# apt-get install gdb-arm-linux-gnu
dpkg: error processing /var/cache/apt/archives/gdb-arm-linux-gnu_6.8-3_i386.deb (--unpack):
 trying to overwrite `/usr/share/man/man1/gdb.1.gz', which is also in package gdb
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Processing triggers for man-db ...
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Until it gets fixed, you could work arround it with

# dpkg -i --force-overwrite \

Build your own from sources

Use buildcross (from experimental) to do the hard job or manually you can do:

$ dpkg-cross -a <debian_arch> -b linux-libc-dev_XXX_<debian_arch>.deb
$ dpkg-cross -a <debian_arch> -b libc6_XXX_<debian_arch>.deb
$ dpkg-cross -a <debian_arch> -b libc6-dev_XXX_<debian_arch>.deb

# You can also try to get this packages with xapt tool:
$ sudo xapt -a <debian_arch> linux-libc-dev libc6 libc6-dev zlib1g-dev libmpfr-dev libgmp3-dev 

$ apt-get source binutils; cd binutils-*
$ TARGET=<your-target> dpkg-buildpackage -b -uc -us
$ cd..
$ sudo dpkg -i *.deb
# So far we got linux kernel headers, libc6 libraries and headers, and binutils under /usr/<triplet>/

$ apt-get source gcc-4.X
$ cd gcc-4.X-*
$ GCC_TARGET=${ARCH} DEB_CROSS=yes fakeroot debian/rules control
        GCC_TARGET=${ARCH} DEB_CROSS=yes dpkg-buildpackage -us -uc -rfakeroot

$ apt-get source gdb
$ cd gdb-*
$ GDB_TARGET=${ARCH} dpkg-buildpackage -rfakeroot -uc -us

# Install the packages and enjoy!

Build for an specific mcpu, mabi, etc..

> Has anyone looked at what gains can be had by rebuilding > packages with, say, Cortex-A8 or other optimizations for processors that > support them?

Well, it has a VFP FPU, so floating point apps will run N times faster, and GCC optimizes some kinds of integer loops into SIMD instructions for the NEON, beside the different instruction timing info and pipeline description for better instruction scheduling.

The easiest way to try this is to make fake versions of gcc and put them at the start of the PATH:

mkdir ~/cortex
cat > ~/cortex/gcc << EOF
#! /bin/sh

exec gcc-4.3 -mcpu=cortex-a8 -mfpu=vfp -mfloat-abi=softfp "$@"
chmod 755 ~/cortex/gcc
ln -s gcc ~/cortex/cc
ln -s gcc ~/cortex/gcc-4.3
ln -s gcc ~/cortex/arm-linux-gnueabi-gcc

and fool the build system into using them

PATH=~/cortex:$PATH dpkg-buildpackage -rfakeroot -B

I'd be interested to know what difference it makes to non-FP applications (if you have some tests, it would be nice to post them to debian-arm@ mailing lists) Stolen bits from Martin site

Emdebian.org toolchain autobuilder (deprecated)

Emdebian uses buildcross to build the toolchains, paamboli adds an upper layer to buildcross to do distributed building using secure shells.

Emdebian discourages to use this set of scripts to build one toolchain, as it can ruin your system if you do not have the proper set up. EmdebianToolchainAutobuilder page contains some more information on this topic.


  • 504487 is affecting multilib cross toolchains and gcc-4.3 toolchains are not multilib capable. If you do not want to produce code for 32bit machines from a 64bit machine or viceversa, you do not have to worry. It might be possible to generate other ABI toolchains but we stick the more we can to Debian defaults. So, for example, mips cross compilers will default to produce O32 code.

  • 580366 libc6 depends on debconf

  • 557620 binutils: Fail to build binary-cross

  • 553045 (cross) gcc-4.4/mipsel: lib64gomp1-mipsel-cross/DEBIAN/shlibs: No such file

  • 577674 gcc-4.4/cross: broken bi-arch architectures

  • 588383 binutils: diversion conflict with hardening-wrapper

  • 580481 dpkg-cross: please blacklist debconf, libc-bin, libc-dev-bin, debconf-2.0

  • 580488 dpkg: duplicated Provides: field on packages (already installed) fail to be removed

  • 578613 dpkg-cross: fails with dpkg (>1.15.7) due to duplicate value for Provides field

  • 575923 gdb: cross target FTBFS

Cross tools in Debian

  • 550780 eglibc: please provide support for cross tools

  • 550776 linux-source-2.6: please add support for linux-libc-dev-$(DEB_HOST_ARCH)-cross package

  • 553679 ITP: linux-armel -- Linux support headers for userspace development (for cross-compiling)

  • 553682 ITP: binutils-armel -- The GNU binary utilities, for arm-linux-gnueabi target

  • 553683 ITP: eglibc-armel -- GNU C Library: Shared libraries (for cross-compiling)

  • 590465 ITP: gcc-4.5-armel -- The GNU Compiler Collection cross compilers (C, C++) for armel architecture.

  • 553684 ITP: gcc-4.4-armel -- The GNU C compiler (for cross-compiling)

  • 553685 ITP: gcc-4.3-armel -- The GNU C compiler (for cross-compiling)

  • 553687 ITP: gdb-armel -- The GNU Debugger (for cross-compiling)

Enabling -source packages build depends

Forking privately


  • Run testsuites on remote targets
  • Add support non official Debian architectures (sh*, avr*, ...)
  • Add support for uclibc toolchains
  • Add multiarch support
  • Add bootstrapping support

Using The Toolchain outside a chroot

Some people use a chroot of sid and emdebian from another debian-derivative host system. The toolchain as it is installed in the chroot is *almost* capable of being used as-is from outside.

The only problem is the symlinks pointing back/forth to /etc/alternatives (see .../usr/bin/arm-linux-gnueabi-gcc pointing eventualy to the .../usr/bin/arm-linux-gnueabi-gcc-4.3 binary) -- these are absolute path and will not work on the host. You can manualy remove these link and replace them by relative equivalents and you will get a fully working toolchain accessible from anywhere. This script might help you to pack your toolchain and relocate it as you wish (Kudos to Bus Error).


  • We are looking forward to support multiarch in Emdebian cross toolchains, that might break current path layouts, so we shall try to keep compatible with current cross toolchain and add an aditional multiarch toolchain.
  • Current cross toolchain is compatible among other systems and non-Debian Linux based OS.
  • Multiarch cross toolchain is not done yet and it might work only on Debian systems.
  • Integrate crosscompilers in Debian -- Figure 1: Cross build visualization

Build old style compilers


Build sysroot compilers


Build multiarch compilers

See http://wiki.debian.org/MultiarchCrossToolchains