3

我正在尝试为 ARM uClibc 环境构建一个项目,但我缺少一些功能。找不到我应该包含哪个库来解决依赖关系。nm不要帮我搜索,因为它在工具链附带的大多数库上都说:

nm: ./host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/lib/libuClibc-0.9.32.1.so: no symbols

这是 GCC 的输出:

./host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc
 -Wl,-rpath,./host/usr/lib/
 -Wl,-rpath,./host/usr/../lib/
 -Wl,-rpath,./host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/lib/
 -Llibzway -o test_so main.o -lzway
 -L./host/usr/lib/
 -L./host/usr/../lib/
 -L./host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/lib/  -lpthread
 -lxml2 -lz -lm
./host/usr/lib/libxml2.so: warning: gethostbyname is obsolescent, use getnameinfo() instead.
./host/usr/lib/libxml2.so: undefined reference to `fcntl64'
./host/usr/lib/libxml2.so: undefined reference to `fopen64'
./host/usr/../lib/libz.so: undefined reference to `lseek64'
./host/usr/lib/libxml2.so: undefined reference to `stat64'
./host/usr/lib/libiconv.so.2: undefined reference to `mbrtowc'
./host/usr/lib/libiconv.so.2: undefined reference to `_stdlib_mb_cur_max'
./host/usr/lib/libiconv.so.2: undefined reference to `wcrtomb'
./host/usr/lib/libxml2.so: undefined reference to `open64'
collect2: ld returned 1 exit status
make: *** [test_so] Error 1

UPD:我已经从目标主机复制了 uClibc 并明确定义要求与它链接:

./host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc
 -Wl,-rpath,./host/usr/lib/
 -Wl,-rpath,./host/usr/../lib/
 -Wl,-rpath,./host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/lib/
 -Llibzway -o test_so main.o -lzway
 -L./host/usr/lib/
 -L./host/usr/../lib/
 -L./host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/lib/
 -luClibc-0.9.31
 -lpthread -lxml2 -lz -lm
./host/usr/bin/../lib/gcc/arm-unknown-linux-uclibcgnueabi/4.5.3/../../../../arm-unknown-linux-uclibcgnueabi/bin/ld:
  errno: TLS reference in ./host/usr/bin/../arm-unknown-linux-uclibcgnueabi/sysroot/lib/libpthread.so.0 mismatches non-TLS definition in ./host/usr/lib/libuClibc-0.9.31.so section .bss
./host/usr/bin/../arm-unknown-linux-uclibcgnueabi/sysroot/lib/libpthread.so.0: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [test_so] Error 1

这大大超出了我对交叉编译的了解。任何的想法?

4

1 回答 1

1

听起来你有几个问题:

  1. 您似乎正在尝试使用主机的libxml2.so. 这是行不通的。您需要为您的目标系统及其 libc 构建一个。

  2. 您的 uClibc 是在没有大文件支持的情况下编译的。返回并修复构建选项或 uClibc。这不是绝对必要的(正确构建的libxml2.so与 uClibc 的链接将在不这样做的情况下工作),但是使用预大文件接口确实是倒退的,并且会不必要地限制您的程序。

于 2012-06-06T16:48:17.907 回答