[ELDK] Cannot link correct libltdl.so for cross compile using the compiler, eldk/4.2/usr/bin/powerpc-linux-gcc. Please help.

Gary Yang garyyang6 at yahoo.com
Wed Feb 11 01:57:05 CET 2009


Hi
I am cross compiling a library on a Linux system that is intended to run on a PowerPC Linux machine. I use the compiler, “eldk/4.2/usr/bin/powerpc-linux-gcc”. I got an error when it links libltdl.so. It tries to link /usr/lib/libltdl.so even though I specified, -L/tools/eldk/4.2/ppc_4xx/usr/lib

Error:
powerpc-linux-gcc -shared  .libs/libgphoto2_port_la-gphoto2-port-info-list.o .libs/libgphoto2_port_la-gphoto2-port-log.o .libs/libgphoto2_port_la-gphoto2-port-version.o .libs/libgphoto2_port_la-gphoto2-port.o .libs/libgphoto2_port_la-gphoto2-port-portability.o .libs/libgphoto2_port_la-gphoto2-port-result.o  -L/tools/eldk/4.2/ppc_4xx/usr/lib /usr/lib/libltdl.so  -Wl,-soname -Wl,libgphoto2_port.so.0 -Wl,-version-script -Wl,.libs/libgphoto2_port.ver -o .libs/libgphoto2_port.so.0.8.0
/usr/lib/libltdl.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status

Below is how I did:
At the PowerPC Linux machine (my target machine)
config.guess
powerpc-unknown-linux-gnu

At the Linux machine that I compile the library,
auto-aux/config.guess
i686-intel-linux-gnu

setenv CROSS_COMPILE ppc_4xx-
setenv ARCH powerpc
setenv BUILD_CC gcc 
setenv CPPFLAGS "-I/tools/eldk/4.2/ppc_4xx/usr/include"
setenv LDFLAGS "-L/tools/eldk/4.2/ppc_4xx/usr/lib"
setenv CC powerpc-linux-gcc 
setenv AR powerpc-linux-ar 
setenv RANLIB powerpc-linux-ranlib 
set path=(/tools/eldk/4.2/bin /tools/eldk/4.2/usr/bin $path)

which powerpc-linux-gcc
/tools/eldk/4.2/usr/bin/powerpc-linux-gcc

./configure --prefix=/tmp/install_libs --build=i686-intel-linux-gnu --host=powerpc-linux --target=powerpc-linux --with-ltdl-include=/tools/eldk/4.2/ppc_4xx/usr --with-ltdl=/tools/eldk/4.2/ppc_4xx/usr

ls /tools/eldk/4.2/ppc_4xx/usr/include/ltdl.h
/tools/eldk/4.2/ppc_4xx/usr/include/ltdl.h

ls /tools/eldk/4.2/ppc_4xx/usr/lib/libltdl*
/tools/eldk/4.2/ppc_4xx/usr/lib/libltdl.a    /tools/eldk/4.2/ppc_4xx/usr/lib/libltdl.so.3@
/tools/eldk/4.2/ppc_4xx/usr/lib/libltdl.la*  /tools/eldk/4.2/ppc_4xx/usr/lib/libltdl.so.3.1.4*
/tools/eldk/4.2/ppc_4xx/usr/lib/libltdl.so@


make

......
/bin/sh ../libtool --tag=CC   --mode=link powerpc-linux-gcc -g -O2 -g -O2 -no-undefined -export-symbols ./libgphoto2_port.sym -version-info 8:0:8 -L/tools/eldk/4.2/ppc_4xx/usr/lib -o libgphoto2_port.la -rpath /tmp/install_libs/lib libgphoto2_port_la-gphoto2-port-info-list.lo libgphoto2_port_la-gphoto2-port-log.lo libgphoto2_port_la-gphoto2-port-version.lo libgphoto2_port_la-gphoto2-port.lo libgphoto2_port_la-gphoto2-port-portability.lo libgphoto2_port_la-gphoto2-port-result.lo -lltdl  
echo "{ global:" > .libs/libgphoto2_port.ver
 cat ./libgphoto2_port.sym | sed -e "s/\(.*\)/\1;/" >> .libs/libgphoto2_port.ver
 echo "local: *; };" >> .libs/libgphoto2_port.ver
 powerpc-linux-gcc -shared  .libs/libgphoto2_port_la-gphoto2-port-info-list.o .libs/libgphoto2_port_la-gphoto2-port-log.o .libs/libgphoto2_port_la-gphoto2-port-version.o .libs/libgphoto2_port_la-gphoto2-port.o .libs/libgphoto2_port_la-gphoto2-port-portability.o .libs/libgphoto2_port_la-gphoto2-port-result.o  -L/tools/eldk/4.2/ppc_4xx/usr/lib /usr/lib/libltdl.so  -Wl,-soname -Wl,libgphoto2_port.so.0 -Wl,-version-script -Wl,.libs/libgphoto2_port.ver -o .libs/libgphoto2_port.so.0.8.0
/usr/lib/libltdl.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[4]: *** [libgphoto2_port.la] Error 1


I got same error when I run configure as below:
./configure --prefix=/tmp/install_libs --build=i686-intel-linux-gnu --host=powerpc-linux --target=powerpc-linux --with-ltdl-include=/tools/eldk/4.2/ppc_4xx/usr --with-ltdl-lib=/tools/eldk/4.2/ppc_4xx/usr

 powerpc-linux-gcc -shared  .libs/libgphoto2_port_la-gphoto2-port-info-list.o .libs/libgphoto2_port_la-gphoto2-port-log.o .libs/libgphoto2_port_la-gphoto2-port-version.o .libs/libgphoto2_port_la-gphoto2-port.o .libs/libgphoto2_port_la-gphoto2-port-portability.o .libs/libgphoto2_port_la-gphoto2-port-result.o  -L/tools/eldk/4.2/ppc_4xx/usr/lib /usr/lib/libltdl.so  -Wl,-soname -Wl,libgphoto2_port.so.0 -Wl,-version-script -Wl,.libs/libgphoto2_port.ver -o .libs/libgphoto2_port.so.0.8.0
/usr/lib/libltdl.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[4]: *** [libgphoto2_port.la] Error 1

I also got same error when I use this configure. Any idea?
./configure --prefix=/tmp/install_libs --build=i686-intel-linux-gnu --host=powerpc-linux --target=powerpc-linux --with-ltdl-include=/tools/eldk/4.2/ppc_4xx/usr/include --with-ltdl-lib=/tools/eldk/4.2/ppc_4xx/usr/lib







      


More information about the eldk mailing list