How to get -m elf_i386 into gcc?

I wrote like this:

gcc -m elf_i386 

He says:

 gcc: error: elf_i386: No such file or directory 

Basically I am trying to compile a 32-bit program on a 64-bit system, but the error is:

 /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL 

which I checked a project built with -m32 and I see that all * .o files are 32-bit LSB ELBs, and /usr/lib/libSDL.so is also 32-bit ELB ELBs..so I can , need to go -m elf_i386 to ld right? but I do not use ld directly. I just use gcc to compile it.

+4
source share
1 answer
 gcc -m32 

- this is what you probably want. Elf_i386 is passed gcc to ld (if necessary) in the same way as mentioned in Alan Curry's comments.

The warning “skip incompatible library” is just a warning, and if he didn’t come up with “cannot find the library”, you can assume that it is associated with the correct binary (due to the -m32 option).

+6
source

Source: https://habr.com/ru/post/914778/


All Articles