error while loading shared libraries: /usr/lib/a.so: ELF file OS ABI invalid

ningz0216 2011-04-20 01:44:44
我使用的系统是[红帽企业Linux.5.5.for.x86_64.桌面版].[i.Studio]rhel-client-5.5-x86_64-dvd.iso,64位的,同样的程序在ubuntu 64位下面运行成功,但是在小红帽系统下编译可以成功,运行时提示error while loading shared libraries: /usr/lib/a.so: ELF file OS ABI invalid。查了下资料,觉得有可能是两个系统下的ABI不同,可能需要在出问题的系统上重新编译库a.so。不知道有没有人遇到过这样的问题并解决了的。

贴出下面的一些信息。
在出现问题的系统上其他库的ELF头信息:
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: Intel 80386
Version: 0x1
Entry point address: 0xa609a0
Start of program headers: 52 (bytes into file)
Start of section headers: 246868 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 5
Size of section headers: 40 (bytes)
Number of section headers: 29
Section header string table index: 28

下面的是出现问题的a.so的ELF头信息。
Magic: 7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - Linux
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x2d10
Start of program headers: 64 (bytes into file)
Start of section headers: 108496 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 6
Size of section headers: 64 (bytes)
Number of section headers: 29
Section header string table index: 26


其中OS/ABI这项不同,不知道是否和这个相关。

求高手回复。
...全文
1762 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
oEason12345 2012-08-13
  • 打赏
  • 举报
回复
可以解决
Liv2005 2012-01-13
  • 打赏
  • 举报
回复
编译可以成功,运行失败的话,说明在程序指定的PATH里没有找到需要的so文件,一般只需要find 相同名称的so,并将其软链接到指定的路径就可以了。
yzq025 2012-01-13
  • 打赏
  • 举报
回复
我也出现过这个问题,在出问题的机器上重新编译就OK了!
主要原因是两个GCC版本不一样,一个高版本的GCC编译后在低版本的c库下就会出现这个问题!
貌似不编译不行,我也很纠结!
ningz0216 2011-04-20
  • 打赏
  • 举报
回复
楼上遇到过类似的问题吗?确定重新编译可以解决吗?此外是否需要与出现问题的系统上的GCC版本必须相同?glibc的版本必须相同?内核版本必须相同呢? 求回复!
justkk 2011-04-20
  • 打赏
  • 举报
回复
最好在你的目标环境中重新编译需要的.so文件

23,120

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧