java.lang.UnsatisfiedLinkError when starting the play project
Asked Answered
H

1

6

Im trying to start a project on play in IntelliJ IDEA Ultimate MacBook Pro on M1, I get the following error in the console:

[error] java.lang.UnsatisfiedLinkError: /Users/username/Library/Caches/JNA/temp/jna2878211531869408345.tmp: dlopen(/Users/username/Library/Caches/JNA/temp/jna2878211531869408345.tmp, 0x0001): tried: '/Users/username/Library/Caches/JNA/temp/jna2878211531869408345.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna2878211531869408345.tmp' (no such file)

I tried to reinstall the JDK on the arm architecture after deleting all the JDKs, it did not help

What needs to be tricked to fix this?

Full StackTrace:

[error] java.lang.UnsatisfiedLinkError: /Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp: dlopen(/Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp, 0x0001): tried: '/Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna2878211531869408345.tmp' (no such file)
    [error]     at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
    [error]     at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
    [error]     at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
    [error]     at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
    [error]     at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
    [error]     at java.base/java.lang.Runtime.load0(Runtime.java:768)
    [error]     at java.base/java.lang.System.load(System.java:1837)
    [error]     at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
    [error]     at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
    [error]     at com.sun.jna.Native.<clinit>(Native.java:195)
    [error]     at io.methvin.watchservice.jna.CarbonAPI.<clinit>(CarbonAPI.java:19)
    [error]     at io.methvin.watchservice.jna.CFStringRef.toCFString(CFStringRef.java:23)
    [error]     at io.methvin.watchservice.MacOSXListeningWatchService.register(MacOSXListeningWatchService.java:101)
    [error]     at io.methvin.watchservice.WatchablePath.register(WatchablePath.java:50)
    [error]     at io.methvin.watcher.DirectoryWatcher.register(DirectoryWatcher.java:352)
    [error]     at io.methvin.watcher.DirectoryWatcher.registerAll(DirectoryWatcher.java:317)
    [error]     at io.methvin.watcher.DirectoryWatcher.<init>(DirectoryWatcher.java:167)
    [error]     at io.methvin.watcher.DirectoryWatcher$Builder.build(DirectoryWatcher.java:118)
    [error]     at play.dev.filewatch.DefaultFileWatchService.watch(DefaultFileWatchService.scala:38)
    [error]     at play.dev.filewatch.FileWatchService$$anon$1.watch(FileWatchService.scala:87)
    [error]     at play.runsupport.Reloader.<init>(Reloader.scala:414)
    [error]     at play.runsupport.Reloader$.reloader$lzycompute$1(Reloader.scala:259)
    [error]     at play.runsupport.Reloader$.play$runsupport$Reloader$$reloader$1(Reloader.scala:251)
    [error]     at play.runsupport.Reloader$.startDevMode(Reloader.scala:271)
    [error]     at play.sbt.run.PlayRun$.devModeServer$lzycompute$1(PlayRun.scala:99)
    [error]     at play.sbt.run.PlayRun$.devModeServer$1(PlayRun.scala:83)
    [error]     at play.sbt.run.PlayRun$.$anonfun$playRunTask$3(PlayRun.scala:106)
    [error]     at play.sbt.run.PlayRun$.$anonfun$playRunTask$3$adapted(PlayRun.scala:68)
    [error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
    [error] stack trace is suppressed; run 'last Compile / run' for the full output
    [error] (Compile / run) java.lang.UnsatisfiedLinkError: /Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp: dlopen(/Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp, 0x0001): tried: '/Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna2878211531869408345.tmp' (no such file)
Harman answered 24/2, 2022 at 13:47 Comment(4)
Make sure you're using JDK build for M1. Then set Idea to use correct JDK in Project settingsMacmacabre
@IvanStanislavciuc, Assembly JDK for the architecture you need, checked many timesHarman
to check architecture of your jdk. run jshell and then System.getProperty("os.arch"). It should say aarch64Macmacabre
@IvanStanislavciuc jshell> System.getProperty("os.arch") $1 ==> "aarch64"Harman
H
10

Found a solution: Inside sbt 1.4.6 there is a JNA library version 5.5.0, which apparently does not have the necessary files for the arm64 architecture processor Raising the sbt version to 1.6.2 helped

Harman answered 25/2, 2022 at 4:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.