Bug 88

Summary: Add Linux amd64 support to JOGL
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: VERIFIED FIXED    
Severity: normal    
Priority: P3    
Version: 1   
Hardware: All   
OS: linux   
URL: http://mapage.noos.fr/~yleteigne1/jogl.patch.zip
Type: DEFECT SCM Refs:
Workaround: ---
Attachments: Copy of patch from URL above

Description Sven Gothel 2010-03-24 07:46:38 CET


---- Reported by altrent 2004-05-19 13:55:05 ----

Attached patch should bring basic support of Linux amd64 platform to JOGL.

However, I have noticed that calling glLoadTransposeMatrixfARB will crash the
application.

Crash occurs when calling below line (probably some pointer cast):
File: build/gensrc/native/jogl/X11GLImpl_JNI.c
Line 28493: (* ptr_glLoadTransposeMatrixfARB) ((GLfloat *) _ptr0);

Called from:
File: build/gensrc/classes/net/java/games/jogl/impl/x11/X11GLImpl.java
Line 17241: public void glLoadTransposeMatrixfARB(float[] m)



---- Additional Comments From lmfr 2004-08-18 00:47:37 ----

*** Issue 103 has been marked as a duplicate of this issue. ***



---- Additional Comments From lmfr 2004-08-18 01:10:18 ----

Just copying info already on the forums:

I've had the same problem reported there. My problem was related to a bug on
NVIDIA drivers (posted separatly on nvnews linux forums). My fix was to use
dlsym always instead of trying first glxGetProcAddress. In order to work arround
the driver bug dispatch_glxGetProcAddress should also be replaced by a function
that did only dlsym's.

Anyway, there are still some issues regarding functions that receive XID
parameters, these are translated bt gluegen to java ints on 32 bit architectures
and to longs on 64 bit architectures. I think the API should always be the same
so, maybe, there should be a wrapper class for XID's that would be used
independently of pointer size.



---- Additional Comments From dclunie 2004-12-23 09:31:19 ----

On FC3 I had to do one more thing beyond the patch for Issue 88 to get it to
work, and that was to point the linker to the 64 bit X11 libraries
(/usr/X11R6/lib64 rather than lib).
 
So, additional changes to the build file might include adding a specific linker
target of "linker.cfg.linux.amd64" :
 
314a335,341
>     <target name="declare.linux.amd64" depends="declare.x11.amd64">
>    <property name="java.includes.dir.platform"     
value="${java.includes.dir.linux}" />
>    <property name="java.lib.dir.platform"     
value="${java.lib.dir.linux.amd64}" />
>
>    <property name="compiler.cfg.id"       value="compiler.cfg.linux.amd64" />
>    <property name="linker.cfg.id"    value="linker.cfg.linux.amd64" />
>     </target>
 
and
 
708a741,745
>  <linker id="linker.cfg.linux.amd64" name="gcc">
>    <syslibset dir="/usr/X11R6/lib64" libs="GL, GLU, X11"/>
>    <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/>
>  </linker>
 
With this, the jogl and the demos seem to build and run (FC3 (2.6.9-1.667smp
kernel), dual Opteron, gcc 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), JDK 1.5.0-b64,
apache-ant-1.6.2, antlr-2.7.4, NVIDIA FX3000 with 6629 driver, IBM T221 DG 3
monitor).  
 
David




---- Additional Comments From altrent 2005-01-05 15:30:22 ----

The patch has been updated with David's comments, it should now compile fine
jogl 1.1b07.



---- Additional Comments From kbr 2005-01-14 11:50:36 ----

Created an attachment
Copy of patch from URL above




---- Additional Comments From kbr 2005-01-14 11:51:53 ----

Thanks for the patch. We need to find an AMD64 box on which to test internally.
Ideally we could just provide an alternative native library for AMD64 platforms
and have the Java code be identical. Attached the proposed test case to the bug
to have a persistent copy.




---- Additional Comments From kbr 2005-01-26 22:59:11 ----

The stub_includes headers and GlueGen config files have been changed
to make X identifiers and similar values appear to Java to be 64-bit
values on all platforms, rather than changing between 32-bit and
64-bit values depending on the architecture. This allows the shared
Java code in the JOGL X11 implementation to work on both 32- and
64-bit architectures, which is an important step toward having
complete 64-bit support in JOGL. Compared to the suggested patch,
there is no longer a need to duplicate the sources in
net.java.games.jogl.impl.x11 because the Java sources are now 64-bit
clean. The change to use dlsym on Linux/AMD64 instead of
glXGetProcAddressARB has been conditionalized under a run-time flag.
Most of the build.xml and all of the GlueGen changes were incorporated
unchanged. Thanks to the original authors of the patch for this work.

At this point "ant linux.amd64" should build a working JOGL. However,
it can not yet be incorporated into the distribution's platform-
independent jogl.jar; in order to do this, the generation of the
StructAccessors for the JAWT and some other X11 data structures by
GlueGen will need to be conditionalized depending on the platform so
that the 32-bit versions go in one directory, the 64-bit versions in
another, and a run-time check is done to determine which version to
instantiate. There are also a few remaining cleanups to generated glue
code such as net.java.games.jogl.impl.x11.GLX.XGetVisualInfo(), which
needs to be made platform-independent by calling the
XVisualInfo.size() accessor rather than hardwiring in the size of the
data structure (although the real solution will probably need to be
more complicated since there will probably be two XVisualInfo
implementations in the jar file).




---- Additional Comments From travis_bryson 2005-12-19 17:48:43 ----

All demos on a recent (December 16, 2005) Linux AMD64 build were showing the
following stack trace when we attempted to run them.  I believe this was a
recent Nvidia card in the machine:

java demos.gears.Gears
Exception in thread "main" javax.media.opengl.GLException: glXGetConfig failed:
error code GLX_BAD_SCREEN
       at
com.sun.opengl.impl.x11.X11GLDrawableFactory.glXGetConfig(X11GLDrawableFactory.java:453)
       at
com.sun.opengl.impl.x11.X11GLDrawableFactory.xvi2GLCapabilities(X11GLDrawableFactory.java:276)
       at
com.sun.opengl.impl.x11.X11GLDrawableFactory.chooseGraphicsConfiguration(X11GLDrawableFactory.java:125)
       at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:110)
       at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:82)
       at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:75)
       at demos.gears.Gears.main(Gears.java:19)




---- Additional Comments From kbr 2006-01-11 00:12:56 ----

In recent months the autogenerated code from GlueGen has been substantially
revised to support both 32-bit and 64-bit platforms in the same jar file. The
most recent post above was caused by several bugs introduced during that
reorganization. With help from a member on the javagaming.org forums all of
these bugs have been tracked down and fixed. At this point the Linux/AMD64 port
is known to work with the same jogl.jar file as on all of the other platforms;
the only piece missing is the native libraries. Due to machine constraints we
still do not have Linux/AMD64 binaries available with the nightly builds, but
will try to provide them in the future. Regardless, closing this bug as fixed.




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:46 EDT  ---

This bug was previously known as _bug_ 88 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=88
Imported an attachment (id=23)

Unknown bug field "has_duplicates" encountered while moving bug
   <has_duplicates>
     <bug_id>103</bug_id>
     <who>lmfr</who>
     <when>2004-08-18 00:47:37</when>
</has_duplicates>
The original submitter of attachment 23 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.