24

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?

tshepang
  • 12,111
  • 21
  • 91
  • 136
fadedbee
  • 42,671
  • 44
  • 178
  • 308

3 Answers3

19

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
thiton
  • 35,651
  • 4
  • 70
  • 100
  • 1
    To build a new package from scratch: `pdebuild --architecture i386` in the directory that contains debian/ directory. – Jahid Aug 24 '15 at 15:25
3

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.

tshepang
  • 12,111
  • 21
  • 91
  • 136
James Westby
  • 131
  • 1
-2

You don't do anything thing different from building a 64bit .deb. Except that you include a 32bit build of your application.

The control file specifies the architecture, so be sure you select the correct one.

he_the_great
  • 6,554
  • 2
  • 30
  • 28
  • 1
    Not true. Debian packages include the architecture of the package, which is explicitly specified. – Michael Mior Oct 29 '11 at 23:35
  • @Michael, so it is explicitly specified with the option that appears to have no documentation what-so-ever? – he_the_great Oct 30 '11 at 16:25
  • Actually, the structure of package control files is very well documented. Including the [Architecture](http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Architecture) option. – Michael Mior Oct 30 '11 at 21:38
  • @Michael, well yes, I was reading the other answer which mentions -ai386 and couldn't actually find it. Specifying the architecture is part of building a deb package, whether you are on amd64 or i386 the architecture selection is still part of the process. – he_the_great Oct 31 '11 at 03:46
  • Exactly. And it appears to be part of the process the OP has questions about. – Michael Mior Oct 31 '11 at 13:49