日期:2014-05-16  浏览次数:20816 次

Linux动态加载库剖析

问题:

  在程序测试中发现报下面的这个错误

   soxmix: error while loading shared libraries: libippsc.so: cannot open shared object file: No such file or directory

  这个程序是在64位平台下进行的编译,64位平台的库的名字已及路径: /opt/intel/ipp41/em64t/sharedlib/libippscem64t.so  

在Makefile编译时的链接环境:

IPPROOT = /opt/intel/ipp41/em64t
LIB_G729  = -L./libg729 -L$(IPPROOT)/sharedlib -L$(IPPROOT)/sharedlib/linuxem64t -lg729 -lippscem64t -lipp

ld.so.conf内容:

include ld.so.conf.d/*.conf
/opt/intel/ipp41/em64t/sharedlib
/opt/intel/ipp41/em64t/sharedlib/linuxem64t

使用readelf  -d soxmix 命令查看库的链接情况:

 

[root@localhost src]# readelf -d soxmix

Dynamic section at offset 0x914f0 contains 33 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libvorbisfile.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libvorbisenc.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libvorbis.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libogg.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libmad.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libmp3lame.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libippscem64t.so]
 0x0000000000000001 (NEEDED)             Shared library: [libippsrem64t.so]
 0x0000000000000001 (NEEDED)             Shared library: [libippsem64t.so]
 0x0000000000000001 (NEEDED)             Shared library: [libippcoreem64t.so]
 0x0000000000000001 (NEEDED)             Shared library: [libguide.so]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x403118
 0x000000000000000d (FINI)               0x452c18
 0x000000006ffffef5 (GNU_HASH)           0x400240
 0x0000000000000005 (STRTAB)             0x4013e0
 0x0000000000000006 (SYMTAB)             0x4002a0
 0x000000000000000a (STRSZ)              2732 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)      &n