GCJ (and IRC) questions.
Bryce McKinlay
mckinlay@redhat.com
Tue Nov 30 00:25:00 GMT 2004
Troy Wu wrote:
>Hello, everyone.
>
>I'm having some trouble with GCJ. Is there an IRC channel where
>developers (and other knowledgable folks) hang out? Also an IRC
>newbie....
>
>
irc.oftc.net #gcj
>I'm a new user to GCJ. I'm getting unusual compiler messages. Let me try
>to break down my problem:
>
> The command:
>
>gcj -g -fPIC --main=tacular.gui.Graphics `find . -name "*.o"` -L/usr/X11/lib64 -lX11
>
> The resultant error(s):
>
>./cni/Globals.o(.gnu.linkonce.d.DW.ref.__gxx_personality_v0+0x0): In
>function `runtime_init()':
>/raid/troy/tacular/cni/Globals.cc:24: undefined reference to
>`__gxx_personality_v0'
>./cni/NativeGraphics.o(.text+0x11): In function
>`tacular::gui::NativeGraphics::NativeGraphics[not-in-charge]()':
>/raid/troy/tacular/cni/NativeGraphics.cc:31: undefined reference to
>`tacular::gui::Graphics::Graphics[not-in-charge]()'
>./cni/NativeGraphics.o(.text+0x1c):/raid/troy/tacular/cni/NativeGraphics.cc:31:
>undefined reference to `vtable for tacular::gui::NativeGraphics'
>./cni/NativeGraphics.o(.text+0xad): In function
>`tacular::gui::NativeGraphics::NativeGraphics[in-charge]()':
>/raid/troy/tacular/cni/NativeGraphics.cc:31: undefined reference to
>`tacular::gui::Graphics::Graphics[not-in-charge]()'
>./cni/NativeGraphics.o(.text+0xb8):/raid/troy/tacular/cni/NativeGraphics.cc:31:
>undefined reference to `vtable for tacular::gui::NativeGraphics'
>collect2: ld returned 1 exit status
>make: *** [final] Error 1
>
>-------------------------------------------------------------------------
>
>It's enough to boggle the mind!
>
>I don't know what the first thing is (the __gxx_personality_v0+0x0). The
>second set of errors seems to say that the vtable for a class is busted.
>The third set of errors seems to say that vtable for the same class is
>busted.
>
>What in the world are these 2 functions:
>
> tacular::gui::NativeGraphics::NativeGraphics[in-charge]()
> tacular::gui::NativeGraphics::NativeGraphics[not-in-charge]()
>
>Are these ctors? Is G++ doing something weird with Java ctors using GCJ?
>
>
Yes, it looks like something strange is going on here. Java (CNI)
classes, unlike real C++ classes, should not distinguish between
in-charge and not-in-charge constructors. If you could post a small test
case which shows the error, it should help to diagnose the problem.
>Relevant info:
>
> * Using a dual-proc opteron machine running SuSE-9.2 (2.6.5)
>
> * Using GCJ 3.3.3
>
> * Graphics is an abstract class defined in Java, compiled with
> GCJ.
>
> * NativeGraphics is a concrete class (extending Graphics) written
> in C++, compiled with g++.
>
>
I presume you've read the CNI documentation, but note that
NativeGraphics needs to be declared in Java, then the "native" methods
implemented in C++ against the header file built with gcjh. Failing to
do this means your native class would not be declared "extern Java", and
that would also cause the undefined reference to __gxx_personality_v0 error.
Regards
Bryce
More information about the Java
mailing list