cannot load shared object file undefined symbol

场景:

共享库里引用了主程序一个符号,结构编译的时候没问题,运行时用 dlopen 打开共享库报上述错误

原因:共享库使用的这个符号在主程序里没有任何调用,所以编译主程序时改符号没有被导出。需要在编译主程序时添加编译选项 :  -export-dynamic

-export-dynamic:默认情况下,链接器在产生可执行文件时,为了减少符号表大只会将那些被其他模块引用到的符号放到动态符号表。也就是说,在共享模块引用主模块时,只有那些在链接时被共享模块引用到的符号才会被导出。当程序使用dlopen()加载某个共享模块时,如果该共享模块反向引用了主模块的符号,而该符号可能在链接时因为未被其他模块引用而未被导出到动态符号表,这样反向引用就会失败。这个参数就是用来解决这个问题的。它表示,链接器在产生可执行文件时,将所有全局符号导出动态符号表。

参考:http://duanple.blog.163.com/blog/static/7097176720111141085197/

时间: 2024-11-02 18:50:25

cannot load shared object file undefined symbol的相关文章

iptables报错:Couldn't load target `accept':/lib64/iptables/libipt_accept.so: cannot open shared object file: No such file or directory

语句:iptables -A INPUT -s 134.192.204.235 -p TCP --dport 11211 -j accept 报错:Couldn't load target `accept':/lib64/iptables/libipt_accept.so: cannot open shared object file: No such file or directory 原因:规则语句写错accept应大写ACCEPT 参考:http://www.cnblogs.com/iii

EBS安装提示libXtst.so.6: cannot open shared object file

$ ./rapidwiz Rapid Install Wizard is validating your file system...... CMDDIR=/app/Stage122/startCD/Disk1/rapidwiz Rapid Install Wizard will now launch the Java Interface..... $ Exception in thread "main" java.lang.UnsatisfiedLinkError: /app/Sta

cannot open shared object file解决办法

Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - libjpeg.so.9: cannot open shared object file: No such file or directory in Unknown on line 0 locate libjpeg.so.9 将找到的路径加到/etc/ld.so.conf文件末尾,然后/sbin/ldconfig即可

oracle10g 安装遇到libXp.so.6: cannot open shared object file

在安装oracle10g的时候出现如下错误: [[email protected] clusterware]$ ./runInstaller ******************************************************************************** Please run the script rootpre.sh as root on all machines/nodes. The script can be found at the top

ogg启动报错libnnz11.so: cannot open shared object file

当ogg软件解压,并给予正确的权限后,在启动ogg时会遇到如下报错: [[email protected] ogg]# ./ggsci./ggsci: error while loading shared libraries: libnnz11.so: cannot open shared object file: No such file or directory 这里是因为缺少libnnz11.so库文件造成的,需要给出此库文件的位置,解决如下: [Oracle@oggtest ogg]$

libuuid.so: cannot open shared object file: No such file or directory

在玩ngx-lua时候有个 resty-uuid 需要引用 libuuid.so 动态库 打印log提示信息是这样的: libuuid.so: cannot open shared object file: No such file or directory 解决方案: [[email protected] ~]#yum install libuuid libuuid-devel [[email protected] ~]#ln -s /lib64/libuuid.so.1.3.0 /usr/l

ArchLinux 下 virtualbox 报错 libQtCore.so.4: cannot open shared object file

VirtualBox: supR3HardenedMainGetTrustedMain: dlopen("/usr/lib/virtualbox/VirtualBox.so",) failed: libQtCore.so.4: cannot open shared object file: No such file or directory

ubuntu解决libstdc++.so.6: cannot open shared object file: No such file or directory:问题

解决libstdc++.so.6: cannot open shared object file: No such file or directory:原因在于,在13.10 版本中,ia32_libs 被废弃了导致没有32位的lib库.解决方法sudo apt-get install lib32stdc++6sudo apt-get install lib32z1

libdb2.so.1: cannot open shared object file: No such file or directory

[[email protected] bin]# ./dsmserv ./dsmserv: error while loading shared libraries: libdb2.so.1: cannot open shared object file: No such file or directory [[email protected] bin]# pwd /opt/tivoli/tsm/server/bin Resolving the problem The below steps m