Bug 810 - JOGL should only try to load the native libraries supported by the operating system
Summary: JOGL should only try to load the native libraries supported by the operating ...
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 2
Hardware: All all
: --- enhancement
Assignee: Julien Gouesse
URL:
Depends on:
Blocks:
 
Reported: 2013-08-06 10:57 CEST by Julien Gouesse
Modified: 2013-09-02 21:04 CEST (History)
2 users (show)

See Also:
Type: ---
SCM Refs:
gluegen c0ead6fa10280f8076704726d59f482b183fd77e jogl 14eab8af439e6e7ce7ee08a9ca13fec3f3a80d25
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Gouesse 2013-08-06 10:57:34 CEST
When jogl-all-android.jar is in the classpath, JOGL tries to look for jogl-all-android-natives-macosx-universal.jar under OSX for example. This bug can be reproduced under GNU Linux too. The problem is that the error isn't very explicit:

Catched FileNotFoundException: /Library/Java/Extensions/gluegen-rt-android-natives-macosx-universal.jar (No such file or directory), while TempJarCache.bootstrapNativeLib() of jar:file:/Library/Java/Extensions/gluegen-rt-android-natives-macosx-universal.jar!/ (file:/Library/Java/Extensions/ + gluegen-rt-android-natives-macosx-universal.jar)
Catched FileNotFoundException: /Library/Java/Extensions/jogl-all-android-natives-macosx-universal.jar (No such file or directory), while addNativeJarLibsImpl(classFromJavaJar class jogamp.nativewindow.NWJNILibLoader, classJarURI jar:file:/Library/Java/Extensions/jogl-all-android.jar!/jogamp/nativewindow/NWJNILibLoader.class, nativeJarBaseName jogl-all-android): jogl-all-android-natives-macosx-universal.jar + file:/Library/Java/Extensions/ -> jar:file:/Library/Java/Extensions/jogl-all-android-natives-macosx-universal.jar!/
Catched IOException: TempJarCache: addNativeLibs: jar:file:/Library/Java/Extensions/jogl-all-android-natives-macosx-universal.jar!/, previous load attempt failed, while addNativeJarLibsImpl(classFromJavaJar class jogamp.nativewindow.NWJNILibLoader, classJarURI jar:file:/Library/Java/Extensions/jogl-all-android.jar!/jogamp/nativewindow/NWJNILibLoader.class, nativeJarBaseName jogl-all-android): jogl-all-android-natives-macosx-universal.jar + file:/Library/Java/Extensions/ -> jar:file:/Library/Java/Extensions/jogl-all-android-natives-macosx-universal.jar!/
Catched IOException: TempJarCache: addNativeLibs: jar:file:/Library/Java/Extensions/jogl-all-android-natives-macosx-universal.jar!/, previous load attempt failed, while addNativeJarLibsImpl(classFromJavaJar class jogamp.nativewindow.NWJNILibLoader, classJarURI jar:file:/Library/Java/Extensions/jogl-all-android.jar!/jogamp/nativewindow/NWJNILibLoader.class, nativeJarBaseName jogl-all-android): jogl-all-android-natives-macosx-universal.jar + file:/Library/Java/Extensions/ -> jar:file:/Library/Java/Extensions/jogl-all-android-natives-macosx-universal.jar!/
Exception in thread "main" javax.media.opengl.GLException: No default device available
        at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:2011)
        at javax.media.opengl.GLProfile.get(GLProfile.java:863)
        at javax.media.opengl.GLProfile.getDefault(GLProfile.java:597)
        at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:247)
        at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:197)
        at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:187)
        at joglquad.JOGLQuad.main(JOGLQuad.java:78) 


GlueGen seems to look for only the Android native libraries when jogl-all-android.jar and jogl-all.jar are both in the classpath. Several people already made the same mistake. Shouldn't GlueGen skip Android native libraries at runtime when the operating system is another one?
Comment 3 Julien Gouesse 2013-08-07 11:36:08 CEST
First attempt of fix:
https://github.com/gouessej/jogl/commit/617aa7ad3e39e1adaac6d099b4d23fee52cfed0c
Comment 4 Sven Gothel 2013-09-02 21:04:11 CEST
Thank you Julien!

I took the freedom and moved the new method to 
GlueGen's JNILibLoaderBase class to solve JOGL's module dependency.
Better API doc added as well, my old one was .. errr .. not so clear.
Referencing you in commit log.