Login  Register

Re: JOGL for Mac ARM Silicon

Posted by Manu on Nov 30, 2020; 4:33pm
URL: https://forum.jogamp.org/JOGL-for-Mac-ARM-Silicon-tp4040887p4040889.html

Thanks for the instructions. They were useful and after a few changes, I was able to get a running JOGL / Java 3D application running on a Mac ARM

As instructed, I downloaded Azul OpenJDK for Java 11 and 8 (my target), installed Ant and CMake. There's no version of CMake for macOS arm64 yet but using Intel version with Rosetta 2 correctly worked.

There was no problem to compile Gluegen but the generated .dylib file was for x86_64, not arm64. Therefore, I replaced "x86_64" by "arm64" in gluegen/make/gluegen-cpptasks-base.xml file in the two following lines:
<compilerarg value="x86_64" if="use.macosx64"/> 
<linkerarg value="x86_64" if="use.macosx64"/>
and that was enough to get libgluegen_rt.dylib for arm64 architecture (info checked with "lipo" command).
I even succeed to create a "universal" .dylib file which combines both architectures with the command:
lipo libgluegen_rt-arm64.dylib libgluegen_rt-x86_64.dylib -output libgluegen_rt.dylib -create

It was a little more complicated to generate JOGL .dylib files. First, I searched in .xml files some lines similar to the ones for Gluegen architecture, and after a few failures, I realized that there was no .xml files to change for JOGL because the build process reused the compilation configuration set for Gluegen!
There was also a link to SWT that I didn't succeed to set, so I just removed the following folders where it's referenced:
jogl/src/nativewindow/classes/com/jogamp/nativewindow/swt
jogl/src/jogl/classes/com/jogamp/opengl/swt
jogl/src/newt/classes/com/jogamp/newt/swt
NEWT couldn't still be generated but as I don't need it, I just used the .dylib files that were successfully generated.

Finally, I extracted the libjogl_desktop.dylib, libnativewindow_awt.dylib and libnativewindow_macosx.dylib files needed by Java 3D, and signed the 4 .dylib files once I realized it was required to make run an arm64 application under macOS 11.
The result can be tested with the JAR executable SweetHome3D-6.4.2a-jogl-2.4.0-rc-20200307.jar which is able to run under macOS Intel or ARM, Windows and Linux.
If you want to test the universal .dylib files I generated in your own program, just extract the following files found in the java3d-1.6/macosx folder of the previous JAR executable.
libgluegen_rt.dylib
libjogl_desktop.dylib
libnativewindow_awt.dylib
libnativewindow_macosx.dylib
The Gluegen / JOGL JAR files and DLLs for other systems come from the version 2.4.0-rc-20200307.
Emmanuel Puybaret