Skip to content

JOGL/GLUEGEN not loading on MacOS M1 Arm #258

Open
@tmulle

Description

@tmulle

Description

Downloading the 2.2.1.zip and attempting to run either the run-demo.bash or any of the example applications (ie. Airspaces.java from the source tree using NetBeans IDE fails to load the JOGL libs on my M1 ARM MacOS.

When I attempt to disable the automatic loading of the libraries using -Djogamp.gluegen.UseTempJarCache=false as described here https://jogamp.org/jogl/doc/userguide/index.html#traditionallibraryloading I get a different error as show below.

From above link:

Automated Native Library Loading

JOGL 2.0 has a brand new feature allowing to automatically extract the proper native libraries required to use JOGL from JARs containing them without relying on the Java library path or any platform-dependent environment variable allowing to set the location of native libraries. This allows desktop applications as well as traditional Applets as NApplets to utilize the native library JAR files the same way Webstart/JNLP does.

To allow the native JAR file library loading to work, ensure that all JogAmp JAR files are left unmodified within their common directory.

In case the native library JAR files cannot be opened, it falls back to the traditional native library loading mechanism via the java library path.

This feature is enabled by default and - for whatever reason - it can be disabled by setting the property jogamp.gluegen.UseTempJarCache to false (as a VM argument, -Djogamp.gluegen.UseTempJarCache=false in command line).

Traditional Native Library Loading

If you don't use automatic native libraries loading, as enabled by default, you must set either the VM property java.library.path or the platform-dependent environment variable used for the location of native libraries, PATH on Windows, LD_LIBRARY_PATH on Unix (Linux, Solaris, ..) and DYLD_LIBRARY_PATH on Mac OS X. The environment variable shall contain the full path to the "lib" directory; for example, on Windows, add "C:\Users\myhome\jogamp-all-platforms\lib\windows-amd64" to your PATH using the System control panel, Advanced tab, Environment Variables button. At this point your Java installation should be able to see the Jogl class files.

Steps to Reproduce

Automatic Loading
To Run the demo app as stated in the README

  1. Download and unzip the 2.2.1.zip from the releases page on an M1 ARM based Mac computer
  2. execute the run-demo.bash script
  3. Program will attempt to run and fail with the exception A

To run the examples from the source in NetBeans IDE:

  1. Open the Worldwind project in the Netbeans IDE
  2. Right click on the src/gov/nasa/worldwindx/examples/Airspaces.java and choose 'Run File'
  3. Program will attempt to run and fail with the exception A

Disabling Automatic Loading
To Run the demo app as stated in the README

  1. Download and unzip the 2.2.1.zip from the releases page on an M1 ARM based Mac computer
  2. Add the command line argument -Djogamp.gluegen.UseTempJarCache=false to the java command
  3. execute the run-demo.bash script
  4. Program will attempt to run and fail with the exception B

To run the examples from the source in NetBeans IDE:

  1. Open the Worldwind project in the Netbeans IDE
  2. Add the command line argument -Djogamp.gluegen.UseTempJarCache=false to the Run properties of the project
  3. Right click on the src/gov/nasa/worldwindx/examples/Airspaces.java and choose 'Run File'
  4. Program will attempt to run and fail with the exception B

Expected behavior:
To be able to launch any of the demo code

Actual behavior:

EXCEPTION A
All fail with this exception:

at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at gov.nasa.worldwindx.examples.ApplicationTemplate.start(ApplicationTemplate.java:293)
	at gov.nasa.worldwindx.examples.Airspaces.main(Airspaces.java:470)
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/hh/zxltvdg95x57jm4ln9b7wl380000gn/T/jogamp_0000/file_cache/jln5621638363952472050/jln4872219641170749731/natives/macosx-universal/libgluegen_rt.dylib
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2393)
	at java.base/java.lang.Runtime.load0(Runtime.java:755)
	at java.base/java.lang.System.load(System.java:1953)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:604)
	at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)

EXCEPTION B

at gov.nasa.worldwindx.examples.ApplicationTemplate.start(ApplicationTemplate.java:293)
	at gov.nasa.worldwindx.examples.Airspaces.main(Airspaces.java:470)
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /Users/tmulle/Downloads/worldwind-v2.2.1/natives/macosx-universal/gluegen_rt
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2393)
	at java.base/java.lang.Runtime.load0(Runtime.java:755)
	at java.base/java.lang.System.load(System.java:1953)
	at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:625)

Reproduces how often: [What percentage of the time does it reproduce?]
100%

Operating System and Version

[What operating system and version are you using?]
Darwin mars.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64

Additional Information

Java Versions Tried:

openjdk version "17.0.5" 2022-10-18 LTS
OpenJDK Runtime Environment Zulu17.38+21-CA (build 17.0.5+8-LTS)
OpenJDK 64-Bit Server VM Zulu17.38+21-CA (build 17.0.5+8-LTS, mixed mode, sharing)

Any additional information, configuration or data that might be necessary to reproduce the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions