GCJ again

Started by teddybear, November 18, 2005, 21:28:39

Previous topic - Next topic

teddybear

Hello!

All those time I was investigating this matter and... I have made progress!
Well not  everything is smooth, but I WAS able to compile relatively complex prototype of my game: lwjgl+swt+swtforms+bindings+XML+...

Don't ask me about details related to gcc/gcj - I'm not a guru, not a bit. Here is the recepy:

1) get gcj v 4.0.2 from http://www.thisiscool.com/gcc_mingw.htm (build by Mohan Embar [many thanks!!!] )
2) read readme. I mean it!
3) make it link staticaly with original libgcj
4) patch your lwjgl.jar with fix described in (at the end): http://lwjgl.org/forum/viewtopic.php?t=1165&postdays=0&postorder=asc&highlight=gcj&start=30
5) repack your application to a single jar file (includin ALL third-party libs you need, including lwjgl.jar etc.)
6) compile your big-jar with:
gcj -fjni -findirect-dispatch yourjar.jar -o your.exe
or similar. The most important are -fjni -findirect-dispatch
7) compillation/linking will go without errors, but (!) it doesn't matter it will not fail... Try running. Fail. Study the log. If it lacks some class, go to cgj_dir\shared\->->->\libgcj-4.0.2.jar, grab the whole bunch of related classes from there and pack in your big-jar. Recompile, rerun.

Do not try any version of gcj below 4.x - bugs in jni. Version 4.x for mingw still BUGGY and my solution appeared as a result of working them aroud. Currently crashes on regular expressions (and some string operations, which seem to be implemented using regexps).

8) finally strip -s your.exe
9) upx -9 your.exe

Enjoy!

Michael.
P.S. Comments are welcome!!!!!!!
egards,
Michael.