作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用共享库 (libscplugin.so
) 中包含的方法。
我已经满足了库的所有要求:
libc.so
带有指向 libc.so.6
libz.so
带有指向 libz.so.1.2.8
libstdc++.so
带有指向 libstdc++.so.6.0.20
编译后我收到以下错误消息:
$ gcc test.c -o test -L/usr/lib/arm-linux-gnueabihf/ -lscplugin
/usr/bin/ld: test: hidden symbol `stat' in /usr/lib/arm-linux-gnueabihf/libc_nonshared.a(stat.oS) is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
我能找到的对libc_nonshared.a
的唯一引用是在/usr/lib/arm-linux-gnueabihf/libc.so
中:
$ cat libc.so
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/arm-linux-gnueabihf/libc.so.6 /usr/lib/arm-linux-gnueabihf/libc_nonshared.a AS_NEEDED ( /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 ) )
在 test.c
中,我尝试使用共享库的两个函数(与 stat
完全无关)。我该怎么做才能编译它?
最佳答案
您的问题在这里:
I have satisfied all of the libraries requirements:
libc.so
with a symlink tolibc.so.6
这不是 glibc 的有效设置。正如您在答案末尾看到的那样,libc.so
应该是一个文本文件(链接器脚本)。如果您自己创建指向共享库的符号链接(symbolic link),那么您正在做一些奇怪且不必要的事情。使用提供的 libc.so
(您需要在构建其他共享库时执行此操作 - 您现在的问题是它们链接错误),一切都会正常工作。
关于c - libc_nonshared.a(stat.oS) 中的隐藏符号 `stat' 被 DSO 引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32143114/
为什么libc_nonshared.a存在?它的用途是什么?我一直无法在网上找到它存在的好答案。 据我所知,它提供了某些符号( stat 、 lstat 、 fstat 、 atexit 等)。如果有
我正在尝试使用共享库 (libscplugin.so) 中包含的方法。 我已经满足了库的所有要求: libc.so 带有指向 libc.so.6 的符号链接(symbolic link) libz.s
我是一名优秀的程序员,十分优秀!