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

mill -i crashes in Windows terminal on arm64 #4055

Open
lihaoyi opened this issue Nov 30, 2024 · 7 comments
Open

mill -i crashes in Windows terminal on arm64 #4055

lihaoyi opened this issue Nov 30, 2024 · 7 comments

Comments

@lihaoyi
Copy link
Member

lihaoyi commented Nov 30, 2024

Error below. Non--i seems to work fine

PS C:\Users\haoyi\mill-1> ./mill -i version
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [java.lang.LinkageError: Unable to load library jansi, java.lang.LinkageError: Unable to load library from C:\Users\haoyi\AppData\Local\Temp\jansi-93fa3188adb8407f81dad04d08abc8192e4e380d.dll, java.lang.LinkageError: Unable to load library from C:\Users\haoyi\.hawtjni\jansi\jansi-93fa3188adb8407f81dad04d08abc8192e4e380d.dll]
        at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:233)
        at org.fusesource.hawtjni.runtime.Library.load(Library.java:185)
        at org.fusesource.jansi.internal.Kernel32.<clinit>(Kernel32.java:37)
        at io.github.alexarchambault.windowsansi.WindowsAnsi.setup(WindowsAnsi.java:31)
        at mill.runner.MillMain$.$anonfun$main$1(MillMain.scala:72)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at mill.api.SystemStreams$.withTopLevelSystemStreamProxy(SystemStreams.scala:125)
        at mill.runner.MillMain$.main(MillMain.scala:41)
        at mill.runner.MillMain.main(MillMain.scala)
        Suppressed: java.lang.LinkageError: Unable to load library jansi
                at org.fusesource.hawtjni.runtime.Library.loadLibrary(Library.java:539)
                at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:217)
                ... 8 more
        Caused by: java.lang.UnsatisfiedLinkError: no jansi in java.library.path: C:\Program Files\Eclipse Adoptium\jdk-21.0.5.11-hotspot\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Eclipse Adoptium\jdk-21.0.5.11-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\haoyi\AppData\Local\Microsoft\WindowsApps;;.
                at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2458)
                at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
                at java.base/java.lang.System.loadLibrary(System.java:2063)
                at org.fusesource.hawtjni.runtime.Library.loadLibrary(Library.java:535)
                ... 9 more
        Suppressed: java.lang.LinkageError: Unable to load library from C:\Users\haoyi\AppData\Local\Temp\jansi-93fa3188adb8407f81dad04d08abc8192e4e380d.dll
                at org.fusesource.hawtjni.runtime.Library.load(Library.java:526)
                at org.fusesource.hawtjni.runtime.Library.extractAndLoad(Library.java:330)
                at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:227)
                ... 8 more
        Caused by: java.lang.UnsatisfiedLinkError: C:\Users\haoyi\AppData\Local\Temp\jansi-93fa3188adb8407f81dad04d08abc8192e4e380d.dll: Can't load AMD 64-bit .dll on a ARM 64-bit platform
                at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
                at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
                at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
                at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
                at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2418)
                at java.base/java.lang.Runtime.load0(Runtime.java:852)
                at java.base/java.lang.System.load(System.java:2025)
                at org.fusesource.hawtjni.runtime.Library.load(Library.java:522)
                ... 10 more
        Suppressed: java.lang.LinkageError: Unable to load library from C:\Users\haoyi\.hawtjni\jansi\jansi-93fa3188adb8407f81dad04d08abc8192e4e380d.dll
                at org.fusesource.hawtjni.runtime.Library.load(Library.java:526)
                at org.fusesource.hawtjni.runtime.Library.extractAndLoad(Library.java:330)
                at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:227)
                ... 8 more
        Caused by: java.lang.UnsatisfiedLinkError: C:\Users\haoyi\.hawtjni\jansi\jansi-93fa3188adb8407f81dad04d08abc8192e4e380d.dll: Can't load AMD 64-bit .dll on a ARM 64-bit platform
                at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
                at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
                at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
                at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
                at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2418)
                at java.base/java.lang.Runtime.load0(Runtime.java:852)
                at java.base/java.lang.System.load(System.java:2025)
                at org.fusesource.hawtjni.runtime.Library.load(Library.java:522)
                ... 10 more
PS C:\Users\haoyi\mill-1>
@lihaoyi
Copy link
Member Author

lihaoyi commented Nov 30, 2024

Seems related to fusesource/jansi#238

@lihaoyi
Copy link
Member Author

lihaoyi commented Nov 30, 2024

A naive attempt at a fix changes the error but it still crashes

PS C:\Users\haoyi\mill-1>  C:\Users\haoyi\.cache\mill\download\0.12.2-90-4593a7-DIRTY765eeafc.bat -i version
Exception in thread "main" java.lang.UnsatisfiedLinkError: 'long org.fusesource.jansi.internal.Kernel32.GetStdHandle(int)'
        at org.fusesource.jansi.internal.Kernel32.GetStdHandle(Native Method)
        at io.github.alexarchambault.windowsansi.WindowsAnsi.setup(WindowsAnsi.java:31)
        at mill.runner.MillMain$.$anonfun$main$1(MillMain.scala:72)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at mill.api.SystemStreams$.withTopLevelSystemStreamProxy(SystemStreams.scala:125)
        at mill.runner.MillMain$.main(MillMain.scala:41)
        at mill.runner.MillMain.main(MillMain.scala)
PS C:\Users\haoyi\mill-1> git diff
diff --git a/build.mill b/build.mill
index 9e0199980f..e8d145121c 100644
--- a/build.mill
+++ b/build.mill
@@ -139,6 +139,7 @@ object Deps {
   )

   val jline = ivy"org.jline:jline:3.27.1"
+  val jansi = ivy"org.fusesource.jansi:jansi:2.4.1"
   val jnaVersion = "5.15.0"
   val jna = ivy"net.java.dev.jna:jna:${jnaVersion}"
   val jnaPlatform = ivy"net.java.dev.jna:jna-platform:${jnaVersion}"
diff --git a/runner/package.mill b/runner/package.mill
index 9dc3f21f7c..14afb13d1d 100644
--- a/runner/package.mill
+++ b/runner/package.mill
@@ -9,6 +9,9 @@ object `package` extends RootModule with build.MillPublishScalaModule {
     def moduleDeps = Seq(build.main.client)
   }

+  def ivyDeps = Agg(
+    build.Deps.jansi
+  )
   def moduleDeps = Seq(
     build.scalalib,
     build.kotlinlib,

@alexarchambault might need your help here, since the crash is upstream in io.github.alexarchambault.windowsansi.WindowsAnsi.setup

@lihaoyi
Copy link
Member Author

lihaoyi commented Nov 30, 2024

also see alexarchambault/windows-ansi#106

@alexarchambault
Copy link
Contributor

Feel free to disable the call to this library on ARM64. I'd like to try the changes of the PR that fixes that in alexarchambault/windows-ansi on an actual Windows ARM64 VM. I should be able to tomorrow or Monday I think

@lihaoyi
Copy link
Member Author

lihaoyi commented Nov 30, 2024

Sounds good. No hurry, presumably its been broken for months/years so we can our time fixing it for the next release

lihaoyi added a commit that referenced this issue Dec 2, 2024
Was meant to land in #4053 but
got lost in the merge

This hardcoding is just a hack until
#4055 is resolved
@alexarchambault
Copy link
Contributor

FYI windows-ansi 0.0.6, with a fix for that, has been released

@lihaoyi
Copy link
Member Author

lihaoyi commented Dec 23, 2024

Thanks Alex, will try it out when I next have access to my windows laptop

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

No branches or pull requests

2 participants