News:

Precision Simulator update 10.176 (7 September 2024) is now available.
Navburo update 13 (23 November 2022) is now available.
NG FMC and More is released.

Main Menu

arm64 versions of dylibs?

Started by Balt, Mon, 3 Jul 2023 04:04

Balt

Hi Hardy/all,

I'm moving from my old x64 MBP to Apple silicon. Java generally seems to be supported, but instead of going the Oracle way due to the new licensing terms I installed the Zulu OpenJDK 17 via macports.

This seems to generally run all of my Java applications, but some dylib dependencies for Aerowinx remain unresolved. Specifically, all the dylibs in Aerowinx/Interfaces do not appear to be arm64 compatible as evidenced by the error log when trying to start PSX:

java.lang.UnsatisfiedLinkError: /Applications/Aerowinx/Interfaces/liblwjgl.dylib: dlopen(/Applications/Aerowinx/Interfaces/liblwjgl.dylib, 0x0001): tried: '/Applications/Aerowinx/Interfaces/liblwjgl.dylib' (fat file, but missing compatible architecture (have 'x86_64', need 'arm64')),

What is the most appropriate path to resolve this?

Thanks!

Balt

Hardy Heinlin

#1
Hi Balt,

the files in the Interfaces folder are not written by me; they include native code for Windows, Mac, and Linux. Unfortunately, I don't know how to solve this. I guess, the only way is to hope they'll make an update. Or check if there's a Zulu OpenJDK version 8 instead of 17.


Regards,

|-|ardy


It looks like they have some updates that care about the Apple silicon. I'll look into this stuff later this year, probably.
Or, as you're a Java coder yourself, maybe you can already try it yourself and build a new "libjinput-osx.dylib" from this source?
https://github.com/LWJGL/lwjgl3




Balt

Looks like libjinput is built from https://github.com/jinput/jinput and trying to build this fails on OSX (both Monterey and Ventura), following a trail of build errors atm... will post back if I manage to resolve it.

lwjgl3 compiles fine to arm64 native.

Balt

I've reached the end of the road. Looks like lwjgl3 is sufficiently incompatible with lwjgl2 so that the calls PSX makes to the lib are failing, specifically this call:

java.lang.UnsatisfiedLinkError: 'int org.lwjgl.DefaultSysImplementation.getPointerSize()'
at org.lwjgl.DefaultSysImplementation.getPointerSize(Native Method)
at org.lwjgl.Sys.<clinit>(Sys.java:118)
at org.lwjgl.openal.AL.<clinit>(AL.java:59)
at Sound.init(Sound.java:437)
at Core.startAll(Core.java:850)
at Aerowinx.main(Aerowinx.java:65)


Tried compiling the old lwjgl2 source, but that runs into major SDK incompatibilities, i.e. cannot be built on a current gen MacOSX.sdk without major changes to the source.

BUT: jinput seems to work - or at least compile and is able to be loaded by PSX. So that's one problem solved for later this year, Hardy.

Here are my steps to compile jinput:

Install apache ant and maven3 via macports

jinput:
git clone https://github.com/jinput/jinput.git

disable error on warning by editing pom.xml:
delete
<arg>-Werror</arg>
from
<compilerArgs>

edit plugins/OSX/build.xml:

replace all instances of x86_64 with arm64

for the compileNativeJinputLib target, update arm64_sdkroot with the path to your MacOS SDK path:
property name="arm64_sdkroot" location="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"/>

for the compile target, replace
-I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
with
-I/Library/Java/JavaVirtualMachines/openjdk17-zulu/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk17-zulu/Contents/Home/include/darwin
(or whatever your installed Java flavour is)

for the link target, replace
-framework JavaVM
with
-framework JavaNativeFoundation

build it:
mvn -B -am -pl plugins/OSX/ clean compile

install it:
rm /Applications/Aerowinx/Interfaces/libjinput-osx.dylib
cp plugins/OSX/target/natives/libjinput-osx.jnilib /Applications/Aerowinx/Interfaces

For the lwjgl3 libs:

git clone https://github.com/LWJGL/lwjgl3.git
simply run ant and it'll compile everything.

install:
cp ./bin/libs/native/macos/arm64/org/lwjgl/liblwjgl.dylib /Applications/Aerowinx/Interfaces/
cp ./bin/libs/native/macos/arm64/org/lwjgl/libopenal.dylib /Applications/Aerowinx/Interfaces/

... and then run into the getPointerSize problem described above.

Hardy Heinlin

Thank you for the hints, Balt.


|-|ardy

wcursino

Does not work.

After all the steps, it didn't build the libopenal.dylib


cp: ./bin/libs/native/macos/arm64/org/lwjgl/libopenal.dylib: No such file or directory