This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: gcc/gcj 3.4 - bug report
- From: Tom Tromey <tromey at redhat dot com>
- To: rezaei at promail dot com
- Cc: java at gcc dot gnu dot org
- Date: 23 Jul 2003 11:35:33 -0600
- Subject: Re: gcc/gcj 3.4 - bug report
- References: <3F1846F5.14206.4E956C8@localhost>
- Reply-to: tromey at redhat dot com
>>>>> ">" == rezaei <rezaei@promail.com> writes:
>> My build command is:
>> gcj -v --main=net.sourceforge.swtsolitaire.SwtMain --
>> classpath=%SWT_JAVA_LIB_DIR%\swt.jar -s -o test.exe jars\commons-
>> collections.jar jars\commons-logging-api-nojdk14.jar jars\jui-0.10m.jar
>> jars\test.jar %SWT_GCJ_LIB_DIR%\SWTMessages.o -
>> L%SWT_GCJ_LIB_DIR% -lswt
>> Somehow, -lswt ends up before SWTMessages.o and ld won't recognize
>> it.
It's usually better to build to .o and then link as a separate step.
The above is probably a bug -- feel free to put it in bugzilla.
(Preferably with the full -v output...) Still, this will be low
priority, I think.
Try:
gcj ... -fPIC -shared -o collections.so .../collections.jar
[ repeat for each .jar ]
gcj --main=... -o test.exe collections.so ...other .so files... -lswt
That's on Linux anyway. On Windows you may need to do compile to an
ordinary .o (I don't use Windows...).
>> 2) I've attached a very simple (15 line) swt program that works
>> fine with java.exe, but fails when compiled to native code. The bug
>> has to do with image loading. I think this is pretty much a show
>> stopper for any application.
Probably this is a static linking problem. I'm not sure, since I
haven't tried your program. But make sure that the image loaders are
in fact linked into your final executable. Search this list's
archives for lots of talk about the problems of static linking, most
likely including discussions about this exact problem involving SWT.
>> Exception in thread "Thread-1" java.awt.AWTError: Cannot load AWT toolkit:
AWT isn't available yet. I'm surprised that an SWT application would
try to use it.
Tom