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.The way to set up this is described here: http://people.debian.org/~debacle/cross/
Make sure to install GTK2 and SQLite packages to your toolchain.
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.
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"
As I use zsh for everyday, I just have to switch to "bash" to be in cross env.. of course you can put these confs into file and do a "source file" each time..
NB1: this is a tip to easily compile gpe apps, but if you release ipk, please remove all unused libs. The correct behavior would have been to do correct pkgconfig configuration.
NB2: There is still a problem with libXinerama. The libgtk2 I found in unstable seems to need libXinerama routines. I had to make a fake libXinerama. If you have problems with that, here is the tar:
http://www.handhelds.org/~tardyp/libXinerama.tgz
NB3: The headers are of course not installed. You need to have installed all the devel package of your host distro.
Pierre Tardy (2003-07-28)
Nils Faerber writes (2003-07-16):
http://www.handhelds.org/~nils/gtk2-2.2.0-skiff-arm-complete.tar.gz
More recent version is
skiff-arm-cross-gtk-2.2-idoru-030716.tar.bz2
(NF)
is the toolchain we use here to crosscompile GTK2 apps for GPE. It mostly works but is a whole tar-ball, i.e. it contains compiler and libs. To use it simply unpack to / and set PKG_CONFIG_PATH accordingly (to /skiff/local/arm-linux/lib ). You should be able to compile most of GPE with it. There is a minor problem in one of the pkg-config files for AFAIK pango which we have fixed locally and I'll update the tarball shortly.
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.so
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 archs
GTKCFLAGS = gtk-config --cflags gdk-pixbuf-config --cflags
GTKLDFLAGS = gtk-config --libs
LDFLAGS = $(GTKLDFLAGS) -lgpewidget -g -lsqlite -L/usr/local/lib
CC = /usr/bin/cc
STRIP = /usr/bin/strip
while Makefile.arm is :
# build file for arm archs
GTKCFLAGS = gtk-config --cflags gdk-pixbuf-config --cflags
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-strip
CC = /opt/arm/bin/arm-linux-gcc
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.