fusesource / jansi

Jansi is a small java library that allows you to use ANSI escape sequences to format your console output which works even on windows.
http://fusesource.github.io/jansi/
Apache License 2.0
1.11k stars 140 forks source link

Support Windows on ARM #238

Closed rubin55 closed 1 year ago

rubin55 commented 2 years ago

When jansi is invoked on Windows (11) on ARM64, I get an exception, probably due to the os.arch and os.name combination not being anticipated:

jshell> System.getProperty("os.name");
$2 ==> "Windows 11"
jshell> System.getProperty("os.arch");
$3 ==> "aarch64"

Could you add support for Windows on ARM in Jansi?

PS: the exception I got (through sbt 1.6.2, which uses Jansi 2.1.0):

sbt
May 09, 2022 10:13:54 PM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
java.lang.NoClassDefFoundError: Could not initialize class org.fusesource.jansi.internal.Kernel32
        at sbt.internal.util.WindowsSupport$.getConsoleMode(WindowsInputStream.scala:20)
        at sbt.internal.util.JLine3$.setEnableProcessInput(JLine3.scala:234)
        at sbt.internal.util.JLine3$.enterRawMode(JLine3.scala:244)
        at sbt.internal.util.Terminal$ConsoleTerminal.enterRawMode(Terminal.scala:861)
        at sbt.internal.util.Terminal$ConsoleTerminal.<init>(Terminal.scala:820)
        at sbt.internal.util.Terminal$.newConsoleTerminal(Terminal.scala:758)
        at sbt.internal.util.Terminal$.withStreams(Terminal.scala:346)
        at sbt.xMain$.withStreams$1(Main.scala:87)
        at sbt.xMain$.run(Main.scala:121)
        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.java:57)
        at sbt.xMain.run(Main.scala:46)
        at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
        at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
        at xsbt.boot.Launch$.run(Launch.scala:149)
        at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
        at xsbt.boot.Launch$.launch(Launch.scala:159)
        at xsbt.boot.Launch$.apply(Launch.scala:44)
        at xsbt.boot.Launch$.apply(Launch.scala:21)
        at xsbt.boot.Boot$.runImpl(Boot.scala:78)
        at xsbt.boot.Boot$.run(Boot.scala:73)
        at xsbt.boot.Boot$.main(Boot.scala:21)
        at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.lang.NoClassDefFoundError: Could not initialize class org.fusesource.jansi.internal.Kernel32

Note: I'm not 100% sure if the os.name/os.arch combination is at play here, or if sbt itself is doing something funny on this platform. A relevant issue on the sbt project is: https://github.com/sbt/sbt/issues/5495

gnodet commented 2 years ago

There's a windows-arm64 cross build platform that we should be able to use in the makefile.

gnodet commented 2 years ago

@rubin55 could you build jansi with https://github.com/fusesource/jansi/pull/240 and see if that works for you ? I don't have access to such a platform...

rubin55 commented 2 years ago

@gnodet I would like to, but not sure how; Do you have a quick howto build Jansi on Windows? Do I understand correctly that a Jansi release would contain binary artifacts (dll's, so's) and that other projects would include a version of Jansi that then supports X number of platforms by way of such a binary artifact?

imkiva commented 1 year ago

could you build jansi with #240 and see if that works for you ? I don't have access to such a platform...

I tried #240 on my Windows ARM device. It works like a charm! Here's what I do to build the project:

$ make native-all # or just make win-arm64
$ mvn install

Would like to see #240 get merged so I won't need a maven local repository to use jansi with Windows ARM support! Thank you for the port! ❤️

gnodet commented 1 year ago

could you build jansi with #240 and see if that works for you ? I don't have access to such a platform...

I tried #240 on my Windows ARM device. It works like a charm! Here's what I do to build the project:

$ make native-all # or just make win-arm64
$ mvn install

Would like to see #240 get merged so I won't need a maven local repository to use jansi with Windows ARM support! Thank you for the port! ❤️

Awesome, that PR needed a confirmation !