【发布时间】:2015-08-21 14:37:24
【问题描述】:
我正在尝试使用共享库 (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 完全无关)。我该怎么做才能编译?
【问题讨论】:
标签: c gcc ld gcc-warning