Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS ARM support #124

Open
1 of 2 tasks
JustASpareAccount opened this issue Nov 20, 2024 · 3 comments
Open
1 of 2 tasks

MacOS ARM support #124

JustASpareAccount opened this issue Nov 20, 2024 · 3 comments
Labels
dependencies Pull requests that update a dependency file /framework Base components

Comments

@JustASpareAccount
Copy link

JustASpareAccount commented Nov 20, 2024

Description
Add support for MacOS ARM chips by adding ARM-compatible dylibs to the builds

Additional context
When launching the current jar on macOS ARM computers, you get this error:

** Uncaught Exception! **
java.lang.UnsatisfiedLinkError: /Users/myuser/opsu/Natives/liblwjgl.dylib: dlopen(/Users/myuser/opsu/Natives/liblwjgl.dylib, 0x0001): tried: '/Users/myuser/opsu/Natives/liblwjgl.dylib' (fat file, but missing compatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/myuser/opsu/Natives/liblwjgl.dylib' (no such file), '/Users/myuser/opsu/Natives/liblwjgl.dylib' (fat file, but missing compatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2418)
	at java.base/java.lang.Runtime.load0(Runtime.java:852)
	at java.base/java.lang.System.load(System.java:2025)
	at org.lwjgl.Sys$1.run(Sys.java:70)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
	at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
	at org.lwjgl.Sys.loadLibrary(Sys.java:96)
	at org.lwjgl.Sys.<clinit>(Sys.java:117)
	at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
	at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
	at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
	at itdelatrisu.opsu.Opsu.main(Opsu.java:182)

Help?
Do you want to implement this feature by yourself? Put a X in either of the checkboxes below.

  • Yes
  • No
@CloneWith CloneWith added dependencies Pull requests that update a dependency file /framework Base components labels Nov 21, 2024
@JustASpareAccount
Copy link
Author

UPDATE:

By replacing the dylib with one from here, i got it to run on my m1 mac. It is now just a matter of including it in the bundle.

@CloneWith
Copy link
Owner

Hi,
I've just updated the dynamic library in a new branch. You can try that out and see if it works (I don't have a Mac device).

@JustASpareAccount
Copy link
Author

JustASpareAccount commented Jan 3, 2025

I tried out mvn compile, and got this error:

** Uncaught Exception! **
java.lang.UnsatisfiedLinkError: /Users/myuser/Downloads/opsu-dependency-macos/target/natives/liblwjgl.dylib: dlopen(/Users/myuser/Downloads/opsu-dependency-macos/target/natives/liblwjgl.dylib, 0x0001): tried: '/Users/myuser/Downloads/opsu-dependency-macos/target/natives/liblwjgl.dylib' (fat file, but missing compatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/myuser/Downloads/opsu-dependency-macos/target/natives/liblwjgl.dylib' (no such file), '/Users/myuser/Downloads/opsu-dependency-macos/target/natives/liblwjgl.dylib' (fat file, but missing compatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2418)
	at java.base/java.lang.Runtime.load0(Runtime.java:852)
	at java.base/java.lang.System.load(System.java:2025)
	at org.lwjgl.Sys$1.run(Sys.java:70)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
	at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
	at org.lwjgl.Sys.loadLibrary(Sys.java:96)
	at org.lwjgl.Sys.<clinit>(Sys.java:117)
	at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
	at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
	at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
	at itdelatrisu.opsu.Opsu.main(Opsu.java:183)

That shouldn't be happening because the dylib is arm64, but it is somehow extracting the x86_64 dylib. If you want, you could just consider it fixed since the workaround of replacing the dylib still works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file /framework Base components
Projects
None yet
Development

No branches or pull requests

2 participants