Segfault with trivial SWT snippet
Carl Worth
cworth@cworth.org
Tue Nov 13 16:52:00 GMT 2007
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20071113/d852106d/attachment.sig>
More information about the Java
mailing list