I have a i386 ubuntu hardy machine, and an amd64 ubuntu hardy machine. I want to compile a debian package (a.k.a. deb) for the amd64 machine on the i386 (because I don't have enough memory to compile is quickly on the amd64 machine). If I do a dpkg-buildpackage
on the i386 machine, it produces a deb for i386, which can't be installed on the amd64 machine. Is there anyway to compile the deb for amd64 on the i386 machine?
So, there are some solutions to that:
dpkg-buildpackage
to build your package. The problem is that creating a toolchain is not very straightforward.It's probably more trouble than it's worth to try and get cross compiling going. There are various ways to emulate 64 bit systems on 32 bits, but you'll pay a perfomance price.
If you're only doing a bit of this, then I'd say fire up a 64 bit machine on Amazon for a few hours. If you're doing it a lot, then maybe get some 64 bit hardware, or maybe AWS remains interesting, because you only pay for how much you use it, and you can fire up a build farm when you want it.
This might give you some useful ideas: http://blog.fwbuilder.org/2009/05/building-ubuntu-deb-packages-on-amazon.html
This list of images of debian systems for various architectures and releases might be useful too: https://wiki.debian.org/Cloud/AmazonEC2Image
One thing I do on Debian all the time is use a 64-bit kernel with a 32-bit userland for my normal system, and then create a chroot with 64-bit userland to build amd64 packages. The structure of the kernel packages in Ubuntu is a bit different, so I don't know if this is possible or recommendable there.
Other than that, the clean solution is to use a virtual machine. QEMU is the obvious choice, because it can emulate just about anything on anything (and it's free). You can use qemubuilder (packaged in Ubuntu) to integrate the build with pbuilder. This can be a bit tricky to set up in my experience, but it might be worth it if you need to do this repeatedly. For a few packages, just fire up QEMU and log in by hand.
If you are very adventurous you can also try cross-compiling, but this is probably much more difficult and doesn't work with all packages. Look for dpkg-cross to get started.
Or how about you create a Personal Package Archive (PPA) on Launchpad and have your package be autobuilt there.