oyvindberg / tui-scala

Beautiful Text-based User Interfaces for Scala
MIT License
207 stars 11 forks source link

When building with native-image having library link issue java.lang.UnsatisfiedLinkError: #68

Open dejvid opened 1 month ago

dejvid commented 1 month ago

I have constructed a simple empty project using just a few cross term functions. When I try to build it with the native image, it compiles. But when I run the app, I get the following error:

Exception in thread "main" java. Lang.UnsatisfiedLinkError: Native library libnative-arm64-darwin-crossterm.dylib (/libnative-arm64-darwin-crossterm.dylib) cannot be found on the classpath.
        At tui.crossterm.NativeLoader.loadPackaged(NativeLoader.java:20)
        at tui.crossterm.NativeLoader.load(NativeLoader.java:11)
        at tui.crossterm.CrosstermJni.<clinit>(CrosstermJni.java:9)
        at tui.withTerminal$.apply(withTerminal.scala:6)
        at org.tui.main$package$.main(main.scala:166)
        at org.tui.main.main(main.scala:18)
        at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

I am on an M1 Mac. When I build it with a native image, Should I pass some particular native-image parameters? Or is this a library issue?

By the way, If I run the app through JVM, it works; the library is loaded. I have tried to run the bleep gen-native-image on the tui-scala project, and there seem to be no such issues running the demo native build.

oyvindberg commented 1 month ago

did you do this?