Converting a JAR into a gcj-statically-linked SO

Matthijs van de Water matthijs.van.de.water@gmail.com
Tue Jan 8 17:23:00 GMT 2008


On Jan 7, 2008 2:42 PM, Andrew Haley <aph@redhat.com> wrote:
> You don't seem to be linking your shared library statically against
> libgcj. You must use the -static-libgcj option.
Changing my compile line into
$ gcj -o libmynative.so -shared -fPIC native_lib.cc MyJavaLib.o
-lstdc++ -shared-libgcc -static-libgcj
creates a similar libmynative.so (which upon inspection looks like it
is statically linked to libgcj), but I'm still unable to link it to my
test.cc program (same error messages).
Even if I change to using gcj for all compile steps and specify
-static-libgcj on all, I still get the same undefined references.
I must be doing something wrong with the linking, I'm just not sure
what. My output libmynative.so is ~20MB big, so it looks like it has
the libgcj stuff in it...
Anyway, I've created an example based on kxml2 library. The problem
now is that I cannot seem to pass a -I flag to gcj that ends up being
passed to gcc, so the example does not currently compile (it needs
"-I."). Maybe you can help my with the correct options, at least now
you can see what I'm trying to do:
http://www.matthijs.net/temp/kxml.static.jar.test.tar.gz
make headers
make lib
make shared / make static
Only the shared one currently works for me.
I'll be trying David Daneys suggestion of using GCC 4.3 with his patch
and --disable-libgcj-bc tomorrow.
Your help is greatly appreciated.
Regards,
Matthijs


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /