Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to compile a c program as a 32 bit binary instead of 64 bit. I started by just adding -m32 and got some errors. Googling around a little I came across a note to install ia32-libs. Running apt-get install ia32-libs resulted in a notification taht it was already installed and at the newest version.

There is a chain of libraries each one including the next until it fails:

/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory

It seems to be including 32 bit versions of the other includes /usr/include/c++/4.6/x86_64-linux-gnu/32/bits/ ...

What am I missing?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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?

share|improve this answer
    
Installing libc6-dev:i386 insisted on removing the entire gnu compiler suite (which gave me a little heart attack) but after using sudo apt-get install build-essential everything worked perfectly. –  Matt Jan 1 '12 at 21:14
    
For me, it also uninstalled nvidia-current... reinstalled with no problems though. –  Jeff May 12 '12 at 2:48
    
Note that the option given by alberge seems better in that it won't remove tons of other things for installing the 32-bit libraries. –  Fabio Zadrozny Sep 7 '12 at 18:53

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:

apt-get install gcc-multilib
share|improve this answer
    
Should be the accepted answer. –  leighman Sep 28 '13 at 20:03

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.