Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
1  
This may include some of what you need.wiki.debian.org/DebianAMD64Faq –  Zoredache May 8 '10 at 23:49
    
@Zoredache, that FAQ is good, and explains how to compile a i386 deb on an amd64 machine, but not the reverse –  Rory May 9 '10 at 11:58
1  
For the flaggers: compiling software is well within administrative responsibilities and does not automatically belong on Stackoverflow, especially in the case of package creating. –  Warner May 9 '10 at 22:25
    
it does include how to compile a 64bit kernel on i386. But I agree that it doesn't tell give details for your specific situation, which is why I added it as a comment. –  Zoredache May 10 '10 at 2:36
1  
I am a bit confused about why you would be using amd64 on a system with low amounts of memory. Does your i386 have a 64bit capable processor? I would guess you could boot amd64 temporarily from a livecd or something to do your compilation. –  Zoredache May 10 '10 at 2:38

3 Answers 3

So, there are some solutions to that:

  • Setup a cross-compiling toolchain and use regular dpkg-buildpackage to build your package. The problem is that creating a toolchain is not very straightforward.
  • Use a 32 bit chroot on your 64 bit machine to compile stuff. Apparently it's the most recommended method. This blog post has an example of kernel compilation but it's the same process for any other software.
share|improve this answer
1  
32 bit chroot on a 64 bit machine, is not very helpful. I want to compile a 64 bit deb on a 32 bit machine. I can't do any compiling on my 64 bit machine. And I'm pretty sure you can't run a 64 bit chroot on a 32 bit machine. –  Rory Apr 18 '11 at 11:00
    
Ahh sorry I misread your question then. Maybe cross compiling works? –  coredump Apr 18 '11 at 11:33

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

share|improve this answer

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.

share|improve this answer
    
The OP asks for 64bit target with a 32bit machine, not the contrary –  miniBill Apr 29 at 19:51
    
it may be relevant - sometimes folks run a 32-bit OS on 64-bit hardware. –  Dan Pritts Apr 30 at 13:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.