What's xdeb?

xdeb is a cross-build tool for Debian packages

xdeb allows building a set of packages, using either native or cross compilation. It is based on dpkg-cross and includes heuristics to map package names to the build or host architecture.

xdeb will build source packages from either APT or the current directory and can optionally convert existing natively built packages to satisfy build-dependencies. It will also schedule builds in the proper order as specified in build-dependencies.

If you just want to build one package against an existing repository then pdebuild-cross is more likely to 'just work'. It is also a bit easier to get started with as it makes the cross-building chroot for you. The build is done in a clean chroot each time (like pbuilder). This is slower (after the first time) but is consistent. See UsingPdebuildCross.

Notes to get started

Create a maverick chroot

Ubuntu maverick offers a xdeb package an apt-get install away and a subset of cross-buildable packages.

To create a chroot from a Debian/Ubuntu system:

    sudo debootstrap maverick m-xdeb

This will create a chroot from Ubuntu maverick in the m-xdeb directory.

Install xdeb

    # enter the chroot
    sudo chroot m-xdeb
    # edit sources, add the "universe" component after "main"
    vi /etc/apt/sources.list
    # Mount essential stuff
    mount -t proc proc /proc
    mount -t devpts none /dev/pts
    # chroot lacks locale informations
    export LC_ALL=C
    apt-get update
    # install xdeb
    apt-get install xdeb

You can now check the xdeb man page to see the multiple ways in which it can be called, but you need a Debianized cross-compiler to cross-build Debian packages.

Install cross-compiler packages

    # enter the chroot
    sudo chroot m-xdeb
    # chroot lacks locale informations
    export LC_ALL=C
    # update repos
    apt-get update
    # install "cross" build-essential
    apt-get install g++-arm-linux-gnueabi

Trying it out!

Create a testuser in your chroot to run builds:

    # enter the chroot
    sudo chroot m-xdeb
    # chroot lacks locale informations
    export LC_ALL=C
    # create a "build" user
    adduser --disabled-password build
    # Add 'build' to sudo group
    adduser build sudo

Add entries for Ubuntu source packages in the software sources:

    # enter the chroot
    sudo chroot m-xdeb
    # chroot lacks locale informations
    export LC_ALL=C
    # add a "deb-src ..." entry in /etc/apt/sources.list to get access to sources "deb-src http://archive.ubuntu.com/ubuntu maverick main universe"
    apt-get update

If you want to use the '--prfer-apt or --only-explicit' options so that dependencies are satisfied by pre-built ones where they exist then you need to add an appropriate ('armel') repository:

    # enter the chroot
    sudo chroot m-xdeb
    # add a "deb ..." entry in /etc/apt/sources.list to get access to armel packages and dependency lists "deb [arch=armel] http://ports.ubuntu.com/ maverick main universe"

Kick a build of grep and build-deps:

    # enter the chroot as the build user
    sudo chroot m-xdeb su - build
    # chroot lacks locale informations
    export LC_ALL=C
    # kick a cross-build of grep for armel, as downloaded over APT
    xdeb -a armel --apt-source grep

Many packages will not cross compile straight from the distribution.

Some packages (roughly) patched to cross build with xdeb are available from https://launchpad.net/~peter-pearse/+archive/cross-source

See also https://wiki.linaro.org/CrossPatching



Binaries for the relevant architecture will always be imported, rather than built, whatever the entry on the xdeb command line.

Useful to exclude script entries e.g. if several scripts have the line

xdeb -a armel --only-explicit --apt-source ppp

entering ppp in the native import list saves having to edit each script.


xdeb may fail to recognise some Build-Depends packages as necessary for cross building e.g. tcl8.5, tcl8.5-dev Enter such packages in the list to ensure

  • the dependencies of the package are cross built
  • the package is cross built
  • the packages produced are crossed & installed


Entries for particular packages described at https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/CrossPatching


1 If the crossed package is already installed you may need to delete it before running xdeb

e.g. The installed ncurses library is non-debug but will be linked against during the debug build of ncurses, causing the build to fail.

2 Cycles - when xdeb attempts to determine the build sequence by examining dependencies it may detect cycles

TODO Sample here

Some may be constructs.

One method for resolving cycles

Particular Packages


As of 31st Jan 2011 sqlite3-3.7.4-2 depends on tclConfig.sh from tcl8.5-dev.

dpk-cross does not recognise this as a necessary cross file, so it is not crossed into e.g. tcl8.5-dev-armel-cross_8.5.8-2build2_all.deb

It must be hand installed from e.g. tcl8.5-dev_8.5.8-2build2_armel.deb


Platform/DevPlatform/CrossCompile/UsingXdeb (last modified 2011-05-06 01:11:50)