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

java.lang.UnsatisfiedLinkError on Apple macOS Big Sur (Apple Silicon) #91

Closed
giannoug opened this issue Mar 8, 2021 · 18 comments · Fixed by #136
Closed

java.lang.UnsatisfiedLinkError on Apple macOS Big Sur (Apple Silicon) #91

giannoug opened this issue Mar 8, 2021 · 18 comments · Fixed by #136

Comments

@giannoug
Copy link

giannoug commented Mar 8, 2021

On a project with sbt-dotenv version 2.1.204, there seems to be an issue during sbt startup. I'm getting an java.lang.UnsatisfiedLinkError exception on a machine running macOS Big Sur version 11.2.2 (20D80). The same project is working on an Intel machine with the exact same OS version.

Java version of the non working machine:

openjdk 11.0.10 2021-01-19 LTS
OpenJDK Runtime Environment Zulu11.45+27-CA (build 11.0.10+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.45+27-CA (build 11.0.10+9-LTS, mixed mode)

The exception that occurs is the following:

[info] .env detected (fileName=.env). About to configure JVM System Environment with new map
java.lang.UnsatisfiedLinkError: /Users/user/Library/Caches/JNA/temp/jna3373323925107818614.tmp: dlopen(/Users/user/Library/Caches/JNA/temp/jna3373323925107818614.tmp, 1): no suitable image found.  Did find:
	/Users/user/Library/Caches/JNA/temp/jna3373323925107818614.tmp: no matching architecture in universal wrapper
	/Users/user/Library/Caches/JNA/temp/jna3373323925107818614.tmp: no matching architecture in universal wrapper
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
	at java.base/java.lang.Runtime.load0(Runtime.java:768)
	at java.base/java.lang.System.load(System.java:1837)
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
	at com.sun.jna.Native.<clinit>(Native.java:195)
	at au.com.onegeek.sbtdotenv.NativeEnvironmentManager$PosixNativeEnvironmentManagerImpl$PosixEnvironmentLibC.<clinit>(NativeEnvironmentManager.java:51)
	at au.com.onegeek.sbtdotenv.NativeEnvironmentManager$PosixNativeEnvironmentManagerImpl.<init>(NativeEnvironmentManager.java:59)
	at au.com.onegeek.sbtdotenv.NativeEnvironmentManager.getInstance(NativeEnvironmentManager.java:80)
	at au.com.onegeek.sbtdotenv.NativeEnvironmentManager.setEnv(NativeEnvironmentManager.java:87)
	at au.com.onegeek.sbtdotenv.SbtDotenv$.applyEnvironment(SbtDotenv.scala:92)
	at au.com.onegeek.sbtdotenv.SbtDotenv$.$anonfun$configureEnvironment$2(SbtDotenv.scala:75)
	at scala.Option.fold(Option.scala:251)
	at au.com.onegeek.sbtdotenv.SbtDotenv$.configureEnvironment(SbtDotenv.scala:75)
	at au.com.onegeek.sbtdotenv.SbtDotenv$autoImport$.$anonfun$dotEnv$1(SbtDotenv.scala:43)
	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
	at sbt.Project$.setProject(Project.scala:499)
	at sbt.BuiltinCommands$.doLoadProject(Main.scala:947)
	at sbt.BuiltinCommands$.$anonfun$loadProjectImpl$2(Main.scala:885)
	at sbt.Command$.$anonfun$applyEffect$4(Command.scala:150)
	at sbt.Command$.$anonfun$applyEffect$2(Command.scala:145)
	at sbt.Command$.process(Command.scala:189)
	at sbt.MainLoop$.$anonfun$processCommand$5(MainLoop.scala:243)
	at scala.Option.getOrElse(Option.scala:189)
	at sbt.MainLoop$.process$1(MainLoop.scala:243)
	at sbt.MainLoop$.processCommand(MainLoop.scala:276)
	at sbt.MainLoop$.$anonfun$next$5(MainLoop.scala:163)
	at sbt.State$StateOpsImpl$.runCmd$1(State.scala:289)
	at sbt.State$StateOpsImpl$.process$extension(State.scala:325)
	at sbt.MainLoop$.$anonfun$next$4(MainLoop.scala:163)
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
	at sbt.MainLoop$.next(MainLoop.scala:163)
	at sbt.MainLoop$.run(MainLoop.scala:144)
	at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:119)
	at sbt.io.Using.apply(Using.scala:27)
	at sbt.MainLoop$.runWithNewLog(MainLoop.scala:112)
	at sbt.MainLoop$.runAndClearLast(MainLoop.scala:66)
	at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:51)
	at sbt.MainLoop$.runLogged(MainLoop.scala:42)
	at sbt.StandardMain$.runManaged(Main.scala:191)
	at sbt.xMain$.$anonfun$run$8(Main.scala:102)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withIn(Console.scala:230)
	at sbt.internal.util.Terminal$.withIn(Terminal.scala:560)
	at sbt.internal.util.Terminal$.$anonfun$withStreams$1(Terminal.scala:350)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withOut(Console.scala:167)
	at sbt.internal.util.Terminal$.$anonfun$withOut$2(Terminal.scala:550)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withErr(Console.scala:196)
	at sbt.internal.util.Terminal$.withOut(Terminal.scala:550)
	at sbt.internal.util.Terminal$.withStreams(Terminal.scala:350)
	at sbt.xMain$.run(Main.scala:86)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at sbt.internal.XMainConfiguration.run(XMainConfiguration.scala:83)
	at sbt.xMain.run(Main.scala:46)
	at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:111)
	at xsbt.boot.Launch$.withContextLoader(Launch.scala:131)
	at xsbt.boot.Launch$.run(Launch.scala:111)
	at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:37)
	at xsbt.boot.Launch$.launch(Launch.scala:120)
	at xsbt.boot.Launch$.apply(Launch.scala:20)
	at xsbt.boot.Boot$.runImpl(Boot.scala:56)
	at xsbt.boot.Boot$.main(Boot.scala:18)
	at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.UnsatisfiedLinkError: /Users/user/Library/Caches/JNA/temp/jna3373323925107818614.tmp: dlopen(/Users/user/Library/Caches/JNA/temp/jna3373323925107818614.tmp, 1): no suitable image found.  Did find:
[error] 	/Users/user/Library/Caches/JNA/temp/jna3373323925107818614.tmp: no matching architecture in universal wrapper
[error] 	/Users/user/Library/Caches/JNA/temp/jna3373323925107818614.tmp: no matching architecture in universal wrapper
[error] Use 'last' for the full log.
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)
@Philippus
Copy link
Owner

Is it an M1 machine? Which version of sbt are you using?

@giannoug
Copy link
Author

giannoug commented Mar 8, 2021

Yes its an M1 machine and the project is using sbt 1.4.7

@nightscape
Copy link

Possibly related to java-native-access/jna#1323

@matthiasblaesing
Copy link

@nightscape from which information did you deduce, that this is related to the referenced issue in JNA? The error reports, that the native dispatch library can't be loaded. This is in line with the reported version of 2.1.204 for sbt-dotenv, which depends on JNA 5.6.0 (according to https://bintray.com/mefellows/sbt-plugins/download_file?file_path=au.com.onegeek%2Fsbt-dotenv%2Fscala_2.12%2Fsbt_1.0%2F2.1.204%2Fivys%2Fivy.xml). Given that darwin-aarch64 (the non marketing speak OS-architecture) was added in 5.7.0 this would not be surprising.

@bbatarelo
Copy link

bbatarelo commented Apr 6, 2021

Ha, I just wanted to report this same issue on SBT 1.4.9, Zulu 15 and M1. Commenting out dotenv fixes the problem, but leaves me, well, without dotenv :)

Here's a stack trace:

java.lang.UnsatisfiedLinkError: /Users/bruno/Library/Caches/JNA/temp/jna7990142068002313568.tmp: dlopen(/Users/bruno/Library/Caches/JNA/temp/jna7990142068002313568.tmp, 1): no suitable image found. Did find: /Users/bruno/Library/Caches/JNA/temp/jna7990142068002313568.tmp: no matching architecture in universal wrapper /Users/bruno/Library/Caches/JNA/temp/jna7990142068002313568.tmp: no matching architecture in universal wrapper 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:2383) at java.base/java.lang.Runtime.load0(Runtime.java:746) at java.base/java.lang.System.load(System.java:1857) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988) at com.sun.jna.Native.<clinit>(Native.java:195) at au.com.onegeek.sbtdotenv.NativeEnvironmentManager$PosixNativeEnvironmentManagerImpl$PosixEnvironmentLibC.<clinit>(NativeEnvironmentManager.java:51) at au.com.onegeek.sbtdotenv.NativeEnvironmentManager$PosixNativeEnvironmentManagerImpl.<init>(NativeEnvironmentManager.java:59) at au.com.onegeek.sbtdotenv.NativeEnvironmentManager.getInstance(NativeEnvironmentManager.java:80) at au.com.onegeek.sbtdotenv.NativeEnvironmentManager.setEnv(NativeEnvironmentManager.java:87) at au.com.onegeek.sbtdotenv.SbtDotenv$.applyEnvironment(SbtDotenv.scala:92) at au.com.onegeek.sbtdotenv.SbtDotenv$.$anonfun$configureEnvironment$2(SbtDotenv.scala:75) at scala.Option.fold(Option.scala:251) at au.com.onegeek.sbtdotenv.SbtDotenv$.configureEnvironment(SbtDotenv.scala:75) at au.com.onegeek.sbtdotenv.SbtDotenv$autoImport$.$anonfun$dotEnv$1(SbtDotenv.scala:43) at scala.Function1.$anonfun$compose$1(Function1.scala:49) at sbt.Project$.setProject(Project.scala:499) at sbt.BuiltinCommands$.doLoadProject(Main.scala:949) at sbt.BuiltinCommands$.$anonfun$loadProjectImpl$2(Main.scala:887) at sbt.Command$.$anonfun$applyEffect$4(Command.scala:150) at sbt.Command$.$anonfun$applyEffect$2(Command.scala:145) at sbt.Command$.process(Command.scala:189) at sbt.MainLoop$.$anonfun$processCommand$5(MainLoop.scala:243) at scala.Option.getOrElse(Option.scala:189) at sbt.MainLoop$.process$1(MainLoop.scala:243) at sbt.MainLoop$.processCommand(MainLoop.scala:276) at sbt.MainLoop$.$anonfun$next$5(MainLoop.scala:163) at sbt.State$StateOpsImpl$.runCmd$1(State.scala:289) at sbt.State$StateOpsImpl$.process$extension(State.scala:325) at sbt.MainLoop$.$anonfun$next$4(MainLoop.scala:163) at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23) at sbt.MainLoop$.next(MainLoop.scala:163) at sbt.MainLoop$.run(MainLoop.scala:144) at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:119) at sbt.io.Using.apply(Using.scala:27) at sbt.MainLoop$.runWithNewLog(MainLoop.scala:112) at sbt.MainLoop$.runAndClearLast(MainLoop.scala:66) at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:51) at sbt.MainLoop$.runLogged(MainLoop.scala:42) at sbt.StandardMain$.runManaged(Main.scala:193) at sbt.xMain$.$anonfun$run$8(Main.scala:102) at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) at scala.Console$.withIn(Console.scala:230) at sbt.internal.util.Terminal$.withIn(Terminal.scala:560) at sbt.internal.util.Terminal$.$anonfun$withStreams$1(Terminal.scala:350) at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) at scala.Console$.withOut(Console.scala:167) at sbt.internal.util.Terminal$.$anonfun$withOut$2(Terminal.scala:550) at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) at scala.Console$.withErr(Console.scala:196) at sbt.internal.util.Terminal$.withOut(Terminal.scala:550) at sbt.internal.util.Terminal$.withStreams(Terminal.scala:350) at sbt.xMain$.run(Main.scala:86) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at sbt.internal.XMainConfiguration.run(XMainConfiguration.scala:83) at sbt.xMain.run(Main.scala:46) at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:111) at xsbt.boot.Launch$.withContextLoader(Launch.scala:131) at xsbt.boot.Launch$.run(Launch.scala:111) at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:37) at xsbt.boot.Launch$.launch(Launch.scala:120) at xsbt.boot.Launch$.apply(Launch.scala:20) at xsbt.boot.Boot$.runImpl(Boot.scala:56) at xsbt.boot.Boot$.main(Boot.scala:18) at xsbt.boot.Boot.main(Boot.scala) [error] java.lang.UnsatisfiedLinkError: /Users/bruno/Library/Caches/JNA/temp/jna7990142068002313568.tmp: dlopen(/Users/bruno/Library/Caches/JNA/temp/jna7990142068002313568.tmp, 1): no suitable image found. Did find: [error] /Users/bruno/Library/Caches/JNA/temp/jna7990142068002313568.tmp: no matching architecture in universal wrapper [error] /Users/bruno/Library/Caches/JNA/temp/jna7990142068002313568.tmp: no matching architecture in universal wrappe

@Philippus
Copy link
Owner

Did you try the newest version? 2.1.227 ?

@bbatarelo
Copy link

Did you try the newest version? 2.1.227 ?

Yes I did, few minutes ago. Same stack trace remains.

@giannoug
Copy link
Author

giannoug commented Apr 8, 2021

Can confirm, updating to 2.1.227 doesn't fix the issue.

[info] .env detected (fileName=.env). About to configure JVM System Environment with new map
java.lang.UnsatisfiedLinkError: /Users/user/Library/Caches/JNA/temp/jna17211813352614940916.tmp: dlopen(/Users/user/Library/Caches/JNA/temp/jna17211813352614940916.tmp, 1): no suitable image found.  Did find:
	/Users/user/Library/Caches/JNA/temp/jna17211813352614940916.tmp: no matching architecture in universal wrapper
	/Users/user/Library/Caches/JNA/temp/jna17211813352614940916.tmp: no matching architecture in universal wrapper
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
	at java.base/java.lang.Runtime.load0(Runtime.java:768)
	at java.base/java.lang.System.load(System.java:1837)
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
	at com.sun.jna.Native.<clinit>(Native.java:195)
	at au.com.onegeek.sbtdotenv.NativeEnvironmentManager$PosixNativeEnvironmentManagerImpl$PosixEnvironmentLibC.<clinit>(NativeEnvironmentManager.java:51)
	at au.com.onegeek.sbtdotenv.NativeEnvironmentManager$PosixNativeEnvironmentManagerImpl.<init>(NativeEnvironmentManager.java:59)
	at au.com.onegeek.sbtdotenv.NativeEnvironmentManager.getInstance(NativeEnvironmentManager.java:80)
	at au.com.onegeek.sbtdotenv.NativeEnvironmentManager.setEnv(NativeEnvironmentManager.java:87)
	at au.com.onegeek.sbtdotenv.SbtDotenv$.applyEnvironment(SbtDotenv.scala:92)
	at au.com.onegeek.sbtdotenv.SbtDotenv$.$anonfun$configureEnvironment$2(SbtDotenv.scala:75)
	at scala.Option.fold(Option.scala:251)
	at au.com.onegeek.sbtdotenv.SbtDotenv$.configureEnvironment(SbtDotenv.scala:75)
	at au.com.onegeek.sbtdotenv.SbtDotenv$autoImport$.$anonfun$dotEnv$1(SbtDotenv.scala:43)
	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
	at sbt.Project$.setProject(Project.scala:499)
	at sbt.BuiltinCommands$.doLoadProject(Main.scala:949)
	at sbt.BuiltinCommands$.$anonfun$loadProjectImpl$2(Main.scala:887)
	at sbt.Command$.$anonfun$applyEffect$4(Command.scala:150)
	at sbt.Command$.$anonfun$applyEffect$2(Command.scala:145)
	at sbt.Command$.process(Command.scala:189)
	at sbt.MainLoop$.$anonfun$processCommand$5(MainLoop.scala:243)
	at scala.Option.getOrElse(Option.scala:189)
	at sbt.MainLoop$.process$1(MainLoop.scala:243)
	at sbt.MainLoop$.processCommand(MainLoop.scala:276)
	at sbt.MainLoop$.$anonfun$next$5(MainLoop.scala:163)
	at sbt.State$StateOpsImpl$.runCmd$1(State.scala:289)
	at sbt.State$StateOpsImpl$.process$extension(State.scala:325)
	at sbt.MainLoop$.$anonfun$next$4(MainLoop.scala:163)
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
	at sbt.MainLoop$.next(MainLoop.scala:163)
	at sbt.MainLoop$.run(MainLoop.scala:144)
	at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:119)
	at sbt.io.Using.apply(Using.scala:27)
	at sbt.MainLoop$.runWithNewLog(MainLoop.scala:112)
	at sbt.MainLoop$.runAndClearLast(MainLoop.scala:66)
	at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:51)
	at sbt.MainLoop$.runLogged(MainLoop.scala:42)
	at sbt.StandardMain$.runManaged(Main.scala:193)
	at sbt.xMain$.$anonfun$run$8(Main.scala:102)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withIn(Console.scala:230)
	at sbt.internal.util.Terminal$.withIn(Terminal.scala:560)
	at sbt.internal.util.Terminal$.$anonfun$withStreams$1(Terminal.scala:350)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withOut(Console.scala:167)
	at sbt.internal.util.Terminal$.$anonfun$withOut$2(Terminal.scala:550)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withErr(Console.scala:196)
	at sbt.internal.util.Terminal$.withOut(Terminal.scala:550)
	at sbt.internal.util.Terminal$.withStreams(Terminal.scala:350)
	at sbt.xMain$.run(Main.scala:86)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at sbt.internal.XMainConfiguration.run(XMainConfiguration.scala:83)
	at sbt.xMain.run(Main.scala:46)
	at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:111)
	at xsbt.boot.Launch$.withContextLoader(Launch.scala:131)
	at xsbt.boot.Launch$.run(Launch.scala:111)
	at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:37)
	at xsbt.boot.Launch$.launch(Launch.scala:120)
	at xsbt.boot.Launch$.apply(Launch.scala:20)
	at xsbt.boot.Boot$.runImpl(Boot.scala:56)
	at xsbt.boot.Boot$.main(Boot.scala:18)
	at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.UnsatisfiedLinkError: /Users/user/Library/Caches/JNA/temp/jna17211813352614940916.tmp: dlopen(/Users/user/Library/Caches/JNA/temp/jna17211813352614940916.tmp, 1): no suitable image found.  Did find:
[error] 	/Users/user/Library/Caches/JNA/temp/jna17211813352614940916.tmp: no matching architecture in universal wrapper
[error] 	/Users/user/Library/Caches/JNA/temp/jna17211813352614940916.tmp: no matching architecture in universal wrapper
[error] Use 'last' for the full log.
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)

@nkgm
Copy link

nkgm commented Jul 26, 2021

This is fixed in jna-5.8.0, and even though sbt-dotenv is trying to use the latest version, sbt itself is on the older jna-5.5.0, so I'm guessing this is the cause of the problem.

If you don't mind a little hackery, you can hunt down sbt's own jna-5.5.0.jar and jna-platform-5.5.0.jar (in my case found under $HOME/.sbt/boot/scala-2.12.14/org.scala-sbt/sbt/1.5.5 and replace them with the latest jars found here.

@nikospara
Copy link

nikospara commented Sep 2, 2021

Picking up from nkgm's comment, I think there is a cleaner solution: use the jna.boot.library.path configuration option (ref). This option lets you override the actual JNA jar used.

You have 2 options:

  • Set on each execution: this is local and affects only the JVM you are running. To use, simply add -Djna.boot.library.path=/path/to/libjnidispatch.jnilib to the Java command line (before the main class name of course). Several programs (e.g. servers) let you define special environment variables (e.g. JAVA_OPTS), you can utilize these.
  • Set globally: on my M1 I had to add the line export _JAVA_OPTIONS=-Djna.boot.library.path=/path/to/lib to ~/.bashrc (and make sure ~/.bash_profile is actually using it, e.g. contains the line . ~/.bashrc). Log out and back in and it is generally accessible, even from within IDEs (at least my installation of IntelliJ is picking it up, both from the sbt shell and when running programs directly).

To obtain the libjnidispatch.jnilib:

  1. First download jna-X.Y.Z.jar from the link nkgm provided
  2. Extract its contents somewhere (jar -xf jna-X.Y.Z.jar)
  3. Move com/sun/jna/darwin-aarch64/libjnidispatch.jnilib to a directory of your choice - the /path/to/lib above.

(thanks to mbablok for pointing out that we need the directory here, not the path to the file)

@mbablok
Copy link

mbablok commented Sep 15, 2021

@nikospara The solution works nice on multiple sbt versions, but the jna.boot.library.path should be a path to a directory containing the jnilib file, and not the file. But thanks anyway, quite helpful.

@nikospara
Copy link

@mbablok Yes, thank you! Correcting it!

@mkurz
Copy link

mkurz commented Nov 12, 2021

Does sbt 1.6.0-M1 fix this problem?

@guizmaii
Copy link

guizmaii commented Nov 22, 2021

Just experienced this issue on an M1 Mac.

I'm using sbt 1.5.5 which is supposed to work on M1. When I remove this plugin from my sbt build, my build is working again.

@suliatis
Copy link

I’m using sbt 1.6.1 and sbt dotenv works flawlessly on Apple silicon since I upgraded

@deepakkumarnd
Copy link

Upgrading to sbt 1.6.1 fixed this issue for me

@goens
Copy link

goens commented Apr 26, 2022

I'm having the issue with sbt 1.6.2 (also M1, running MacOS 12.1)

@ccnlui
Copy link

ccnlui commented Apr 28, 2022

replacing 5.5.0 with 5.11.0 solved this problem for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.