Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I build a 32bit (i386) .deb on a 64bit box?

Tags:

I have applications which successfully compile with the -m32 switch (in DMD and/or GCC) to produce:

appname: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped 

The source packages I have created work fine, on both 32 bit and 64 bit Ubuntu to build the appropriate binary .debs.

I would like to produce the i386 .deb on the same 64 bit machine i use to produce the 64 bit .deb.

Is this possible, and where should I look for instructions?

like image 747
fadedbee Avatar asked Oct 29 '11 16:10

fadedbee


People also ask

How do I enable 32-bit on 64 bit Ubuntu?

To install 32-bit libraries on Ubuntu 13.04 (64-bit) or later, open Terminal and type: sudo apt-get install lib32z1 (you will need to enter your password). Then just for good measure, let's make sure your Ubuntu is up to date. Type sudo apt-get update and lastly, restart your computer.


2 Answers

The answer depends on the complexity of your build. When the normal 64 bit userland tools suffice for a build, simply specify the architecture via -a

debuild -ai386 

However, there are often cases where this doesn't work, and in these cases you'll need pbuilder. pbuilder builds a clean Debian/Ubuntu system in a chroot-ed environment. man pbuilder is a good introduction. To get started, you'll need:

sudo pbuilder --create --architecture i386 sudo pbuilder --build mypackage.dsc 
like image 168
thiton Avatar answered Sep 23 '22 07:09

thiton


It starts with calling debuild with the -ai386 option, which will change the architecture that the package is built for.

Of course you have to ensure that the package contains the i386 build of the application.

like image 38
James Westby Avatar answered Sep 19 '22 07:09

James Westby