Bug 810

Summary: JOGL should only try to load the native libraries supported by the operating system
Product: [JogAmp] Jogl Reporter: Julien Gouesse <gouessej>
Component: coreAssignee: Julien Gouesse <gouessej>
Status: RESOLVED FIXED    
Severity: enhancement CC: gouessej, sgothel
Priority: ---    
Version: 2   
Hardware: All   
OS: all   
Type: --- SCM Refs:
gluegen c0ead6fa10280f8076704726d59f482b183fd77e jogl 14eab8af439e6e7ce7ee08a9ca13fec3f3a80d25
Workaround: ---

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.