dlopen
位于libdl.a
但是当我将我的应用程序链接到libdl.a
,gcc 链接器抛出此错误:unknow reference to __dlopen called in dlopen
我应该导入另一个吗.a
?
当我尝试静态编译时dlopen
样机程序,gcc
(Archlinux/gcc 版本 4.6.1 20110819(预发布))告诉我:
$ gcc test.c -ldl -static
/tmp/ccsWe4RN.o: In function `main': test.c:(.text+0x13):
warning: Using 'dlopen' in statically linked applications requires
at runtime the shared libraries from the glibc version used for linking
事实上,当我运行这个脚本时/usr/lib/
for i in *.a;
do
echo $i;
readelf -a $i | grep __dlopen;
done
I saw:
libc.a
16: 0000000000000080 69 FUNC GLOBAL DEFAULT 1 __dlopen
000000000000 002300000001 R_X86_64_64 0000000000000000 __dlopen + 0
35: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __dlopen
所以根据第一行,libc.a
确实定义了您丢失的符号。
在我的系统中,gcc test.c -ldl -static
足以使应用程序运行,但是
gcc <file> -static -ldl -lc
应该可以解决您系统中的问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)