# Ubuntu – How to build a 32-bit deb file on a 64-bit machine

32-bit64-bitcompilingdeb

I have followed this answer to get the build dependencies for what I am building, and then actually compile the source and build it into a deb file, however I am needing to create a deb file for 32-bit, and I am running 64-bit, so it automatically makes it a 64-bit one and not a 32-bit one, so is there any way that I can specify that I want it to create a 32-bit one and not a 64-bit one?

• you can simply specify the architecture via -a in debuild:

debuild -a i386


Although in most cases that won't work. pbuilder is a fantastic tool which provides you with a clean Ubuntu/Debian system inside you environment which you can specify the architecture of.

man pbuilder has all the info you need you create your 32-bit archive. Here's a couple of useful commands for you inside pbuilder:

sudo pbuilder --create --architecture i386
sudo pbuilder --build mypackage.dsc


pbuilder's user manual