I compiled a PHP extension on Fedora Core 12, but when I send it to someone using CentOS they get the error: \"ELF file OS ABI invalid\"
I\'m not sure what causes th
The statement: "ELF file OS ABI invalid", means that the Application Binary Interface is non compatible between binaries used (i.e. one is trying to mix host and target binaries, which may not work as expected). The e_ident[EI_OSABI] byte of the ELF header contains the operating system/ABI identification. Your Fedora system is setting this to ELFOSABI_LINUX
(3
) while your friend's CentOS system is setting it to ELFOSABI_SYSV
(ELFOSABI_NONE
or 0
).
You may be able to compile the FreeBSD brandelf utility (brandelf.c) and use it to set the OSABI to ELFOSABI_SYSV
(brandelf -f 0
or brandelf -t SVR4
.
I am not aware of any gcc flags for specifying this value at compile/link time. I believe that the version of binutils used by gcc on your Fedora system is responsible for setting the OSABI to Linux. It is my understanding that the linker only specifies the ABI if a STT_GNU_IFUNC
symbol ends up in the output file (see ifunc.txt at http://groups.google.com/group/generic-abi for details on STT_GNU_IFUNC
).
The readelf(1) command can be used to retrieve and display the ABI information stored in the ELF header (readelf -h
).
This similar question may also be of interest.