error compiling for 32-bit on 64-bit system

Asked by John Cosley

I am running Ubuntu 10.10 on 64-bit platform. When compiling for 32-bits (C program), I get the following error:

/usr/include/gnu/stubs.h:7: fatal error: gnu/stubs-32.h: No such file or directory

I am sure this is due to not having loaded the 32-bit lib options when ubuntu was installed (at the factory). I am trying to find out where I can get the necessary libs and the procedure to get it installed.
Thanks

-------------------------------
Thanks Daniel, but I still get the same error when I try to compile after your apt-get suggestion. Is there another lib I should be installing? I checked for /usr/include/gnu/stubs-32.h and it is still not there. How can I get a lising of the available libs? Basically, when I use the -m32 gcc compile option, I get this error message. I am on a Wild Dog system76 machine (Intel Core i7-870 processor).

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
John Cosley
Solved:
Last query:
Last reply:
Revision history for this message
Daniel Martí (mvdan-deactivatedaccount) said :
#1

There is a library called ia32-libs that allows you to run 32-bit apps in 64-bit OS. Try installing it:

sudo apt-get update
sudo apt-get install ia32-libs

Then try compiling for 32-bits again, and tell us if it works :)

Revision history for this message
John Cosley (john-sourceiii) said :
#2

Thanks Daniel, but I still get the same error when I try to compile after your apt-get suggestion. Is there another lib I should be installing? I checked for /usr/include/gnu/stubs-32.h and it is still not there. How can I get a lising of the available libs? Basically, when I use the -m32 gcc compile option, I get this error message. I am on a Wild Dog system76 machine (Intel Core i7-870 processor).

Revision history for this message
George Standish (george-standish-deactivatedaccount) said :
#3

John,

Daniel's suggestion was a good one, for running programs - not compiling them.

You need to research "cross compiling" I believe, something I don't know anything about. You may be able to create some sort of 32bit chroot environment or something? I really don't know for sure...

Best of luck,
George

Revision history for this message
John Cosley (john-sourceiii) said :
#4

Thanks George,
You are correct - this is cross-compiling. I was able to find the correct lib to do this -
 it is libc6-dev-i386. I installed it using the Ububtu Software Center.