Login  Register

Re: JogAmp Build v2.4.0-rc-20210111

Posted by Manu on Jan 18, 2021; 5:12pm
URL: https://forum.jogamp.org/JogAmp-Build-v2-4-0-rc-20210111-tp4040955p4040981.html

Today, I tried again to build universal .dylib files under Catalina and XCode 12.3, and this time it worked, so it could worth to try with the Mac used to build and deliver JOGL. On my side, the difference was that I built this time Gluegen and JOGL in a virtual machine but there must have been something else.

The only difficulty was to succeed to link with libjawt.dylib for ARM under an Intel computer. I tried to set DYLD_LIBRARY_PATH env variable but it didn't work.
So here's the solution to build Gluegen and JOGL for Mac ARM that I used:
- download Zulu OpenJDK 11 for x86_64 and arm64
- install Zulu OpenJDK 11 for x86_64 in /Library/Java/JavaVirtualMachines to use it for build process
- unzip Zulu OpenJDK 11 for arm64 somewhere on your disk and prepare a universal libjawt.dylib file for x86_64 and arm64 with a command similar to:
lipo /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/lib/libjawt.dylib /path/to/zulu11.43.1021-ca-jdk11.0.9.1-macosx_aarch64/zulu-11.jdk/Contents/Home/lib/libjawt.dylib -output /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/lib/libjawt.dylib -create
- check libjawt.dylib is universal with the command:
lipo /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/lib/libjawt.dylib -info
- get Gluegen and JOGL with Git as explained at http://forum.jogamp.com/jogl/doc/HowToBuild.html
- before running Ant scripts, edit gluegen/make/gluegen-cpptasks-base.xml to replace "x86_64" by "arm64" in the following lines:
<compilerarg value="x86_64" if="use.macosx64"/> 
<linkerarg value="x86_64" if="use.macosx64"/>
- run Ant scripts
- pick generated .dylib files in gluegen/build/gluegen-rt-natives-macosx-universal.jar and jogl/build/jar/jogl-all-natives-macosx-universal.jar files
- finally, if you want universal .dylib files use lipo command to combine x86_64 and arm64 .dylib files, with commands similar to:
lipo path/to/arm64/libgluegen_rt.dylib path/to/x86_64/libgluegen_rt.dylib -output path/to/universal/libgluegen_rt.dylib -create

Sven, I hope you'll be able to adapt your Ant scripts to perform these operations.
Emmanuel Puybaret