ldd xx.so 显示 not a dynamic executable


系统版本64位red hat as 5 项目需要引用一个so文件 厂家给了个64位下的so file 命令libJavaSense4Pkg.so
libJavaSense4Pkg.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped

ldd libJavaSense4Pkg.so 显示 not a dynamic executable 工程无论如何都不能正常读取这个so文件,想问一下 是我系统的原因 还是so本身的问题 我需要做一些配置吗

redhat Linux

西蒙·贝尔萌特 12 years, 9 months ago

ldd是个shell脚本:
98 nonelf ()
99 {
100 # Maybe extra code for non-ELF binaries.
101 file=$1
102 # Run the ldd stub.
103 lddlibc4 "$file"
104 # Test the result.
105 if test $? -lt 3; then
106 return 0;
107 fi
108 # In case of an error punt.
109 return 1;
110 }

190 1)
191 # This can be a non-ELF binary or no binary at all.
192 nonelf "$file" || {
193 echo $" not a dynamic executable"
194 result=1
195 }
196 ;;

# lddlibc4 libJavaSense4Pkg.so
# echo $?

看看返回值是不是小于3

如果是小于3了,就要看下lddlibc4的代码了:
78 /* First see whether this is really an a.out binary. */
79 fp = fopen (filename, "rb");
80 if (fp == NULL)
81 error (2, errno, gettext ("cannot open %s'"), filename); 82 83 /* Read the program header. */ 84 if (fread (&exec, sizeof exec, 1, fp) < 1) 85 error (2, errno, gettext ("cannot read header from %s'"), filename);

总体来说,出现这个情况应该是so文件有问题可能性较大。

零者皆无奏想 answered 12 years, 9 months ago

Your Answer