【发布时间】:2020-11-11 17:38:47
【问题描述】:
我在我的项目中使用 libmicrohttpd 0.9.53 并决定将其更新到最新版本 (0.9.71)。我正在为 ARM 进行交叉编译,这是 arm-linux-gcc --version 的输出:
arm-linux-gcc (4.4.4_09.06.2010) 4.4.4
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
和/lib/arm-linux-gnueabi/libc.so.6的输出:
GNU C Library (Debian GLIBC 2.19-18+deb8u3) stable release version 2.19, by Roland McGrath et al.
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.8.4.
Compiled on a Linux 3.16.7 system on 2016-02-12.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
libc ABIs: UNIQUE
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.
编译成功,但是在链接共享库时出现以下错误:
arm-linux-gcc -Llib/libmicrohttpd/lib -Wl,-rpath,./lib -o "proj" build/src/proj.o -lpthread -lm -lmicrohttpd
lib/libmicrohttpd/lib/libmicrohttpd.so: undefined reference to `pthread_setname_np@GLIBC_2.12'
lib/libmicrohttpd/lib/libmicrohttpd.so: undefined reference to `clock_gettime@GLIBC_2.17'
collect2: ld returned 1 exit status
make: *** [makefile:191: proj] Error 1
在目标机器上,我跑了/lib/arm-linux-gnueabi/libc.so.6 | grep clock_gettime:
782: 000e48e4 116 FUNC GLOBAL DEFAULT 12 __clock_gettime@@GLIBC_PRIVATE
1625: 000e48e4 116 FUNC WEAK DEFAULT 12 clock_gettime@@GLIBC_2.17
而readelf -Ws /lib/arm-linux-gnueabi/libc.so.6 | grep pthread_setname 没有给出任何结果。
显然,错误中提到的两个符号已添加在旧版本和新版本之间,并且我当前的 libc 版本似乎没有定义它们。 我在这里完全偏离轨道了吗?我必须以某种方式更新libc吗?您能否提出任何可以为我指明正确方向的建议?
【问题讨论】:
-
完全推测:这可能是您的标志顺序的问题。试试:
-lm -lmicrohttpd -lpthread.
标签: linker arm shared-libraries glibc ldd