32 bit standard C library on 64 bit machine

32bit-64bit, c, shared-libraries

Solution

Try this:

  apt-get install ia32-libs 

Also, you should compile/link with -m32:

gcc -Wall -pedantic -m32 ...

Problem

I am using ubuntu 12.04 on 64 bit machine, I have this simple C code: ``` int b = 20; int c = 10; int main(int argc, char **argv) { c = 50; } ``` I was trying make it compatible with any IA32 machine by compiling it like this: ``` unix> gcc -m32 code.c ``` And got these errors: ``` /usr/bin/ld: cannot find crt1.o: No such file or directory /usr/bin/ld: cannot find crti.o: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc_s.so when searching for -lgcc_s /usr/bin/ld: cannot find -lgcc_s /usr/bin/ld: cannot find -lc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc_s.so when searching for -lgcc_s /usr/bin/ld: cannot find -lgcc_s /usr/bin/ld: cannot find crtn.o: No such file or directory collect2: ld returned 1 exit status ``` As I understand, this is happening because I'm missing 32 bit standard C library, so linker cannot link my code against standard C library. How can I obtain the needed 32 standard C on my 64 bit machine?

Original source

Related problems