Compile JNI with autotools?
W. Michael Petullo
mike@flyn.org
Sun Sep 10 00:27:00 GMT 2006
I am trying to compile some JNI code using the GNU autotools.
Could anyone recommend a simple example Makefile.am?
Currently, the final step in my compile process fails with the following error:
/bin/sh ../libtool --tag=GCJ --mode=link gcj -g -O2 -o Test --main=Test Test.o libnewfmt_ptrnjava.la libnewfmt_ptrnjni.la -lz
libtool: ignoring unknown tag GCJ
gcj -g -O2 -o .libs/Test --main=Test Test.o ./.libs/libnewfmt_ptrnjava.so ./.libs/libnewfmt_ptrnjni.so -L/lib -lglib-2.0 -lz
./.libs/libnewfmt_ptrnjava.so: undefined reference to `hidden alias for void FmtPtrn::helloWorld()'
collect2: ld returned 1 exit status
make: *** [Test] Error 1
Everything works find with the following, manual build commands:
$ javac FmtPtrn.java Test.java
$ java Test
Hello world!
Of course, in this case, the executable produced is not native.
Here are the relevant portions of my Makefile.am:
lib_LTLIBRARIES = libnewfmt_ptrn.la libnewfmt_ptrnjni.la libnewfmt_ptrnjava.la libnewtemplate.la
# JNI C Code:
libnewfmt_ptrnjni_la_SOURCES = fmt_ptrnjni.c
libnewfmt_ptrnjni_la_LDFLAGS = -version-info @VER_INFO@ $(GLIB_LIBS)
# JNI Java Code:
libnewfmt_ptrnjava_la_SOURCES = FmtPtrn.java
bin_PROGRAMS = new new_proj Test
Test_SOURCES = Test.java
Test_LDFLAGS = --main=Test
Test_LDADD = libnewfmt_ptrnjava.la libnewfmt_ptrnjni.la
--
Mike
:wq
More information about the Java
mailing list