4

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?

PoltoS
  • 1,232
  • 1
  • 12
  • 32
  • AFAIK those are part of `libc` (built for 64 bit arch). You could make use of `ldd` if available to see the libraries needed by `libxml2` & `libiconv` & link them appropriately. You could try to link `libuClibc` explicit while building & see if it solves anything – another.anon.coward Jun 06 '12 at 17:20
  • tried in vain. @R.. gave me the idea the these libs (in toolchain and on target host) might be compiled with different options. Will copy from target machine and try again – PoltoS Jun 06 '12 at 17:27

1 Answers1

1

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.

R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
  • 1. No, `libxml2` comes from the target machine (I've copied it). And the error would be somehing like "Wrong format ELF64"... So, it is the correct one. 2. So, these functions are indeed in libuClibc? I've noticed that my copy (from toolchain) and the one on target machine are different - will try to copy the one from target machine. – PoltoS Jun 06 '12 at 17:26
  • Ok, got it. Your remark No 2 is the correct one: I've to recompile libxml with my current uClibc. – PoltoS Jun 06 '12 at 18:06