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 Wed, 14 Nov 2007 14:50:40 +0000, Andrew Haley wrote:
> Carl Worth writes:
>  > 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$'
>
> You seem to have forgotten about -findirect-dispatch -fpic !

OK. That's fairly embarrassing.

I had really meant to stick to compile-and-link with one command to
avoid issues like this. Anyway, it does work if I do it correctly. For
example:

	gcj -I `pkg-config --variable=CLASSPATH swt-gtk` \
	-findirect-dispatch -fpic -fjni \
	-lswt --main=Snippet1 -o Snippet1 Snippet1.java

And it also works without those flags:

	gcj -I `pkg-config --variable=CLASSPATH swt-gtk` -lswt \
	--main=Snippet1 -o Snippet1 Snippet1.java

I'm curious now if there's a significant difference one way or the
other? Is something different happening or is the compiler figuring
things out and acting the same in both cases?

Thanks again for the help,

-Carl

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]