Here I post some basic stuff about recompile software for your gp2x (arm based). I’m using oopo’s toolchain, but this should work for other crosscompilers aswell. The toolchain is installed in /usr/local/gp2xdev.
Before you start to configure the application we should edit config.sub add the following lines after go32:
1 2 3 4 | gp2x) basic_machine=arm-gp2x os=-linux-gnu ;; |
Now our gp2x should be well known…
Next step, we need to put the crosscompiler binaries in our path variable:
1 2 | export GP2XDEV=”/usr/local/gp2xdev“ export PATH=”$PATH:$GP2XDEV/bin” |
And now export the important environment variables:
1 2 3 4 5 6 7 8 9 | 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 –rpath,/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’ |
A default ./configure call could look like this:
1 | #./configure –prefix=/usr/local/gp2xdev/ –build=‘uname –m‘ –host=gp2x –enable-static –enable-shared |
Here some examples:
I was trying to compile glib 2.6.x for the gp2x platform, but when i started the ./configure the process failed:
1 2 3 4 | #./configure –prefix=/usr/local/gp2xdev/ –build=‘uname –m‘ –host=gp2x –enable-static –enable-shared <snip> checking for growing stack pointer… configure: error: cannot run test program while cross compiling See ‘config.log’ for more details. |
ARGH.. after reading some docs I created a cache file called config.cache with this content:
1 2 3 | ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes} glib_cv_stack_grows=${glib_cv_stack_grows=no} glib_cv_uscore=${glib_cv_uscore=no} |
those checks need to be defined when you want to cross compile. So retry:
1 | #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-static –enable-shared –cache-file=config.cache |
This time the configuration was fine but when I started make another error appeared:
1 2 | giounix.c: In function ‘g_io_unix_read’: giounix.c:185: error: ‘SSIZE_MAX’ undeclared (first use in this function) |
In a newsgroup post I found this answer:
If you want to just get things compiled, you can obviously add:
1 2 3 | #ifndef SSIZE_MAX #define SSIZE_MAX 0x7fffffff #endif |
somewhere in that file. (that’s the correct value for 32-bit machines like the ARM)

2 Comments
1 peter wrote:
Hi michu nd hheenz:
Thank you for this article. Now I am building directFB with zlib support, I put libz.so in ~/directFB/custom_libs/ and add LD_FLAGS=”-Lcustom_libs”, but I still got a error msg that:
“warning: libz.so, needed by ../src/.libs/libdirectfb.so, not found”, can you give me some advice, thanks very very much.
2 Aaron wrote:
Thank you very much for posting this! I’ve never played with config.cache before, and what you posted helped me get a bugger-ish program cross-compiled. Awesome info.
@@ron