Basic Crosscompile Question


michu

Still Fresh
Joined
Mar 6, 2006
Messages
60
Website
www.neophob.com
I've a question about crosscompiling..

well my toolchain is installed in /usr/local/gp2xdev, and normally the libs and header file are installed under this directory.. now what for is the /usr/local/gp2xdev/gp2x directory?

Is the /usr/local/gp2xdev/gp2x arch. dependent stuff installed under this directory? im asking because i try to build directfb for my gp2x and the configuration fails because he cannot find the libz... but libz is installed under /usr/local/gp2xdev/lib, BUT NOT under /usr/local/gp2xdev/gp2x/lib..

Can anyone help me?

cheers
michu
 
Parkydr posted on Aug 20 2006 at 11:07 PM said:
You probably just need to add -L/usr/local/gp2xdev/lib to your link path to tell the linker where to find the libraries.

Well I think i do this:

PKG_CONFIG_PATH=/usr/local/gp2xdev/lib/pkgconfig LIBJPEG='-ljpeg'
DFLAGS=-L/usr/local/gp2xdev/lib CC=gp2x-gcc CXX=gp2x-g++ ./configure
--prefix=/usr/local/gp2xdev --build=`uname -m` --host=gp2x --enable-fbdev
--enable-zlib --enable-png --enable-jpeg --with-gfxdrivers=none
--includedir=/usr/local/gp2xdev/include --libdir=/usr/local/gp2xdev/lib
--oldincludedir=/usr/local/gp2xdev/include --disable-vnc
 
Last edited by a moderator:
gfoot posted on Aug 21 2006 at 08:41 AM said:
That should probably be "LDFLAGS" at not "DFLAGS".

Argh, thanks gfoot. Sure, I also added the cflag option:
mideb:/gp2x/_BOB/DirectFB-0.9.25.1# PKG_CONFIG_PATH=/usr/local/gp2xdev/lib/pkgconfig CFLAGS=-I/usr/local/gp2xdev/include LDFLAGS=-L/usr/local/gp2xdev/lib CC=gp2x-gcc CXX=gp2x-g++ ./configure --prefix=/usr/local/gp2xdev --build=`uname -m` --host=gp2x --enable-fbdev --enable-zlib --enable-png --enable-jpeg --with-gfxdrivers=none --libdir=/usr/local/gp2xdev/lib --oldincludedir=/usr/local/gp2xdev/include --disable-vnc

Well I get another strange message now:
configure:22537: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!
configure:22539: WARNING: zlib.h: proceeding with the compiler's result
configure:22566: checking for zlib.h
configure:22573: result: yes
configure:22842: checking for png_read_info in -lpng

Of course the make command failed:
/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/bin/ld: warning: libz.so.1, needed by ../src/.libs/libdirectfb.so, not found (try using -rpath or -rpath-link)
../src/.libs/libdirectfb.so: undefined reference to `gzdopen'
../src/.libs/libdirectfb.so: undefined reference to `gzclose'
../src/.libs/libdirectfb.so: undefined reference to `gzwrite'
collect2: ld returned 1 exit status
make[2]: *** [dfbdump] Error 1

Thanks in advance, cheers
michu
 
Last edited by a moderator:
That's a dynamic link, you know that? I'm not sure what the build system is doing there, but perhaps it's failing because you only have a static zlib available.
 
gfoot posted on Aug 21 2006 at 02:39 PM said:
That's a dynamic link, you know that? I'm not sure what the build system is doing there, but perhaps it's failing because you only have a static zlib available.
yes I saw it, but that was not the error.. i just ripped the compiler options from the opoo toolchain, this seems to work pretty good. just for your information:

export CC='gp2x-gcc -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib'

export CXX='gp2x-g++ -O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2 -L/usr/local/gp2xdev/lib'

export CFLAGS='-O3 -ffast-math -fomit-frame-pointer -mcpu=arm920t -I/usr/local/gp2xdev/include -I/usr/local/gp2xdev/include/libxml2'

export LDFLAGS='-L/usr/local/gp2xdev/lib'

export LD_LIBRARY_PATH=/usr/local/gp2xdev/lib

export PKG_CONFIG_PATH='/usr/local/gp2xdev/lib/pkgconfig'

then the config just works... BUT the make failed again:
/usr/local/gp2xdev/lib/gcc/gp2x/4.0.2/../../../../gp2x/bin/ld: warning: libz.so.1, needed by ../src/.libs/libdirectfb.so, not found (try using -rpath or -rpath-link)
../src/.libs/libdirectfb.so: undefined reference to `gzdopen'
../src/.libs/libdirectfb.so: undefined reference to `gzclose'
../src/.libs/libdirectfb.so: undefined reference to `gzwrite'
collect2: ld returned 1 exit status
make[2]: *** [dfbdump] Error 1

argh - this looks like my first error...
 
Last edited by a moderator:
michu posted on Aug 22 2006 at 06:39 AM said:
ok i solved the problem. i documented all steps here:

basic crosscompile stuff


Thanks for the notes on cross compiling they have helped me alot. I'm trying to cross compile capture-1.0.3-cvs-20060706 which deps on libptp2-1.1.0 which deps on libusb-0.1.12.

So far I have managed to compile libusb OK and make a few veggie test programs that can scan usb buses for certain devices. I trying to control canon digital cameras for timelapse photography.

When I run configure the first error I got was that libusb-config couldn't be found so I modified the makefiles to point to the cross compiled version rather than the local version. Now I get this error after alot of warnings (I get the same warnings doing the native compile and it works)

andy@liny:~/cross/libptp2-1.1.0> make
make all-recursive
make[1]: Entering directory `/home/andy/cross/libptp2-1.1.0'
Making all in src
make[2]: Entering directory `/home/andy/cross/libptp2-1.1.0/src'
if /bin/sh ../libtool --tag=CC --mode=compile gp2x-gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -Wall -Wmissing-declarations -Wmissing-prototypes -MT ptp.lo -MD -MP -MF ".deps/ptp.Tpo" -c -o ptp.lo ptp.c; \
then mv -f ".deps/ptp.Tpo" ".deps/ptp.Plo"; else rm -f ".deps/ptp.Tpo"; exit 1; fi
mkdir .libs
gp2x-gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -Wall -Wmissing-declarations -Wmissing-prototypes -MT ptp.lo -MD -MP -MF .deps/ptp.Tpo -c ptp.c -fPIC -DPIC -o .libs/ptp.o
In file included from ptp.c:89:
ptp-pack.c: In function 'ptp_unpack_string':
ptp-pack.c:79: warning: pointer targets in passing argument 2 of 'dtoh16ap' differ in signedness
ptp-pack.c: In function 'ptp_pack_string':
<snip>
ptp-pack.c: In function 'ptp_unpack_Canon_FE':
ptp-pack.c:720: warning: pointer targets in passing argument 2 of 'dtoh32ap' differ in signedness
ptp-pack.c:721: warning: pointer targets in passing argument 2 of 'dtoh16ap' differ in signedness
ptp-pack.c:723: warning: pointer targets in passing argument 2 of 'dtoh32ap' differ in signedness
ptp-pack.c:724: warning: pointer targets in passing argument 2 of 'dtoh32ap' differ in signedness
ptp.c: In function 'ptp_transaction':
ptp.c:313: warning: pointer targets in passing argument 3 of 'params->senddata_func' differ in signedness
make[2]: *** [ptp.lo] Error 1
make[2]: Leaving directory `/home/andy/cross/libptp2-1.1.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/andy/cross/libptp2-1.1.0
make: *** [all] Error 2


As this error looks similar to some that you had I was wondering if you have any suggestions
 
Last edited by a moderator:
Back
Top