GCJ again

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

Previous topic - Next topic

teddybear

Greetings!

Have there been any progress since this discussion:

http://lwjgl.org/forum/viewtopic.php?t=1165&postdays=0&postorder=asc&highlight=gcj&start=30

It seems like the "ghost in the shell" styled fix for GCJ did not make it to 0.98
Personally, I'm experiencing the same problems as Matzon did... Before embarking upon the quest myself, I just want to know if that broblem is related to proguard? Well, generally, has anyone made any progress in this?

IMHO, GCJ stuff is so important for us that maybe we should place a sticky topic to track the progress...

Michael.
egards,
Michael.

elias

If we are to experiment with gcj, please leave out proguard, as it will only hinder debugging. That is, get it to work with gcj on ordinary class files, and then try proguard on them.

- elias

teddybear

I'm trying to compile lwjgl.jar like like that (simple):
gcj -c lwjgl.jar
and get:
org/lwjgl/J2SESysImplementation.java: In class `org.lwjgl.J2SESysImplementation':
org/lwjgl/J2SESysImplementation.java: In method `org.lwjgl.J2SESysImplementation.alert(java.lang.String,java.lang.String)':
org/lwjgl/J2SESysImplementation.java:52: error: cannot find file for class javax.swing.UIManager
etc....

Well, the class J2SESysImplementation exists in lwjgl.jar (v0.98 ) and is really packed with references to javax.swing.* .... :-) As we all know, libgcj does not implement swing yet. And why is it used in lwjgl? I thought lwjgl does not have any references to awt/swing already, but... I tried to get rid of that class, but it is used in others... etc... IMHO will get broken that way :-)
So am I using the wrong verion of lwjgl? What can be done? I'm clearly able to get stuff from CVS and modify java sources. Just give me some directions...

Thanx,
Michael.
egards,
Michael.

elias

Which version of gcj are you using? I do:

gcj -Ilibs/jinput.jar -c libs/lwjgl.jar


without getting any errors. My gcj version is:

gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)


from SUSE 10.0.

- elias

teddybear

I'm using gcc (gcj) v 3.4 for MinGW obtained from:
http://www.thisiscool.com/gcc_mingw.htm
v 4.0.2 is available but is limited (has broken dynamic builds, unusable).

This comes bundled with a few variations of libgcj:
original (no AWT/SWING at all)
gui (modified to include some AWT/SWING support).

using those two differ in error messages :-)
Do you think I should obtain a newer version of libgcj? Well, if you say you compile without errors... it is likely to be so.

By the way, I used proguard on my sample and libraries and it successfully trashed out all the awt/swing stuff... Currently I'm choking on other errors, related to my code... havent launched yet.

Thanx for the tip!
egards,
Michael.

elias

Ah, you're running on windows... I'm a bit surprised that the 4.x gcj version is not yet available on mingw. If you want to work around the swing problem, you could try commenting out the swing code in alert(), instead of removing the class altogether.

- elias

teddybear

Just now tried out libgcj v 4.0.2. The error picture has changed:

org/lwjgl/opengl/AWTGLCanvas.java:0: error: cannot find file for class java.awt.event.HierarchyListener
org/lwjgl/opengl/AWTGLCanvas.java: In class `org.lwjgl.opengl.AWTGLCanvas':
org/lwjgl/opengl/AWTGLCanvas.java: In constructor `(java.awt.GraphicsDevice,org.lwjgl.opengl.PixelFormat,org.lwjgl.opengl.Drawab
le)':
org/lwjgl/opengl/AWTGLCanvas.java:60: error: cannot find file for class java.awt.event.HierarchyListener
org/lwjgl/opengl/AWTGLCanvas.java:60: confused by earlier errors, bailing out

It seems like I have seen this somewhere before :-) ? havent you fixed it already? I'm compiling v 0.98.
egards,
Michael.

elias

Same version but different error message? No, I don't recall anything about that particular error message. I'm building from CVS, but I don't think that makes a difference in this case.

- elias

teddybear

Taht should not matter since we use the same sources. Could you please go to your GCJ and see if jour libgcj has the class java.awt.event.HierarchyListener, please? Mine has NOT... Im' only lucky to have proguard optimize lwjgl + my sample ;-) it seems to get rid of that AWT dependency...
egards,
Michael.

elias

I do, in a "/usr/share/java/libgcj-4.0.2.jar".

- elias

teddybear

!!! How could that be??? a libgcj-4.0.2.jar (9141650 bytes) does NOT have that awt class (actually, it has 2 classes in awt package... and no swing) It seems like swingWT is buildt into your lib? No wonder I have trouble compiling...
egards,
Michael.

teddybear

Reding this once again :
http://www.thisiscool.com/gcc_mingw.htm
I found the problem: the bundled libgcj is surgically modified, in particular, GNU awt/swing is replaced with swingWT! That is probably why there is difference between this minGW gcc/gcj bundle and original under *nux.

Hope this helps somebody. Also java@gcc.gnu.org mailing list is very usefull for the purpose of compiling anything to native.

... just wait for a new release from thisiscool or build or yourself a cross-compiler :-) ...gonna try the second...
egards,
Michael.

kappa

ah it works with gcc 4.0, is there much of a performance improvement with gcc as compared with just normal java?

what sort of sizes exe can you get?
do you still need the jre?
does swings now work?

teddybear

jre is not needed (why hten bother with native???)
speed is hopefully not worse (probably not better)
memory consumption is lower
exe size id HUGE with debug info, awsome stripped and acceptable compressed :-)

currently I'm in process of obtaining a working build of gcj 4.x ... I will probably put a FAQ or a tutorial as soon as I get it working... damn, building a cross-compiler (or a crossed-native) is kinda difficult... ;-(
egards,
Michael.

kappa

ah thx for the reply, i look forward to your tutorial/faq :)