This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Segfault with trivial SWT snippet


On Tue, 13 Nov 2007 13:26:10 +0100, Mark Wielaard wrote:
> On Tue, 2007-11-13 at 11:33 +0000, Andrew Haley wrote:
> > Try compiling with -findirect-dispatch -fpic.
>
> And since swt uses JNI for its native bindings, you might also need to
> add -fjni.

Andre and Mark,

Thanks for the help. The extra flags didn't solve the problem. But it
did encourage me to try another experiment. I found that even if I
used my System.out.println example with the compilation flags I was
using that I got the segfault.

So that made it simple to track down the problem to the following
linker flags:

	-lswt -lswt-pi

I found that if I just remove -lswt-pi then everything works great. (I
have no idea what the intent of swt-pi might be---I had picked this up
from the output of "pkg-config --libs swt-gtk"). So I'll pass that bug
report on to the swt/Debian folks.

Anyway, I think I'm on my way now.

Thanks for the help.

-Carl

Oh, but by the way, I couldn't get things to link when passing the
-findirect-dispatch flag. I always got errors like:

	gcj -I `pkg-config --variable=CLASSPATH swt-gtk`
	-findirect-dispatch -fpic -fjni -c -o Snippet1.o Snippet1.java
	gcj -lswt --main=Snippet1 -o Snippet1 Snippet1.o
	/tmp/cceivJSw.o: In function `main':
	ccUlWBRV.i:(.text+0x2b): undefined reference to `Snippet1::class$'

So for now I'm just not using an of the extra flags recommended above.

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]