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: Linking errors with GCJ and SWT


>>>>> "James" == James Lee <jlee23@umbc.edu> writes:

James>         jlee@thinkpad ~ $ gcj -fPIC -shared -o libswt.so /usr/share/swt-3/lib/swt.jar
James>         jlee@thinkpad ~ $ gcj -L. -lswt --main=Test Test.java
James>         ./libswt.so: undefined reference to `org::eclipse::swt::internal::gtk::OS::memmove(org::eclipse::swt::internal::gtk::GtkWidgetClass*, int)'

This looks like the name of a native method to me, based on my memory
of SWT.

By default gcj assumes you want to use CNI for native methods.  But,
most existing java code actually uses JNI.  The fix for this, as you
discovered, is to compile with '-fjni' -- this tells gcj to generate
a small JNI-calling stub for each native method it encounters.

James> Using the shared library
James> that I generated from the same jar along with -fjni caused
James> undefined references.

Can you be more specific about this?  If they are undefined references
at link time, please post the commands you used and the result.

If they are at runtime, then you have to tell gij how to find the JNI
libraries.  One way to do this is to set LD_LIBRARY_PATH.  Or, with
more recent versions of libgcj, you can set java.library.path on the
command line.

Tom


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