amp
amp copied to clipboard
[question] windows support?
will this project support windows?
@hh9527 I haven't given it a shot! 😄 I've tried to leverage the Rust stdlib in a platform-agnostic way whenever possible, but I don't use Windows myself, so it hasn't been a priority to date.
I haven't read the code, but I found
rustbox = "0.9.0"
termion = { git = "https://github.com/jmacdonald/termion", branch = "esc" }
in Cargo.toml, these two crates does not support windows for now.
I'd be interested in using this on Windows, too!
I'm certainly not opposed to supporting Windows, but I haven't got a Windows machine handy to help make that happen. Given that the two terminal libraries don't support it, though, there's probably a fair amount of work to support it.
I think WSL support would be a good start, and I can't imagine why that wouldn't work out of the box. We'd be limiting ourselves to Windows 10+ at this point, but I think that's okay for the immediate future. Happy to help coach someone through adding support for that, if it's desired!
I tried compiling on mingw and it looks like rustbox and termion are the only crates that are giving trouble. I don't know anything about those two, but that would likely be where to focus attention for non-WSL Windows support.
I don't have it available at the moment to try, but I'd think that WSL should work as is.
I just tried with the new release and got this
error[E0433]: failed to resolve. Maybe a missing `extern crate sys;`?
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\lib.rs:22:9
|
22 | pub use sys::size::terminal_size;
| ^^^ Maybe a missing `extern crate sys;`?
error[E0433]: failed to resolve. Maybe a missing `extern crate sys;`?
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\lib.rs:23:9
|
23 | pub use sys::tty::{is_tty, get_tty};
| ^^^ Maybe a missing `extern crate sys;`?
error[E0433]: failed to resolve. Maybe a missing `extern crate sys;`?
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\async.rs:5:5
|
5 | use sys::tty::get_tty;
| ^^^ Maybe a missing `extern crate sys;`?
error[E0432]: unresolved import `sys`
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\raw.rs:28:5
|
28 | use sys::Termios;
| ^^^ Maybe a missing `extern crate sys;`?
error[E0433]: failed to resolve. Maybe a missing `extern crate sys;`?
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\raw.rs:29:5
|
29 | use sys::attr::{get_terminal_attr, raw_terminal_attr, set_terminal_attr};
| ^^^ Maybe a missing `extern crate sys;`?
error[E0425]: cannot find function `get_tty` in this scope
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\async.rs:20:36
|
20 | thread::spawn(move || for i in get_tty().unwrap().bytes() {
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `set_terminal_attr` in this scope
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\raw.rs:45:9
|
45 | set_terminal_attr(&self.prev_ios).unwrap();
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `get_terminal_attr` in this scope
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\raw.rs:90:23
|
90 | let mut ios = get_terminal_attr()?;
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `raw_terminal_attr` in this scope
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\raw.rs:93:9
|
93 | raw_terminal_attr(&mut ios);
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `set_terminal_attr` in this scope
--> C:\Users\lewis\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.1\src\raw.rs:95:9
|
95 | set_terminal_attr(&ios)?;
| ^^^^^^^^^^^^^^^^^ not found in this scope
error: aborting due to 10 previous errors
Some errors occurred: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
error: Could not compile `termion`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `amp v0.5.0`, intermediate artifacts can be found at `C:\Users\lewis\AppData\Local\Temp\cargo-installKgB5rS`
Caused by:
build failed
It's termion. Maybe wontfix for now, but what about libxcb?
- windows10 pro x64
- git bash shell
- cmake installed
- python3 installed
- git
- openssl (do we know which version? I'm using 1.1 branch)
- zlib (as with openssl. I'm using 1.2 branch)
As I use linux for main driver it's not a blocker for me. I Just wanted to try scrubbing through a large file using new syntax highlighting.
Is anyone working on this, by chance? Was thinking of digging in a bit and seeing what needs to happen
@jonathandturner nope; that'd be welcome! :slightly_smiling_face:
@jonathandturner I think it's termion from my notes their system is heavily skewed towards *nix style terminals, which is why it's incompatible with Windows.
We can remove termion, if that's an issue; it's too low level and needs a buffered implementation to provide acceptable performance. Unfortunately, there are two open Windows-related issues in termbox:
https://github.com/nsf/termbox/issues/79 https://github.com/nsf/termbox/issues/65
https://github.com/nsf/termbox-go seems to have everything needed, but it might be just a bit of a pain to switch termbox (C) to use that...
- constants switch to defines
- functions probably get
#ifdefeverywhere and it becomes a little unreadable
Not sure calling go (which is compatible with C) from rust is such a good idea either.
Time for termbox-rust? 😹 😂 (joking, but sort of not)
@Lewiscowles1986 one of the stated project goals for Rustbox, the wrapper library we're using for termbox, is to rewrite the underlying C library in Rust, so you're not far off! I'd honestly investigate that before anything else (and add TrueColor support while I'm at it).
Hey, kinda reviving this but, from what I see, the only thing blocking the windows port is termion.
However, browsing the source code, we can see that that crate is alreay abstracted away behind the Terminal trait.
So, right now I'm trying to implement said trait using crossterm, but it's kinda hard without some docs on how to do so.
I'd appreciate it if anyone could help me with that! Thanks
I've managed to make it compile and run on windows just by replacing termion with crossterm!
However, performance is so bad it's hard to test stuff. Will have to investigate. It can be because of the constant flushing there is on this first version.
I'd appreciate any leads on how to best replace termion!
Anyways, here's the fork if anyone is interested: https://github.com/matheuslessarodrigues/amp
@matheuslessarodrigues - I wrote about this some in http://www.jonathanturner.org/2019/04/porting-the-pikachu.html
I had to do a few things. One was to buffer as much as possible before the flush.
You might also want to try it inside of the new Windows Terminal if you haven't yet. I've noticed it's got significantly better performance than the old cmd terminal.
The current crossterm API is pretty different from older versions. I think is a matter of replacing the execute! commands to queue! where possible. At first i just used execute! (forces flush) just to make sure everything works. Now we'll have to minimize that as much as possible.
For rnow, I've only tested on the new Windows Terminal.
Thanks for the tip!
The termwiz crate provides good Windows + Unix terminal support and it has a buffered terminal.