Compiling to 32 bit binary on 64 bit OpenSuSe 12.3

Pretty simple or at least it should be:

trying to compile this C program to a 32 bit binary:

#include <stdio.h>

int main(int argc,char *argv])

printf("Hello There

Have done it for many years using simple gcc -m32 hello.c -o hello

Now when I do this I get the following:

/usr/lib64/gcc/x86_64-suse-linux/4.7/…/…/…/…/x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.7/libgcc.a when searching for -lgcc
/usr/lib64/gcc/x86_64-suse-linux/4.7/…/…/…/…/x86_64-suse-linux/bin/ld: cannot find -lgcc
/usr/lib64/gcc/x86_64-suse-linux/4.7/…/…/…/…/x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.7/ when searching for -lgcc_s
/usr/lib64/gcc/x86_64-suse-linux/4.7/…/…/…/…/x86_64-suse-linux/bin/ld: cannot find -lgcc_s

I know it means that in the link phase it cannot find the 32 bit versions of libgcc.a which when I search /usr I only see a 64 bit version in the directory as listed above.

I installed the glibc-devel-32bit package. This got past a header file compile error but I cannot seem to find a package(s) that will allow a 32 bit binary to be created. Any ideas?

I realize there is no reason I could not use a 64 bit hello program this is just a very simple example.

The missing libgcc.a exists in gcc47-32bit… is this installed?

Worked for me after installing gcc47-32bit:

sudo zypper in gcc47-32bit

Good luck.

Yes thank you

Adding the gcc47-32bit package works great. I thought I looked through the gcc47 packages available but must of missed it.

I also noticed on another system that it will automatically ask for the glibc-devel-32bit package if you just select gcc47-32bit.

So simple solution. Thanks

I realize this is an old topic, but it did help me compiling lmms. ( a music producing program )

Make stopped with an error.

I could not find: gcc47-32bit

but I did find

gcc-32bit - The system GNU C Compiler

gcc48-32bit - The GNU C Compiler 32bit support

And I also needed something maybe not related to this topic.


you are aware that 12.3 is now END OF LIFE

**there is no support for it any longer **

please upgrade to OpenSUSE 13.2
or the Long Term Support
OpenSUSE 13.1 LTS