Trouble compiling a 32 bit binary on a 64 bit machine

Solution 1:

Lekensteyn's answer conflicted with lots of existing packages for me (on 64-bit oneiric).

I instead did this, which pulled in the libc6-dev-i386 package:

sudo apt-get install gcc-multilib

Solution 2:

ia32-libs just contains some compatibility libraries haven't been migrated yet to Multi Arch. For compiling 32-bit libraries, you need to install the 32-bit libraries and development files for C:

sudo apt-get install libc6-dev:i386

See also: Does the multiarch feature in 11.10 mean the death of force--architecture installs?