Here I post some basic stuff about recom­pile soft­ware for your gp2x (arm based). I’m using oopo’s tool­chain, but this should work for other cross­com­pil­ers aswell. The tool­chain is installed in /usr/local/gp2xdev.

Before you start to con­fig­ure the appli­ca­tion we should edit config.sub add the fol­low­ing 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 cross­com­piler bina­ries in our path variable:

1
2
export GP2XDEV=”/usr/local/gp2xdev“
export PATH=”$PATH:$GP2XDEV/bin”

And now export the impor­tant envi­ron­ment 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 exam­ples:
I was try­ing to com­pile glib 2.6.x for the gp2x plat­form, 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>
check­ing for grow­ing stack pointer… con­fig­ure: error: can­not run test pro­gram while cross com­pil­ing
See ‘config.log’ for more details.

ARGH.. after read­ing some docs I cre­ated 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 com­pile. 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 con­fig­u­ra­tion was fine but when I started make another error appeared:

1
2
giounix.c: In func­tion ‘g_io_unix_read’:
giounix.c:185: error: ‘SSIZE_MAX’ unde­clared (first use in this function)

In a news­group post I found this answer:

If you want to just get things com­piled, you can obvi­ously add:

1
2
3
#ifn­def SSIZE_MAX
#define SSIZE_MAX 0x7fffffff
#endif

some­where in that file. (that’s the cor­rect value for 32-bit machines like the ARM)