Ian Kerr wrote:
Hello,
Hi,
I'm trying to build a JNI library and, from what I understand, the
library needs to have a '.jnilib' extension on Mac OS X.
Yes, the requirement was recently lifted, now java will also look for
.dylib.
http://developer.apple.com/releasenotes/Java/JavaLeopardRN/ResolvedIssues/chapter_3_section_14.html#
As I
understand it, I should be able to use the -shrext flag to get libtool
to use the jnilib extension rather than the standard shared library
extension. However, I can't get this to work. I issue the command:
/bin/sh ../../../libtool --mode=link g++ -shared -rpath /usr/local/lib
-shrext .jnilib -o libjmath.la swig_math.lo
and the following g++ invocation is made:
g++ -dynamiclib -single_module -flat_namespace -undefined suppress -o
.libs/libjmath.0.dylib .libs/swig_math.o -install_name
/usr/local/lib/libjmath.0.dylib -compatibility_version 1
-current_version 1.0
As you can see, the extension isn't changed from dylib to jnilib. As I'm
new to libtool I figure I'm doing something wrong. Any ideas?
What version of libtool and what version of Mac OS X? This does work for me.
On Leopard, I get:
$ /usr/bin/glibtool --mode=link --tag=CXX g++ -shrext .jnilib -o java.la
java.lo -rpath /usr/local/lib -module -avoid-version
g++ ${wl}-undefined ${wl}dynamic_lookup -o .libs/java.jnilib -bundle
.libs/java.o
$ /usr/bin/glibtool --version
ltmain.sh (GNU libtool) 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)
on a more recent libtool-2.2.x, I get:
libtool: link: /usr/bin/g++ -Wl,-undefined -Wl,dynamic_lookup -o
.libs/java.jnilib -bundle .libs/java.o
libtool: link: dsymutil .libs/java.jnilib || :
Peter
--
Peter O'Gorman
http://pogma.com