how to pass -m elf_i386 to gcc?

10,513
gcc -m32

is what you want probably. The elf_i386 is passed by gcc to ld (if needed) just as Alan Curry mentioned in the comments.

The "skipping incompatible library" warning is just a warning and if it doesn't come up with "can't find the library", then you can assume it linked to the correct binary (because of the -m32 option).

Share:
10,513
user1051003
Author by

user1051003

Updated on June 20, 2022

Comments

  • user1051003
    user1051003 about 2 years

    I wrote like this :

     gcc -m elf_i386
    

    it says:

    gcc: error: elf_i386: No such file or directory
    

    basically I am trying to compile a 32bit program on 64bit system,but error :

    /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've checked the project built with -m32 and I can see all the *.o file are ELF 32-bit LSB,and the /usr/lib/libSDL.so are ELF 32-bit LSB too...so I might need pass -m elf_i386 to ld right? but I don't use ld directly I just use gcc to compile it.