rgwood / systemctl-tui

A fast, simple TUI for interacting with systemd services and their logs
MIT License
235 stars 5 forks source link

Build errors on Ubuntu 22.04 (possibly related to ratatui) #5

Closed kwertyops closed 11 months ago

kwertyops commented 11 months ago

I have little to no experience with Rust, so I wish I could be more helpful in trying to track down the issue.

I just wanted to pop by and mention that on a fresh install of Rust via rustup, I get the following when I try cargo install systemctl-tui:

...
...
   Compiling systemctl-tui v0.2.0
error[E0308]: mismatched types
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systemctl-tui-0.2.0/src/components/logger.rs:27:14
    |
27  |       .block(Block::default().title(" 📝 systemctl-tui logs").borders(Borders::ALL))
    |        ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::widgets::block::Block<'_>`, found `ratatui::widgets::Block<'_>`
    |        |
    |        arguments to this method are incorrect
    |
    = note: `ratatui::widgets::Block<'_>` and `ratatui::widgets::block::Block<'_>` have similar names, but are actually distinct types
note: `ratatui::widgets::Block<'_>` is defined in crate `ratatui`
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/widgets/block.rs:100:1
    |
100 | pub struct Block<'a> {
    | ^^^^^^^^^^^^^^^^^^^^
note: `ratatui::widgets::block::Block<'_>` is defined in crate `ratatui`
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/widgets/block.rs:119:1
    |
119 | pub struct Block<'a> {
    | ^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:946:12
    |
946 |     pub fn block(mut self, block: Block<'b>) -> Self {
    |            ^^^^^

error[E0308]: mismatched types
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systemctl-tui-0.2.0/src/components/logger.rs:28:20
    |
28  |       .style_error(Style::default().fg(Color::Red))
    |        ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found a different `ratatui::style::Style`
    |        |
    |        arguments to this method are incorrect
    |
    = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `ratatui::style::Style` is defined in crate `ratatui`
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:121:1
    |
121 | pub struct Style {
    | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
    |
253 | pub struct Style {
    | ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:990:12
    |
990 |     pub fn style_error(mut self, style: Style) -> Self {
    |            ^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systemctl-tui-0.2.0/src/components/logger.rs:29:20
     |
29   |       .style_debug(Style::default().fg(Color::Green))
     |        ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found a different `ratatui::style::Style`
     |        |
     |        arguments to this method are incorrect
     |
     = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:121:1
     |
121  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1006:12
     |
1006 |     pub fn style_debug(mut self, style: Style) -> Self {
     |            ^^^^^^^^^^^

error[E0308]: mismatched types
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systemctl-tui-0.2.0/src/components/logger.rs:30:19
    |
30  |       .style_warn(Style::default().fg(Color::Yellow))
    |        ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found a different `ratatui::style::Style`
    |        |
    |        arguments to this method are incorrect
    |
    = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `ratatui::style::Style` is defined in crate `ratatui`
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:121:1
    |
121 | pub struct Style {
    | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
    |
253 | pub struct Style {
    | ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:994:12
    |
994 |     pub fn style_warn(mut self, style: Style) -> Self {
    |            ^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systemctl-tui-0.2.0/src/components/logger.rs:31:20
     |
31   |       .style_trace(Style::default().fg(Color::Magenta))
     |        ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found a different `ratatui::style::Style`
     |        |
     |        arguments to this method are incorrect
     |
     = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:121:1
     |
121  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
     |
253  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:1002:12
     |
1002 |     pub fn style_trace(mut self, style: Style) -> Self {
     |            ^^^^^^^^^^^

error[E0308]: mismatched types
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systemctl-tui-0.2.0/src/components/logger.rs:32:19
    |
32  |       .style_info(Style::default().fg(Color::Cyan))
    |        ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found a different `ratatui::style::Style`
    |        |
    |        arguments to this method are incorrect
    |
    = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `ratatui::style::Style` is defined in crate `ratatui`
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:121:1
    |
121 | pub struct Style {
    | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/style.rs:253:1
    |
253 | pub struct Style {
    | ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
   --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-logger-0.9.6/src/lib.rs:998:12
    |
998 |     pub fn style_info(mut self, style: Style) -> Self {
    |            ^^^^^^^^^^

error[E0277]: the trait bound `TuiLoggerWidget<'_>: Widget` is not satisfied
  --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/systemctl-tui-0.2.0/src/components/logger.rs:40:21
   |
40 |     f.render_widget(w, rect);
   |       ------------- ^ the trait `Widget` is not implemented for `TuiLoggerWidget<'_>`
   |       |
   |       required by a bound introduced by this call
   |
   = help: the following other types implement trait `Widget`:
             Canvas<'a, F>
             LineGauge<'a>
             BarChart<'a>
             ratatui::widgets::Block<'a>
             Chart<'a>
             ratatui::widgets::Clear
             Gauge<'a>
             List<'a>
           and 4 others
note: required by a bound in `ratatui::Frame::<'a, B>::render_widget`
  --> /home/andrew/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/terminal.rs:88:12
   |
86 |     pub fn render_widget<W>(&mut self, widget: W, area: Rect)
   |            ------------- required by a bound in this associated function
87 |     where
88 |         W: Widget,
   |            ^^^^^^ required by this bound in `Frame::<'a, B>::render_widget`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `systemctl-tui` (lib) due to 7 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `systemctl-tui v0.2.0`, intermediate artifacts can be found at `/tmp/cargo-installFYhq3M`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
rgwood commented 11 months ago

Thanks for the report! I’m not at a computer right now but I’ll try to repro+fix this in the next few days.

rgwood commented 11 months ago

Fixed in v0.2.1 by updating dependency versions.

There was something weird going on where I could cargo build from the repo but cargo install was using slightly different versions of dependencies. I'm surprised this would happen with a Cargo.lock lockfile but I must be missing something.

rgwood commented 3 weeks ago

If anyone else runs into similar issues, use the --locked flag: cargo install systemctl-tui --locked