GP2X Java Via Gcj


zzhu8192

Still Fresh
Joined
May 10, 2006
Messages
50
Location
Austin, TX
Website
www.unicorn-jockey.com
I managed to build a cross-compiling version of gcc 4.1.0 with gcj working for the gp2x with Linux as host. I used native calls to implement drawing to screen, and managed to get a sample program to work on my gp2x. I'll post the instructions here or on the wiki if there is interest, especially from Java developers.

After the binary is stripped, a hello world type app is about 5.6 megs.
This is statically linked. For some reason, dynamically linked apps don't work, even when I put all the libs on the sd card and used LD_LIBRARY_PATH.

I haven't tried to write anything performance intensive, but GCJ seems to do a pretty good job. Allocations and gc speed is not great, but seems to work.


One odd thing I've run into, is that the x86 target version of gcc 4.1.0/gcj for linux produces code (even hello world) that seg faults instantly when statically linked. (dyna link works fine) The irony here is the cross-compiler with target ARM920 works fine with -static when compiled on Linux. Anyone else run into this issue? I'm running on Slackware 10.2.
 
zzhu8192 posted on May 10 2006 at 01:14 AM said:
I managed to build a cross-compiling version of gcc 4.1.0 with gcj working for the gp2x with Linux as host. I used native calls to implement drawing to screen, and managed to get a sample program to work on my gp2x. I'll post the instructions here or on the wiki if there is interest, especially from Java developers.

....
I have been making SLOWWW progress at building a native 4.1.0 compiler for gp2x.
The complexity of the toolchain puts me at the limit of my abilities since I come
from much simpler worlds (Pascal/Modula-2/Oberon under MS-DOS and/or PHP/SQL
already installed on some server).

My objective is to replace the webserver and install related tools. Trouble is that
some installations assume they are on native setups and not cross-compiles so
the configure process is busy checking capabilities on the wrong machine when
one tries to cross-compile. Or intermediate tools are compiled for the target
when they are used on the host (e.g. sqlite from source).

I am very interested to read your HOW-TO. Perhaps putting it here rather than on
the wiki until the steps settle down to their simplest would be better since reader
feedback is more immediate.

I'm not much interested in java since it adds yet another layer of complexity and
code bloat while slowing down program operation, but the steps you take before
installing java are definitely of interest.
 
Last edited by a moderator:
If you're just wanting to build cross tools, then get the build script and patches that comes with
the "devkitGP2X buildscript for any flavour of linux" tar ball.

I see what you're saying about configure. They usually assume you're building on the target machine.

I'm thinking gcc 4.1.0 runing on gp2x would be pretty slow... It might be a bit excrutiating. It takes half an hour on a Dual Core machine to build a full gcc 4.1.0. So it'll probably take about 20 hours to build on the gp2x natively. :huh:

My process won't really help you though, as it is all about how to get a cross-compiler gcj and libgcj building in addition to gcc/g++, and how to integrate SDL/fb access in Java.
 
Back
Top