p-e-w / hegemon

A modular system monitor written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot compile hegemon

gabber-tech opened this issue · comments

Did fail to compile hegemon on my machine

Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

here's the steps I took:

sudo apt install libsensors4-dev
sudo apt-get install curl 
curl https://sh.rustup.rs -sSf | sh
cargo install hegemon
sudo apt install cargo
cargo install hegemon

Result:

error[E0599]: no method named `as_usize` found for type `systemstat::ByteSize` in the current scope
  --> /home/silvan/.cargo/registry/src/github.com-1ecc6299db9ec823/hegemon-0.1.0/src/providers/memory.rs:43:35
   |
43 |                 Some(memory.total.as_usize() as f64),
   |                                   ^^^^^^^^

error[E0369]: binary operation `-` cannot be applied to type `systemstat::ByteSize`
  --> /home/silvan/.cargo/registry/src/github.com-1ecc6299db9ec823/hegemon-0.1.0/src/providers/memory.rs:37:44
   |
37 |                         Some((memory.total - memory.free).as_usize() as f64)
   |                               ------------ ^ ----------- systemstat::ByteSize
   |                               |
   |                               systemstat::ByteSize
   |
   = note: an implementation of `std::ops::Sub` might be missing for `systemstat::ByteSize`

error[E0599]: no method named `as_usize` found for type `systemstat::ByteSize` in the current scope
  --> /home/silvan/.cargo/registry/src/github.com-1ecc6299db9ec823/hegemon-0.1.0/src/providers/memory.rs:64:46
   |
64 |                     Some(meminfo[SWAP_TOTAL].as_usize() as f64),
   |                                              ^^^^^^^^

error[E0369]: binary operation `-` cannot be applied to type `systemstat::ByteSize`
  --> /home/silvan/.cargo/registry/src/github.com-1ecc6299db9ec823/hegemon-0.1.0/src/providers/memory.rs:58:55
   |
58 |                             Some((meminfo[SWAP_TOTAL] - meminfo[SWAP_FREE]).as_usize() as f64)
   |                                   ------------------- ^ ------------------ systemstat::ByteSize
   |                                   |
   |                                   systemstat::ByteSize
   |
   = note: an implementation of `std::ops::Sub` might be missing for `systemstat::ByteSize`

The systemstat crate broke its API in a pre-1.0.0 patch release. This is allowed under the Semantic Versioning specification; however, cargo install still thinks it is OK to automatically bump the patch version.

I believe that Cargo's version compatibility semantics are at fault here, and have filed dtolnay/semver#198, where discussion is ongoing. I have also changed the installation instructions in the README to recommend cloning the Git repository instead, since I cannot retroactively fix the crate release.

You might also want to mention that you need to

cargo install --path .

in the readme.

Any news about this?