This page describes how to set up a cross-compilation environment under Debian for IA64. It is based on the instructions for the toolchain-source package at http://people.debian.org/~debacle/cross.html.

See also the CrossDevelopment page.

MartinPool has written an AlternateCrossCompilation page that explains how to build a cross compilation environment based on the upstream sources. There's also AlternateCrossCompilation2 that uses libraries from a real IA64 machine, and AlternateCrossCompilation3 (due to Al Viro) that has better control over the versions used.

Once upon a time one could use the NUE environment from Hewlett-Packard to cross-compile on IA32 linux. Unfortunately, NUE has suffered major bitrot, and is unuseable with current libraries.

Prebuilt debs for gcc and binutils are available from the GelatoDebianRepository, for cross compilation from IA64 to IA32 and vice versa. See /OtherArchitectures for non-IA64 notes and gotchas.


Install everything

NOTE: the toolchain-source method is deprecated; but I'm leaving this page here for historical reference. The tpkg-install-libc script is still quite useful though. I suggest you use AlternateCrossCompilation3

  apt-get install toolchain-source

This gets you the current source for gcc and binutils, and tools for generating debs for other architectures than your own.

The original HOWTO says to edit /etc/dpkg/crosscompile but this doesn't appear to be necessary with the current packages.

It's nice to have the multi-architecture binutils around if you're doing much cross-development, so install it now, if it isn't already installed:

  apt-get install binutils-multiarch

It's easiest to build debian packages if you have fakeroot, debhelper and devscripts installed. The rest of these instructions assume that those packages are installed, so do it now.

  apt-get install fakeroot debhelper devscripts

Set up the environment

Set yourself up a source environment by

mkdir toolchain-ia64
cd toolchain-ia64
EMAIL=you@yourplace.yourdomain tpkg-make ia64-linux

The argument, ia64-linux tells the tpkg-make utility

  1. the architecture to build for, and implicitly
  2. where to find the headers and libraries.

Some versions of the toolchain source change ia64-linux to ia64-unknown-linux when the package is built and installed. If yours does this, create a symlink from /usr/ia64-linux to /usr/ia64-unknown-linux before building gcc.

Build and install binutils

Build yourself a binutils specific for IA64 -- you'll need the assembler even if you need nothing else.

If you want to compile the Linux Kernel, make sure that your version of binutils is later than 2.13.90.0.10. The 3.2-7 toolchain source appears OK.

 $ cd binutils*
 $ debuild
 $ sudo debi

You'll see some harmless error messages, and a lot of gcc warnings. You can ignore these if the compilation completes.

Can't open perl script "debian/scripts/dh_split": No such file or directory

The process takes around 10 minutes on my 2.0GHz P4.

Install the IA64 libraries and header files

Edit /usr/bin/tpkg-install-libc and replace the URL of the UK debian server with something close to you:

SERVER=${TPKG_SERVER:-"ftp://ftp.au.debian.org"}

(or you can override it on the command line)

Take a look in /etc/dpkg/cross-compile and make sure that crossbase is /usr and crossdir is not defined.

Apply the patch from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=222168 if you have an old dpkg-cross package (or update to the current version from unstable) to /usr/bin/dpkg-cross, then install the linux-kernel headers and libraries:

   sudo tpkg-install-libc ia64 linux-kernel-headers
   sudo tpkg-install-libc ia64

Build GCC

If you want anything other than a C compiler, edit gcc-ia64-linux-*/debian/rules and add the other languages to the configure arguments (for example to enable C++:

 --enable-languages="c,c++" \

)

For building c++, I also found it necessary to comment out the call to ia64-linux-strip, otherwise it tries to strip libstc++ and the linker scripts.

Then build and install:

 cd gcc-ia64-linux-*
 export DEB_BUILD_OPTIONS=nostrip
 debuild
 sudo debi

Check everything's there

$ dpkg -l "*-ia64-*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  binutils-ia64- 2.13.90.0.18-1 Binary utilities for cross-developing for ia
ii  gcc-ia64-linux 3.2.3.cvs20030 The GNU C compiler as cross compiler for ia6
ii  libc6.1-dev-ia 2.3.1-16       GNU C Library: Development Libraries andHea
ii  libc6.1-ia64-c 2.3.1-16       GNU C Library: Shared libraries and imezone
ii  libdb1-compat- 2.1.3-7        The Berkeley database routines [glibc 2.0/2.
ii  linux-kernel-h 2.5.999-test7- Linux Kernel Headers for development (for cr

IA64wiki: CrossCompilation (last edited 2009-12-10 03:13:40 by localhost)

Gelato@UNSW is sponsored by
the University of New South Wales National ICT Australia The Gelato Federation Hewlett-Packard Company Australian Research Council
Please contact us with any questions or comments.