-
cross compiling, undefined reference
i'm trying to cross compile on an x86 for arm and get upnp to work an arm board, the libraries compiled fine and gave no errors, however, the compiling the sample code gave the following errors
Code:
# make
make all-recursive
make[1]: Entering directory `/home/ARM/libupnp-1.6.6'
Making all in ixml
....
Making all in sample
make[3]: Entering directory `/home/ARM/libupnp-1.6.6/upnp/sample'
/bin/bash ../../libtool --tag=CC --mode=link arm-linux-uclibc-gcc -pthread -g -O2 -Os -Wall -o upnp_tv_ctrlpt common/upnp_tv_ctrlpt-sample_util.o tvctrlpt/upnp_tv_ctrlpt-upnp_tv_ctrlpt.o tvctrlpt/linux/upnp_tv_ctrlpt-upnp_tv_ctrlpt_main.o ../../upnp/libupnp.la ../../threadutil/libthreadutil.la ../../ixml/libixml.la
arm-linux-uclibc-gcc -pthread -g -O2 -Os -Wall -o .libs/upnp_tv_ctrlpt common/upnp_tv_ctrlpt-sample_util.o tvctrlpt/upnp_tv_ctrlpt-upnp_tv_ctrlpt.o tvctrlpt/linux/upnp_tv_ctrlpt-upnp_tv_ctrlpt_main.o ../../upnp/.libs/libupnp.so /home/ARM/libupnp-1.6.6/threadutil/.libs/libthreadutil.so /home/ARM/libupnp-1.6.6/ixml/.libs/libixml.so ../../threadutil/.libs/libthreadutil.so ../../ixml/.libs/libixml.so -Wl,--rpath -Wl,/home/ARM/toolchain_arm/arm-linux-uclibc//lib
/home/ARM/toolchain_arm/bin/../lib/gcc-lib/arm-linux-uclibc/3.3.2/../../../../arm-linux-uclibc/bin/ld: warning: libgcc_s.so.1, needed by ../../upnp/.libs/libupnp.so, not found (try using -rpath or -rpath-link)
../../upnp/.libs/libupnp.so: undefined reference to `__modsi3@GCC_3.0'
../../upnp/.libs/libupnp.so: undefined reference to `__udivsi3@GCC_3.0'
../../upnp/.libs/libupnp.so: undefined reference to `__divsi3@GCC_3.0'
../../upnp/.libs/libupnp.so: undefined reference to `__umodsi3@GCC_3.0'
collect2: ld returned 1 exit status
make[3]: *** [upnp_tv_ctrlpt] Error 1
make[3]: Leaving directory `/home/ARM/libupnp-1.6.6/upnp/sample'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/ARM/libupnp-1.6.6/upnp'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ARM/libupnp-1.6.6'
make: *** [all] Error 2
seems that the linker is not able to find libgc_s.so.1, but the file is in "/home/ARM/toolchain_arm/arm-linux-uclibc/lib/"
if i were to run "LD_LIBRARY_PATH=/home/ARM/toolchain_arm/arm-linux-uclibc/lib/ make", i would get "make: error while loading shared libraries: /home/ARM/toolchain_arm/arm-linux-uclibc/lib/libpthread.so.0: ELF file OS ABI invalid" instead
what am i missing out here?
my uclibc toolchain lies in '/home/ARM/toolchain_arm/' and the Makefile for libupnp was generated by ./configure --host=arm-linux-uclibc --prefix=/home/ARM/toolchain_arm/arm-linux-uclibc"
Registered Linux User #388117
-
Originally Posted by WhiteKnight
Code:
arm-linux-uclibc-gcc <...> -Wl,--rpath -Wl,/home/ARM/toolchain_arm/arm-linux-uclibc//lib
The error message says to use -rpath, not --rpath (though I don't know if it really matters). Did you add that -Wl,--rpath option yourself, or did some other part of libtool do it for you? If you added it yourself, get rid of one of the - characters before rpath and see if it makes any difference.
if i were to run "LD_LIBRARY_PATH=/home/ARM/toolchain_arm/arm-linux-uclibc/lib/ make", i would get "make: error while loading shared libraries: /home/ARM/toolchain_arm/arm-linux-uclibc/lib/libpthread.so.0: ELF file OS ABI invalid" instead
That's because LD_LIBRARY_PATH affects the runtime linker (/lib/ld-linux.so.2 on 32-bit, or /lib64/ld-linux-x86-64.so.2 on 64-bit), not the compile-time linker (.../whatever/path/ld, on any CPU).
To modify the set of directories that ld uses to look for libraries, you add -L options to the gcc command line (or, apparently, use -rpath?). To modify the set of directories searched at runtime, you use LD_LIBRARY_PATH.
Because you tried setting LD_LIBRARY_PATH here, you made "make" itself (which was built for x86) try to find its libs in the cross-compiled directory, and those libs don't work right because they were built for ARM.
-
ic.. got it fixed..
edited the makefile
LIBS=-L/home/ARM/toolchain_arm/arm-linux-uclibc/lib/ -lgcc_s
strange though... the makefile was generated by the configure script and --rpath was there instead of -rpath...
Registered Linux User #388117
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|