JSR231 jnilibs for OSX build question

If you use “otool -L” on OSX against libjogl_awt.jnilib in the OSX universal beta5 build you get:

libjogl_awt.jnilib:
/var/tmp//ccsgGBsf.out (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libjawt.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.5)

There is an argument that “libjogl_awt.jnilib” and other jnilibs should be linked against the most generic symlinks (for example libjawt.dylib should be referenced as /System/Library/Frameworks/JavaVM.framework/Libraries/libjawt.dylib)

Linking against the fully resolved targets may reduce the usefulness of the jnilibs. They have to be used with Java 1.5 on OSX rather than 1.4 or 1.6 presumably.

You’re right in theory but in practice I believe this still works if you reference an older version of Java. I just tried running for example demos.gears.Gears with the 1.4.2 version of Java on my Mac and it works fine. Are you explicitly running into problems?

We don’t actually explicitly link against the 5.0 version of libjawt.dylib; that happens because the symlink gets resolved during link time. On other (non-Mac) platforms we perform an explicit System.loadLibrary(“jawt”) to get the JAWT pre-loaded before we even load JOGL’s native code. This causes the jawt.dll / libjawt.so reference in our shared library to be resolved to whatever is provided by the currently-running version of Java rather than being implicitly looked up in PATH / LD_LIBRARY_PATH.

I’m far from an expert on the Mac so if you have suggestions please feel free to file a bug or patch with the JOGL issue tracker.

We should probably look into removing all static references to the JAWT and instead look them up dynamically. I’m not 100% sure we have the appropriate bootstrapping code to do this on all platforms yet though.

The problems I have are trying to build an OSX application using JOGL which will run on both 10.3 and 10.4. A little related.

I used install_name_tool on OSX to change the jawt linking in libjogl_awt.jnilib thus:

 install_name_tool -change /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libjawt.dylib /System/Library/Frameworks/JavaVM.framework/Libraries/libjawt.dylib libjogl_awt.jnilib

“otool -L” on libjogl_awt.jnilib afterwards reported:

libjogl_awt.jnilib:
/var/tmp//ccsgGBsf.out (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/JavaVM.framework/Libraries/libjawt.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.5)

Ran a JOGL program successfully after that. I’ll aim to submit a bug / enhancement suggestion but for this area I rely on more knowledgeable people on the Apple Java mailing list.

Thanks for the tip. I’ve added this step to JOGL’s build.xml for the Mac OS X universal binaries. Please try the universal binaries out of a nightly build dated 7/29 or later and see whether they work for you now.

Many thanks for doing that, I am grateful for how responsive the JOGL team is.

I’m afraid I got busy on other fronts and have only just got back to this. I will check out the latest build as soon as possible. I did look at submitting a bug / enhancement request but couldn’t work out how to enter it into Sun’s system as Mac OSX is not a supported platform.

The JOGL issue tracker is not the same as Sun’s bug database; it’s accessed from the JOGL home page, left column, “Issue Tracker”.

Let us know if there are any issues with the current JOGL universal binaries for OS X.

Thanks for that. The overnight builds of OSX universal jnilibs worked on a 10.3.9 OSX machine which I’m very happy about.