Terse guide to getting a cross compiler on Debian

It's not exactly point and click, but it does work, eventually. This talks about ia64, substitute your target architecture (.

  • apt-get source binutils.
  • Build with TARGET=ia64 fakeroot debian/rules binary-cross, install.
  • apt-get source gcc-4.0 and run GCC_TARGET=ia64 ./debian/rules control.
  • Now have a look at debian/control and take note of the pacakges with -ia64-cross. You need to make these with dpkg-cross. Download the packages from the archive and run dpkg-cross -a ia64 -b package.deb. Install. There is also a tool in unstable called apt-cross which makes this painless.
  • Try building gcc with GCC_TARGET=ia64 DEB_CROSS_INDEPENDENT=yes dpkg-buildpackage -rfakeroot. It will tell you if there are any missing dependencies.
  • Build should complete, and you should have ia64-linux-gnu-blah tools.

The only problem with this approach is that your packages depend on the gcc-4.0-base package, and if this is updated in the archives you need to rebuild all your cross compilers. Considering this package consists of readme files, this is slightly annoying.

Update: I have written a program get-from-pool.py to help you finding the files for the other architecture which you need to build with dpkg-cross.

Update 2: I have a patch that enables you to build packages without depending on the underlying system. See Debian bug #347484.

Update 3: updated for today's environment.