Crosscompiling GPE
There are multiple ways to set up a crossdevelopment environment for GPE.
Debian Toolchain
For people using Debian there is quite easy method to set up a toolchain using the Debian toolchain packages. See the emdebian-tools package.
Emdebian now includes cross-built versions of most of the GPE packages and dependencies.
OpenEmbedded based GPE SDK
We now have the abitity to create complete toolchains with OpenEmbedded.
The main advantage is that these toolchains are easy to keep up to date and (hopefully) contains all libraries that are used by GPE applications.
Prebuilt toolchains are located here: http://linuxtogo.org/~florian/sdk/
Latest one is this: http://linuxtogo.org/~florian/sdk/oe-sdk-20060304232054.tar.bz2
Almost everything you need should be included in the archive, just unpack it to /.
To crosscompile a GPE application you need to do this:
1. export PKG_CONFIG_PATH=/usr/local/arm/oe/arm-linux/lib/pkgconfig
2. export PATH=/usr/local/arm/oe/bin:$PATH
3. Change to the location of your source
4. Run make CC=arm-linux-gcc to build your application
If you use autotools you will usually need to run ./configure --host=arm-linux
Scratchbox
Check out information about Scratchbox at http://www.scratchbox.org
The old WiKi below is mostly out of date...
The information below may be outdated. Use ftp://handhelds.org/toolchain/arm-linux-gcc-3.2.3-pre+binutils-2.13.1-030422.tgz or even better, see http://gpe.handhelds.org/documentation/uml_gtk2_xcompile.shtml
Nils's skiff begins to be a bit old. Actually every all in one tarball will be rapidly out of date. Here is my solution. It is based on my "ipkg" that works like familiar's ipkg.
ipkg update to download the list of pkg
ipkg install gtk2 to install for you the libs in your cross environment.
ipkg list foobar to find an ipkg containing foobar in its name
The idea is to install the libs of familiar, and link against it. Nils had cross-compiled all the libs installed in his toolchain. That is not possible for some libs (like gstreamer or obexftp).
Here is the step-by-step HOWTO install a gpe-cross-toolchain:
- download and tar xzf the latest gcc+binutils tarball (see at the top of this page)
- You may change the rights of /usr/local/arm to have write access..
- download my ipkg here:http://www.handhelds.org/~tardyp/ipkg
- configure the 2 first lines and put it in your $PATH
- then you can install all the ipk you need. for exemple, I do:
ipkg update ipkg install libgdk-pixbuf2 ipkg install libgpewidget1 ipkg install libsqlite0 ipkg install xlibs ipkg install gdk-pixbuf-jpeg ipkg install libglib1.2-devel ipkg install libgstreamer0 ipkg install libgtk2.0-0 ipkg install libatk0 ipkg install libpango1.0-0 ipkg install libglib2.0-0 ipkg install libxml2 ipkg install libxft2 ipkg install gstreamer ipkg install zlib1g ipkg install libfreetype6 ipkg install libfontconfig ipkg install libexpat1 ipkg install libpopt ipkg install libxrender ipkg install libc6 cp /usr/include/popt.h /usr/local/arm/3.2.3/arm-linux/include/
to compile, I use a special .bashrc:
export CROSS=/usr/local/arm/3.2.3/ export PATH=$CROSS/arm-linux/bin:$PATH export CC=gcc export CFLAGS= export LDFLAGS="-L$CROSS/arm-linux/lib -L$CROSS/arm-linux/X11R6/lib -rdynamic -lgmodule -ldl -lXi -lXext -lX11 -lm -lXft -lfreetype -lexpat -lpopt -lfontconfig -lXrender -lXinerama -lpthread"
If you run Debian it's very simple
follow what is described here: http://people.debian.org/~debacle/cross/
you may have to downgrade your flex to 'stable' (23 Jun 2003)
Here you can find some already converted, ready for installation cross packages: http://handhelds.org/~luis/cross/
Daniele Nicolodi daniele@grinta.net - 24 Feb 2003
If you don't run debian...
- This assumes a well configured i386 linux box. My devel box runs debian/sid and uses gnome2 as the desktop environment. Please correct if I make any bad assumptions in terms of distribution compatibility. This is what I used for building my gpe-memo application.
I am using the precompiled toolchain found at: ftp://ftp.handhelds.org/pub/linux/arm/toolchain/monmotha/arm-chain.tar.gz
This toolchain assumes an xscale processor, but so far everything I've compiled works on my 3600 ipaq without issue and without having to add any command line flags.
I've installed this toolchain into /opt/arm (so that I have, for example, /opt/arm/bin/arm-linux-gcc). Everything from here assumes this directory structure. It probably should be relocatable but doesn't seem to be. The C compiler insists on look for libc in /opt/arm/...
I manually installed the libraries :
* libgdk-pixbuf2_0.17.0-3_arm.ipk
* libgdkxft_0.0.1_arm.ipk
* libglib1.2-devel_1.2.10_arm.ipk
* libgpewidget0_0.23_arm.ipk
* libgtk1.2_1.2.10-2-fam1_arm.ipk
* sqlite_2.4.10_arm.ipk
* xlibs_4.2-2_arm.ipk
* gdk-pixbuf-jpeg_0.17.0-fam3_arm.ipk
To get these libraries, run the following commands on the iPAQ:
ipkg download libgtk1.2 libgdk-pixbuf2 libgdkxft libglib1.2-devel <BR> ipkg download libgpewidget0 sqlite xlibs gdk-pixbuf-jpeg
and then copy them to your cross-compiling machine.
I manually unpacked them, either via tar zxvf (for old style ipkgs) or ar x (for new style. Once I had a data.tar.gz, I unpacked it into /opt/arm.
You may also need to set up some symbolic links in the lib directory. For instance, I needed to do this:
ln -s libgtk-1.2.so.0 libgtk-1.2.soBR ln -s libgdk-1.2.so.0 libgdk-1.2.so
Once this is setup, I wrote the Makefile structure as follows:
o Makefile - top level determines the architecture and dispatches appropriately
o Makefile.common - included in every Makefile, contains the major build commands
o Makefile.x86 - included if the arch is x86, points to the appropriate library path, CC and STRIP
o Makefile.arm - included if the arch is arm, similar to Makefile.x86
So, for example, Makefile.x86 is:
# build file for x86 archsBR GTKCFLAGS = gtk-config --cflags gdk-pixbuf-config --cflagsBR GTKLDFLAGS = gtk-config --libsBR
LDFLAGS = $(GTKLDFLAGS) -lgpewidget -g -lsqlite -L/usr/local/lib
CC = /usr/bin/ccBR STRIP = /usr/bin/stripBR
while Makefile.arm is :
# build file for arm archsBR GTKCFLAGS = gtk-config --cflags gdk-pixbuf-config --cflagsBR GTKLDFLAGS = -L/opt/arm/usr/lib -L/opt/arm/usr/X11R6/lib -lgtk-1.2 -lgdk-1.2 -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm -lgdk_pixbuf
LDFLAGS = $(GTKLDFLAGS) -lgpewidget -g -lsqlite -L/opt/arm/usr/local/lib
STRIP = /opt/arm/bin/arm-linux-stripBR CC = /opt/arm/bin/arm-linux-gccBR
With this setup, a standard C compiling Makefile (put into Makefile.common) should do the right thing with respect to compiling, provided that the proper 'Makefile.[arch]' is included. The makefile setup I used can be found in the gpe-memo application.