32 bit compile/link on 64 bit system

$ cat aa.c
#include <stdio.h>

int main(void)
{
printf("hello world
");
return(0);
}

gcc -m32 aa.c
/usr/lib64/gcc/x86_64-suse-linux/4.5/…/…/…/…/x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.5/libgcc.a when searching for -lgcc
/usr/lib64/gcc/x86_64-suse-linux/4.5/…/…/…/…/x86_64-suse-linux/bin/ld: cannot find -lgcc

I need to link a C program to some 32-bit libraries.

/lib
-rwxr-xr-x 1 root root 116348 2010-07-01 14:29 libgcc_s.so.1
$ file libgcc_s.so.1
libgcc_s.so.1: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped

Thank you for your time.

Check if you have a file
/usr/lib64/gcc/x86_64-suse-linux/4.5/32/libgcc.a
(note the 32 in the path name).
If not install gcc45-32bit


PC: oS 11.3 64 bit | Intel Core2 Quad Q8300@2.50GHz | KDE 4.6.1 | GeForce
9600 GT | 4GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.6.0 | nVidia
ION | 3GB Ram

Thanks Martin - that’ the ticket