darklaf: Error installing Darklaf theme on M1 Mac
Describe the bug On the M1 Mac architecture(aarch64), installing Darklaf themes throws an error about wrong architecture with libdarklaf-macos.dylib
To Reproduce
- Have a M1 mac
- Install a Darklaf theme with LafManager
Additional Information:
- OS: macOS
- OS Version: 11.4
- Darklaf Version: 2.6.1
Additional context Relevant stacktrace from my application, TachideskJUI
[2021-06-23 16:15:36] [SEVERE] Could not load library libdarklaf-macos.dylib. [at com.github.weisj.darklaf.platform.AbstractLibrary]
java.lang.UnsatisfiedLinkError: /private/var/folders/1z/t2wrxhz96h302wmq1vd52wpw0000gn/T/nativeutils177379658590417912731646977618469/libdarklaf-macos.dylib: dlopen(/private/var/folders/1z/t2wrxhz96h302wmq1vd52wpw0000gn/T/nativeutils177379658590417912731646977618469/libdarklaf-macos.dylib, 1): no suitable image found. Did find:
/private/var/folders/1z/t2wrxhz96h302wmq1vd52wpw0000gn/T/nativeutils177379658590417912731646977618469/libdarklaf-macos.dylib: mach-o, but wrong architecture
/private/var/folders/1z/t2wrxhz96h302wmq1vd52wpw0000gn/T/nativeutils177379658590417912731646977618469/libdarklaf-macos.dylib: mach-o, but wrong architecture
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2407)
at java.base/java.lang.Runtime.load0(Runtime.java:747)
at java.base/java.lang.System.load(System.java:1857)
at com.github.weisj.darklaf.platform.NativeUtil.loadLibraryFromJar(NativeUtil.java:103)
at com.github.weisj.darklaf.platform.AbstractLibrary.loadLibrary(AbstractLibrary.java:60)
at com.github.weisj.darklaf.platform.AbstractLibrary.updateLibrary(AbstractLibrary.java:48)
at com.github.weisj.darklaf.platform.macos.MacOSDecorationsProvider.initialize(MacOSDecorationsProvider.java:49)
at com.github.weisj.darklaf.platform.DecorationsHandler.initialize(DecorationsHandler.java:99)
at com.github.weisj.darklaf.DarkLaf.setupDecorations(DarkLaf.java:131)
at com.github.weisj.darklaf.DarkLaf.initialize(DarkLaf.java:123)
at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:586)
at com.github.weisj.darklaf.LafInstaller.install(LafInstaller.java:48)
at com.github.weisj.darklaf.LafManager.install(LafManager.java:438)
at com.github.weisj.darklaf.LafManager.installTheme(LafManager.java:419)
at com.github.weisj.darklaf.LafManager.install(LafManager.java:429)
at ca.gosyer.ui.main.MainKt$main$1$1.invokeSuspend(main.kt:92)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 32 (18 by maintainers)
Commits related to this issue
- Dont attempt to use Darklaf on Mac — committed to Suwayomi/Tachidesk-JUI by Syer10 3 years ago
- NativeLibs: Check whether the corresponding native library can be loaded, when selecting the decorations provider. To do this properly we add new flags to SystemInfo indicating whether the current ar... — committed to weisJ/darklaf by weisJ 3 years ago
And the packaged build works perfect as well, I would say you have got M1 support complete!
I totally overlooked the fact that the
JavaNativeFoundationpath in your Jak isJavaNativeFoundation.framework/JavaNativeFoundationinstead of the usualJavaNativeFoundation.framework/Versions/A/JavaNativeFoundation(which is the path attempted to be loaded). Now I only have to figure out how to change the installation path of the framework in the binary and we should be good.Well at least it is now loading the packaged framework 😅. I think the problem is that the framework I am loading has the same name as the one inside the jdk, which trips the linker. So back to the drawing board it is. I can see two possibilities here:
It seems like that JavaNativeFoundation has been deprecated for arm64. I’ll probably include the framework myself then (it isn’t that large to begin with)