apache / maven-mvnd

Apache Maven Daemon
https://maven.apache.org/
Apache License 2.0
2.91k stars 207 forks source link

java.lang.UnsatisfiedLinkError: Can't load library: jansi.dll #793

Open tbw777 opened 1 year ago

tbw777 commented 1 year ago

1.0.0M4/0.9.0 win10

c:\mvnd\bin\mvnd Failed to load native library:jansi-2.4.0-e1397af186a04a92-jansi.dll. osinfo: Windows/x86_64 java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\A4F7~1\AppData\Local\Temp\jansi-2.4.0-e1397af186a04a92-jansi.dll Exception in thread "main" java.lang.UnsatisfiedLinkError: org.fusesource.jansi.internal.CLibrary.isatty(I)I [symbol: Java_org_fusesource_jansi_internal_CLibrary_isatty or Java_org_fusesource_jansi_internal_CLibrary_isatty__I] at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:152) at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:53) at org.fusesource.jansi.internal.CLibrary.isatty(CLibrary.java) at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:102)

psiroky commented 1 year ago

I wasn't able to reproduce this on my Win 10 Pro (Version: 22H2, Build: 19045.2673). I tried both the default "terminal" app and PowerShell. Both seem to be working fine.

Are you maybe using WSL/Mingw/Cygwin or something similar? Or is there anything else that could be specific to your environment?

theit commented 1 year ago

I guess I have seen a similar behavior when extracting the .tar.gz for Maven 3.8.x/3.9.x from within Git Bash in Windows. For some reasons the execute bit was not set on the jansi.dll when I looked into the directory from within Bash. I had to execute chmod +x <maven>/lib/jansi-native/Windows/x86*/jansi.dll" then it worked (again). Unfortunately I cannot reproduce this...

psiroky commented 1 year ago

TLDR: I wasn't able to reproduce this via Git Bash either.

Longer version: I installed Git Bash (from https://git-scm.com/download/win - version 2.39.2) and then unzipped the mvnd-0.9.0 archive using unzip in the Git Bash directly (instead of Windows explorer -- just in case this could have some influence on the execute bit). However, I still could not reproduce the issue. The execute bit for jansi.dll was set and the mvnd client did start-up.

I did see the same WARN as in https://github.com/apache/maven-mvnd/issues/786, but that seems unrelated to this specific issue.

gnodet commented 1 year ago

TLDR: I wasn't able to reproduce this via Git Bash either.

Longer version: I installed Git Bash (from https://git-scm.com/download/win - version 2.39.2) and then unzipped the mvnd-0.9.0 archive using unzip in the Git Bash directly (instead of Windows explorer -- just in case this could have some influence on the execute bit). However, I still could not reproduce the issue. The execute bit for jansi.dll was set and the mvnd client did start-up.

I did see the same WARN as in #786, but that seems unrelated to this specific issue.

It may be related. Isn't the exception the root cause of the warning, which is definitely wrong and mvnd which ships with jansi should not start a dumb jline terminal in a plain windows console, with or without gitbash.

psiroky commented 1 year ago

It may be related. Isn't the exception the root cause of the warning, which is definitely wrong and mvnd which ships with jansi should not start a dumb jline terminal in a plain windows console, with or without gitbash.

My windows knowledge is pretty rusty, but I think gitbash is a a sort of alternative to the plain windows console, with more unix-like features (I may be wrong here as this is my first time playing with gitbash).

From the above bug description, I assumed mvnd does not work at all. With gitbash it seems to work (daemon is started, and at leat mvnd --version returned what I would expect), but it starts a dumb terminal for some reason.

gnodet commented 1 year ago

I've merged some enhancements which will enable more logging. Could someone download a build from https://github.com/apache/maven-mvnd/actions/runs/4386402864 and run the following command:

MVND_CLIENT=jvm MAVEN_OPTS="-DconsoleLevel=debug" bin/mvnd.sh -v

This should give much more informtation than before.

psiroky commented 1 year ago

I think we should move the discussion to the other issue #786, since that specifically reports the warning about dumb terminal.

tbw777 commented 1 year ago

cmd.exe

1.0m6

C:\Users\Андрей>c:\mvnd\bin\mvnd.cmd -v Failed to load native library:jansi-2.4.0-7a1b3e95bab9e2b8-jansi.dll. osinfo: Windows/x86_64 java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\A4F7~1\AppData\Local\Temp\jansi-2.4.0-7a1b3e95bab9e2b8-jansi.dll Exception in thread "main" java.lang.UnsatisfiedLinkError: org.fusesource.jansi.internal.CLibrary.isatty(I)I [symbol: Java_org_fusesource_jansi_internal_CLibrary_isatty or Java_org_fusesource_jansi_internal_CLibrary_isatty__I] at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:152) at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:53) at org.fusesource.jansi.internal.CLibrary.isatty(CLibrary.java) at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:103)

gnodet commented 1 year ago

This looks like a jansi problem, see https://github.com/fusesource/jansi/issues/245 and https://issues.apache.org/jira/browse/MNG-7245. A workaround is to specify an alternative directory using jansi.tmpdir system property.