Bug 1110

Summary: Missing native function on jogl_mobile.dll
Product: [JogAmp] Jogl Reporter: Alessandro <alessandroborges>
Component: embeddedAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: critical    
Priority: ---    
Version: 2.3.0   
Hardware: All   
OS: all   
Type: --- SCM Refs:
dc15a430ee28f226e047ddebabf902d4c10b067a
Workaround: ---

Description Alessandro 2014-12-12 11:53:51 CET
I'd like to point out that library  jogl_mobile.dll, as well possibly the others O.S. flavors, miss the corresponding native version of the following method from jogamp.opengl.egl.EGL.java class:
 
     private static native void dispatch_eglGetConfigAttributes(long dpy, long config,
            int attributeCount,
            Object attributes,
            int attributes_byte_offset,
            Object values,
           int valuesOffset,
           long procAddr);

When I try to run a demo with GLProfile.GL2ES2 with VM attribute -Djogl.enable.ANGLE=true,  I have the following exception stack trace:

Exception in thread "main" java.lang.UnsatisfiedLinkError: jogamp.opengl.egl.EGL.dispatch_eglGetConfigAttributes(JJILjava/lang/Object;ILjava/lang/Object;IJ)V
        at jogamp.opengl.egl.EGL.dispatch_eglGetConfigAttributes(Native Method)
        at jogamp.opengl.egl.EGL.eglGetConfigAttributes(EGL.java:804)
        at jogamp.opengl.egl.EGLGraphicsConfiguration.EGLConfig2Capabilities(EGLGraphicsConfiguration.java:221)
        at jogamp.opengl.egl.EGLGraphicsConfigurationFactory.eglConfigs2GLCaps(EGLGraphicsConfigurationFactory.java:480)
        at jogamp.opengl.egl.EGLGraphicsConfigurationFactory.getAvailableCapabilities(EGLGraphicsConfigurationFactory.java:210)
        at jogamp.opengl.egl.EGLDrawableFactory.getAvailableCapabilitiesImpl(EGLDrawableFactory.java:718)
        at javax.media.opengl.GLDrawableFactory.getAvailableCapabilities(GLDrawableFactory.java:474)
        at com.jogamp.opengl.JoglVersion.getAvailableCapabilitiesInfo(JoglVersion.java:80)
        at com.jogamp.opengl.JoglVersion.getAllAvailableCapabilitiesInfo(JoglVersion.java:107)
        at com.jogamp.opengl.JoglVersion.getDefaultOpenGLInfo(JoglVersion.java:125)
        at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:218)
        at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:2246)
        at javax.media.opengl.GLProfile.get(GLProfile.java:959)
        at javax.media.opengl.GLProfile.get(GLProfile.java:975)
        at gles.tests.RawGLES2demo.main(RawGLES2demo.java:298)

The line 298 at RawGLES2demo.java has the following statement:
298   GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));

Checking the jogl_mobile.dll with PE Viewer is possible to note that above method is missing, in both x86 and AMD64 versions.

Checking at Github I note the that the missing functions is available at file
jogl/make/config/jogl/egl-CustomCCode.c and possibly generated from file egl-CustomJavaCode.java in the same folder.


I guess the make file just missed compile & link operations with above source code.

It happens on JOGL 2.2.4 and 2.3.
I didn't check others releases
Comment 1 Sven Gothel 2015-01-27 10:19:50 CET
Note: EGL package has changed due to Bug 1096.

'Java_com_jogamp_opengl_egl_EGL_dispatch_1eglGetConfigAttributes'
from 'make/config/jogl/egl-CustomCCode.c'
is included into 'build/jogl/gensrc/native/jogl/egl/EGL_JNI.c'
via make/config/jogl/egl.cfg's:
  IncludeAs CustomCCode        egl-CustomCCode.c

On GNU/Linux:
objdump -T libjogl_mobile.so | grep eglGetConfigAttributes

00000000000323e7 g    DF .text  0000000000000105  Base        Java_com_jogamp_opengl_egl_EGL_dispatch_1eglGetConfigAttributes

Method is invoked on GNU/Linux and Android,
no crash has been reported.

I will double check w/ Windows ..
Comment 2 Sven Gothel 2015-01-27 10:37:20 CET
Missing 'JNIEXPORT void JNICALL' in func-decl of 
make/config/jogl/egl-CustomCCode.c

.. hence it never landed into the windows dll

validating now ..
Comment 3 Sven Gothel 2015-01-27 10:47:55 CET
dc15a430ee28f226e047ddebabf902d4c10b067a:

    Fix regression of commit cf1163fc88976e7087d3a17524a49139e35a4708,
    i.e. missing function calling convention and return type qualifier
    for 'Java_com_jogamp_opengl_egl_EGL_dispatch_1eglGetConfigAttributes':
      JNIEXPORT void JNICALL
    
    This lead to its exclusion in the resulting Windows dll.