Bug 1316 - Java 8 expects *.dylib instead of *.jnilib on OS X
Summary: Java 8 expects *.dylib instead of *.jnilib on OS X
Alias: None
Product: General
Classification: JogAmp
Component: builds (show other bugs)
Version: 2.3.3
Hardware: pc_x86_64 macosx
: P4 normal
Assignee: Sven Gothel
Depends on:
Reported: 2016-07-14 12:20 CEST by Martin von Gagern
Modified: 2018-01-25 14:09 CET (History)
2 users (show)

See Also:
SCM Refs:
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2016-07-14 12:20:17 CEST
For one application I've unpacked the native libs to a local directory (as part of the installation process), and I've set jogamp.gluegen.UseTempJarCache to false. This used to work in the past, but recently with Java 1.8 I see errors like this:

java.lang.UnsatisfiedLinkError: Can't load library: /…/libgluegen-rt.dylib

Searching the web for this, I found some indications that simply renaming the *.jnilib that came from the Jogamp release to *.dylib should work. I tried it out, and indeed it did work. So perhaps the natives jar file for OS X should be using those names? I haven't found any official documentation on that change so far.

I'm using JOGL 2.2.1 here, but I verified that in 2.3.2 the files are still called jnilib not dylib. (I'm confused that the version field here in Bugzilla doesn't allow me selecting a version earlier than 2.4.0 as the version where the bug was found, so I couldn't fill out that required field correctly.)

$ java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

The OS is OS X 10.11.5 (15F34).

https://github.com/LWJGL/lwjgl/commit/a6bb6e31d888c07026ac0381c2900c895765ffbb was what suggested simply renaming the files. It's also the source naming java 1.8 as the release introducing this breakage, so I'm simply quoting that.
Comment 1 Julien Gouesse 2016-07-26 14:36:08 CEST
Would it still work with previous versions of Java under OS X, for example OpenJDK or Oracle Java 1.7?
Comment 2 Martin von Gagern 2016-07-26 17:27:50 CEST
Trying to track this down: In OpenJDK the file hotspot/src/os/bsd/vm/os_bsd.cpp has this:

#define JNI_LIB_PREFIX "lib"
#ifdef __APPLE__
#define JNI_LIB_SUFFIX ".dylib"
#define JNI_LIB_SUFFIX ".so"

This should be the setting that is being used by the native implementation of System.mapLibraryName in jdk/src/share/native/java/lang/System.c. The file names .dylib since it got included into the repository in 2011. I don't know how the Apple resp. Oracle JDK gets derived from this, so I don't know for how long they supported both forms, if ever. I don't have a wide range of OpenJDK at my disposal just now to test this.

http://lists.apple.com/archives/java-dev/2012/Nov/msg00036.html reports dylib vs. jnilib naming issues with jogamp code as far back as 2012. JDK version unknown.
Comment 3 Julien Gouesse 2017-01-17 15:01:44 CET
Now I understand why .jnilib had been used:

It seems reasonable to rename .jnilib files into .dylib, I'll do it as soon as possible.