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

Wolfgang Denk wd at denx.de
Wed Feb 11 12:43:43 CET 2009

Dear Gary Yang,

In message <2899.35016.qm at web37902.mail.mud.yahoo.com> you wrote:
> 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

Thsi is not correct. Please read the documenation. You must set
CROSS_COMPILE correctly (in your case obvioulsy as "export
CROSS_COMPILE=ppc_4xx-"), and then you should use
"${CROSS_COMPILE}gcc", i. e. "ppc_4xx-gcc".

powerpc-linux-gcc will also work if CROSS_COMPILE is set correctly,
but if this is missing or inconsistently used there may be funny
failure modes that are not easy to recognize. Therefor we always
recommend to use the offical way, i. e. "${CROSS_COMPILE}gcc".

> libltdl.so. It tries to link /usr/lib/libltdl.so even though I
> specified, -L/tools/eldk/4.2/ppc_4xx/usr/lib

But then you gave an absolute file name for the library,

> 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

This cannot work. Try instead:

	-L/tools/eldk/4.2/ppc_4xx/usr/lib -lltdl

Best regards,

Wolfgang Denk

DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Work 8 hours, sleep 8 hours; but not the same 8 hours.

More information about the eldk mailing list