imsnif / bandwhich

Terminal bandwidth utilization tool
MIT License
10.1k stars 298 forks source link

Readme says minimum Rust version is 1.39.0, but compiling fails on debian 10 (rust 1.41.0, cargo 1.42.1) due to not compiling dependency tui v0.12.0. #194

Closed UweKrause closed 1 year ago

UweKrause commented 4 years ago

Hey, for my debian 10 machine there are no package sources, therefore I tried to get bandwhich with cargo. I got a fresh (fresh as in no configuration or anything, just apt-getted it) cargo (cargo 1.42.1) from the debian package source, maybe its an old version?

Anyway, trying to cargo install bandwhich (as root) failed.

I have no clue about rust or cargo or anything, so I am lost here. Hopefully this is really not my fault anyhow ;-)

Compiling procfs v0.7.9
Compiling rand v0.7.3
Compiling tui v0.12.0
error[E0658]: use of unstable library feature 'matches_macro'
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.12.0/src/backend/crossterm.rs:58:17
|
58 |             if !matches!(last_pos, Some(p) if x == p.0 + 1 && y == p.1) {
|                 ^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/65721
error[E0599]: no associated item named `MAX` found for type `usize` in the current scope
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.12.0/src/buffer.rs:275:47
|
275 |         self.set_stringn(x, y, string, usize::MAX, style);
|                                               ^^^ associated item not found in `usize`
|
help: you are looking for the module in `std`, not the primitive type
|
275 |         self.set_stringn(x, y, string, std::usize::MAX, style);
|                                        ^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0599, E0658.
For more information about an error, try `rustc --explain E0599`.
error: could not compile `tui`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `bandwhich v0.19.0`, intermediate artifacts can be found at `/tmp/cargo-install8qV3Vc`
Caused by:
build failed
alicektx commented 4 years ago

Hi. Without cargo / rust having already been installed from Debian / Ubuntu repositories... as they usually lag way behind official Rust releases (hence leading to such issues as above):

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
cargo install bandwhich

If you want to build from latest git commit...

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
git clone https://github.com/imsnif/bandwhich
cd bandwhich
cargo build --release --locked

If worrying about the rustup official installer (being outside the official repos), possibly 'polluting' your system, it doesn't - everything gets placed under $HOME: a .cargo folder, a .rustup folder, & a minor entry appended to .profile (adjusting $PATH properly). rustup self uninstall deletes the 2 folders in question & reverts .profile to what it was before. Or you could simply manually remove / revert such now that you know...

UweKrause commented 4 years ago

Thanks for taking the time for an answer. You are right, with the newest (stable) rust, installed via script from rustup.rs, installation via cargo just works fine :)

The rustc delivered by debian 10 has version 1.41.1, the readme from bandwhich says

The minimum supported Rust version is 1.39.0.

I guess the readme should hint to the correct minimum version? I would make a PR, but I don't know the minimum version. Everything works with the current 1.46.0, but I don't know if this is the minimum version.

imsnif commented 4 years ago

Hey @UweKrause - thanks for bringing this up. The line from the readme is indeed a little old and as we upgrade our dependencies occasionally it becomes outdated.

How about if we change it to something like "If you're having trouble compiling bandwhich, try upgrading cargo to the latest available version using rustup"? Do you feel that would have been more clear for you?

CosmicHorrorDev commented 3 years ago

Just passing by.

I think it is nice to document a MSRV (I wish there was an official way to denote it in Cargo.toml or something). Would it be possible to run CI on the MSRV, so it becomes obvious when a change requires a newer rust version?

cyqsimon commented 1 year ago

Hi all, I've bumped MSRV to 1.65.0. There is now indeed also a way to "officially denote" the MSRV in Cargo.toml.

Fixed by 66ba689. See also #275.