Question

I'm trying to build a project for ARM uClibc environment, but I've some functions missing. Can not find which library shall I include to resolve dependancies. nm do not help me to search, since it says on most of libs coming with toolchain:

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

Here is the output from 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: I've copied uClibc from the target host and explicitely defined asked to link with it:

./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

This is much bayond my knowledge of cross-compilation. Any idea?

Was it helpful?

Solution

It sounds like you have several issues going on:

  1. You seem to be trying to use the host's copy of libxml2.so. This is not going to work. You need one built for your target system and its libc.

  2. Your uClibc was compiled without large file support. Go back and fix the build options or uClibc. It's not strictly necessary (a correctly built libxml2.so linked against uClibc will work without doing this), but using the pre-large-file interfaces is really backwards and will unnecessarily limit your programs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top