not-jan/apex-tux

Build fails: cannot find value `device` in this scope

Closed this issue · 1 comments

Running

RUSTFLAGS="-C link-dead-code" cargo build --release --no-default-features --features dbus-support

results in it ending with an error "error[E0425]: cannot find value device in this scope":

Full log output

    Updating crates.io index
    Updating git repository `https://github.com/not-jan/gamesense`
     Locking 319 packages to latest compatible versions
      Adding addr2line v0.15.2 (latest: v0.24.0)
      Adding aho-corasick v0.7.15 (latest: v1.1.3)
      Adding arrayvec v0.5.2 (latest: v0.7.4)
      Adding autocfg v0.1.8 (latest: v1.3.0)
      Adding backtrace v0.3.59 (latest: v0.3.73)
      Adding base64 v0.13.1 (latest: v0.22.1)
      Adding base64 v0.21.7 (latest: v0.22.1)
      Adding bitflags v1.3.2 (latest: v2.6.0)
      Adding cfg-if v0.1.10 (latest: v1.0.0)
      Adding cfg_aliases v0.1.1 (latest: v0.2.1)
      Adding cloudabi v0.0.3 (latest: v0.1.0)
      Adding config v0.11.0 (latest: v0.14.0)
      Adding darling v0.13.4 (latest: v0.20.10)
      Adding darling_core v0.13.4 (latest: v0.20.10)
      Adding darling_macro v0.13.4 (latest: v0.20.10)
      Adding deflate v0.8.6 (latest: v1.0.0)
      Adding embedded-graphics v0.7.1 (latest: v0.8.1)
      Adding embedded-graphics-core v0.3.3 (latest: v0.4.0)
      Adding embedded-graphics-simulator v0.3.0 (latest: v0.6.0)
      Adding event-listener v2.5.3 (latest: v5.3.1)
      Adding float-cmp v0.8.0 (latest: v0.9.0)
      Adding foreign-types v0.3.2 (latest: v0.5.0)
      Adding foreign-types-shared v0.1.1 (latest: v0.3.1)
      Adding gif v0.11.4 (latest: v0.13.1)
      Adding gimli v0.24.0 (latest: v0.31.0)
      Adding global-hotkey v0.2.4 (latest: v0.5.4)
      Adding h2 v0.3.26 (latest: v0.4.5)
      Adding hermit-abi v0.3.9 (latest: v0.4.0)
      Adding hidapi v1.5.0 (latest: v2.6.1)
      Adding http v0.2.12 (latest: v1.1.0)
      Adding http-body v0.4.6 (latest: v1.0.1)
      Adding hyper v0.14.30 (latest: v1.4.1)
      Adding hyper-tls v0.5.0 (latest: v0.6.0)
      Adding idna v0.5.0 (latest: v1.0.2)
      Adding image v0.23.14 (latest: v0.25.1)
      Adding image v0.24.9 (latest: v0.25.1)
      Adding itertools v0.10.5 (latest: v0.13.0)
      Adding jpeg-decoder v0.1.22 (latest: v0.3.1)
      Adding keyboard-types v0.6.2 (latest: v0.7.0)
      Adding lexical-core v0.7.6 (latest: v0.8.5)
      Adding linkme v0.2.10 (latest: v0.3.27)
      Adding linkme-impl v0.2.10 (latest: v0.3.27)
      Adding linux-raw-sys v0.4.14 (latest: v0.6.4)
      Adding memchr v2.3.4 (latest: v2.7.4)
      Adding micromath v1.1.1 (latest: v2.1.0)
      Adding miniz_oxide v0.3.7 (latest: v0.7.4)
      Adding miniz_oxide v0.4.4 (latest: v0.7.4)
      Adding mio v0.8.11 (latest: v1.0.0)
      Adding nix v0.28.0 (latest: v0.29.0)
      Adding nom v5.1.3 (latest: v7.1.3)
      Adding nom v6.2.2 (latest: v7.1.3)
      Adding num v0.1.42 (latest: v0.4.3)
      Adding num-rational v0.3.2 (latest: v0.4.2)
      Adding num-traits v0.1.43 (latest: v0.2.19)
      Adding num_enum v0.5.11 (latest: v0.7.2)
      Adding num_enum_derive v0.5.11 (latest: v0.7.2)
      Adding object v0.24.0 (latest: v0.36.1)
      Adding png v0.16.8 (latest: v0.17.13)
      Adding proc-macro-crate v1.3.1 (latest: v3.1.0)
      Adding radium v0.7.0 (latest: v1.1.0)
      Adding rand v0.6.5 (latest: v0.8.5)
      Adding rand_chacha v0.1.1 (latest: v0.3.1)
      Adding rand_core v0.3.1 (latest: v0.6.4)
      Adding rand_core v0.4.2 (latest: v0.6.4)
      Adding rand_hc v0.1.0 (latest: v0.3.2)
      Adding rand_isaac v0.1.1 (latest: v0.3.0)
      Adding rand_jitter v0.1.4 (latest: v0.4.0)
      Adding rand_os v0.1.3 (latest: v0.2.2)
      Adding rand_pcg v0.1.2 (latest: v0.3.1)
      Adding rand_xorshift v0.1.1 (latest: v0.3.0)
      Adding rdrand v0.4.0 (latest: v0.8.3)
      Adding regex v1.4.6 (latest: v1.10.5)
      Adding regex-syntax v0.6.29 (latest: v0.8.4)
      Adding reqwest v0.11.27 (latest: v0.12.5)
      Adding rust-ini v0.13.0 (latest: v0.21.0)
      Adding rustls-pemfile v1.0.4 (latest: v2.1.2)
      Adding sdl2 v0.32.2 (latest: v0.37.0)
      Adding sdl2-sys v0.32.6 (latest: v0.37.0)
      Adding serde v0.8.23 (latest: v1.0.204)
      Adding serde_with v1.14.0 (latest: v3.9.0)
      Adding serde_with_macros v1.5.2 (latest: v3.9.0)
      Adding simplelog v0.10.2 (latest: v0.12.2)
      Adding strsim v0.10.0 (latest: v0.11.1)
      Adding syn v1.0.109 (latest: v2.0.71)
      Adding sync_wrapper v0.1.2 (latest: v1.0.1)
      Adding sysinfo v0.27.8 (latest: v0.30.13)
      Adding system-configuration v0.5.1 (latest: v0.6.0)
      Adding system-configuration-sys v0.5.0 (latest: v0.6.0)
      Adding termcolor v1.1.3 (latest: v1.4.1)
      Adding tiff v0.6.1 (latest: v0.9.1)
      Adding tinybmp v0.3.3 (latest: v0.6.0)
      Adding toml v0.5.11 (latest: v0.8.14)
      Adding toml_edit v0.19.12 (latest: v0.22.15)
      Adding wasi v0.11.0+wasi-snapshot-preview1 (latest: v0.13.1+wasi-0.2.0)
      Adding windows v0.43.0 (latest: v0.58.0)
      Adding windows-core v0.52.0 (latest: v0.58.0)
      Adding windows-sys v0.48.0 (latest: v0.52.0)
      Adding windows-targets v0.48.5 (latest: v0.52.6)
      Adding windows_aarch64_gnullvm v0.42.2 (latest: v0.52.6)
      Adding windows_aarch64_gnullvm v0.48.5 (latest: v0.52.6)
      Adding windows_aarch64_msvc v0.42.2 (latest: v0.52.6)
      Adding windows_aarch64_msvc v0.48.5 (latest: v0.52.6)
      Adding windows_i686_gnu v0.42.2 (latest: v0.52.6)
      Adding windows_i686_gnu v0.48.5 (latest: v0.52.6)
      Adding windows_i686_msvc v0.42.2 (latest: v0.52.6)
      Adding windows_i686_msvc v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_gnu v0.42.2 (latest: v0.52.6)
      Adding windows_x86_64_gnu v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_gnullvm v0.42.2 (latest: v0.52.6)
      Adding windows_x86_64_gnullvm v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_msvc v0.42.2 (latest: v0.52.6)
      Adding windows_x86_64_msvc v0.48.5 (latest: v0.52.6)
      Adding winnow v0.4.7 (latest: v0.6.13)
      Adding winreg v0.50.0 (latest: v0.52.0)
      Adding wyz v0.5.1 (latest: v0.6.1)
   Compiling proc-macro2 v1.0.86
   Compiling autocfg v1.3.0
   Compiling unicode-ident v1.0.12
   Compiling memchr v2.3.4
   Compiling libc v0.2.155
   Compiling version_check v0.9.4
   Compiling pin-project-lite v0.2.14
   Compiling futures-core v0.3.30
   Compiling futures-sink v0.3.30
   Compiling syn v1.0.109
   Compiling az v1.2.1
   Compiling equivalent v1.0.1
   Compiling pkg-config v0.3.30
   Compiling futures-task v0.3.30
   Compiling hashbrown v0.14.5
   Compiling futures-io v0.3.30
   Compiling pin-utils v0.1.0
   Compiling serde v1.0.204
   Compiling toml_datetime v0.6.6
   Compiling cfg-if v1.0.0
   Compiling anyhow v1.0.86
   Compiling futures-channel v0.3.30
   Compiling winnow v0.4.7
   Compiling cfg_aliases v0.1.1
   Compiling once_cell v1.19.0
   Compiling ryu v1.0.18
   Compiling radium v0.7.0
   Compiling byteorder v1.5.0
   Compiling lexical-core v0.7.6
   Compiling nix v0.28.0
   Compiling arrayvec v0.5.2
   Compiling tap v1.0.1
   Compiling regex-syntax v0.6.29
   Compiling micromath v1.1.1
   Compiling static_assertions v1.1.0
   Compiling bitflags v1.3.2
   Compiling serde_json v1.0.120
   Compiling nom v6.2.2
   Compiling nom v5.1.3
   Compiling wyz v0.5.1
   Compiling num-traits v0.2.19
   Compiling slab v0.4.9
   Compiling aho-corasick v0.7.15
   Compiling option-ext v0.2.0
   Compiling event-listener v2.5.3
   Compiling linked-hash-map v0.5.6
   Compiling funty v2.0.0
   Compiling iana-time-zone v0.1.60
   Compiling serde v0.8.23
   Compiling bitflags v2.6.0
   Compiling libdbus-sys v0.2.5
   Compiling itoa v1.0.11
   Compiling lazy_static v1.5.0
   Compiling quote v1.0.36
   Compiling indexmap v2.2.6
   Compiling yaml-rust v0.4.5
   Compiling async-mutex v1.4.0
   Compiling apex-music v0.1.0 (/tmp/apex-tux/apex-music)
   Compiling syn v2.0.71
   Compiling bitvec v1.0.1
   Compiling rust-ini v0.13.0
   Compiling termcolor v1.1.3
   Compiling embedded-graphics-core v0.3.3
   Compiling log v0.4.22
   Compiling float-cmp v0.8.0
   Compiling num-traits v0.1.43
   Compiling chrono v0.4.38
   Compiling either v1.13.0
   Compiling socket2 v0.5.7
   Compiling toml_edit v0.19.12
   Compiling mio v0.8.11
   Compiling num_cpus v1.16.0
   Compiling regex v1.4.6
   Compiling embedded-graphics v0.7.1
   Compiling dirs-sys v0.4.1
   Compiling dirs v5.0.1
   Compiling toml v0.5.11
   Compiling simplelog v0.10.2
   Compiling serde-hjson v0.9.1
   Compiling itertools v0.10.5
   Compiling async-rwlock v1.3.0
   Compiling apex-input v0.1.0 (/tmp/apex-tux/apex-input)
   Compiling proc-macro-crate v1.3.1
   Compiling linkme-impl v0.2.10
   Compiling config v0.11.0
   Compiling ctrlc v3.4.4
   Compiling tinybmp v0.3.3
   Compiling linkme v0.2.10
   Compiling futures-macro v0.3.30
   Compiling tokio-macros v2.3.0
   Compiling num_enum_derive v0.5.11
   Compiling async-stream-impl v0.3.5
   Compiling futures-util v0.3.30
   Compiling tokio v1.38.0
   Compiling async-stream v0.3.5
   Compiling num_enum v0.5.11
   Compiling apex-hardware v0.1.0 (/tmp/apex-tux/apex-hardware)
   Compiling dbus v0.9.7
   Compiling futures-executor v0.3.30
   Compiling futures v0.3.30
   Compiling dbus-tokio v0.7.6
   Compiling apex-mpris2 v0.1.0 (/tmp/apex-tux/apex-mpris2)
warning: multiple methods are never used
  --> apex-mpris2/src/generated.rs:10:8
   |
9  | pub trait MediaPlayer2Player {
   |           ------------------ methods in this trait
10 |     fn next(&self) -> nonblock::MethodReply<()>;
   |        ^^^^
11 |     fn previous(&self) -> nonblock::MethodReply<()>;
   |        ^^^^^^^^
12 |     fn pause(&self) -> nonblock::MethodReply<()>;
   |        ^^^^^
13 |     fn play_pause(&self) -> nonblock::MethodReply<()>;
   |        ^^^^^^^^^^
14 |     fn stop(&self) -> nonblock::MethodReply<()>;
   |        ^^^^
15 |     fn play(&self) -> nonblock::MethodReply<()>;
   |        ^^^^
16 |     fn seek(&self, offset: i64) -> nonblock::MethodReply<()>;
   |        ^^^^
17 |     fn set_position(&self, track_id: dbus::Path, position: i64) -> nonblock::MethodReply<()>;
   |        ^^^^^^^^^^^^
18 |     fn open_uri(&self, uri: &str) -> nonblock::MethodReply<()>;
   |        ^^^^^^^^
19 |     fn playback_status(&self) -> nonblock::MethodReply<String>;
20 |     fn loop_status(&self) -> nonblock::MethodReply<String>;
   |        ^^^^^^^^^^^
21 |     fn set_loop_status(&self, value: String) -> nonblock::MethodReply<()>;
   |        ^^^^^^^^^^^^^^^
22 |     fn rate(&self) -> nonblock::MethodReply<f64>;
   |        ^^^^
23 |     fn set_rate(&self, value: f64) -> nonblock::MethodReply<()>;
   |        ^^^^^^^^
24 |     fn shuffle(&self) -> nonblock::MethodReply<bool>;
   |        ^^^^^^^
25 |     fn set_shuffle(&self, value: bool) -> nonblock::MethodReply<()>;
   |        ^^^^^^^^^^^
26 |     fn metadata(&self) -> nonblock::MethodReply<arg::PropMap>;
27 |     fn volume(&self) -> nonblock::MethodReply<f64>;
   |        ^^^^^^
28 |     fn set_volume(&self, value: f64) -> nonblock::MethodReply<()>;
   |        ^^^^^^^^^^
29 |     fn position(&self) -> nonblock::MethodReply<i64>;
30 |     fn minimum_rate(&self) -> nonblock::MethodReply<f64>;
   |        ^^^^^^^^^^^^
31 |     fn maximum_rate(&self) -> nonblock::MethodReply<f64>;
   |        ^^^^^^^^^^^^
32 |     fn can_go_next(&self) -> nonblock::MethodReply<bool>;
   |        ^^^^^^^^^^^
33 |     fn can_go_previous(&self) -> nonblock::MethodReply<bool>;
   |        ^^^^^^^^^^^^^^^
34 |     fn can_play(&self) -> nonblock::MethodReply<bool>;
   |        ^^^^^^^^
35 |     fn can_pause(&self) -> nonblock::MethodReply<bool>;
   |        ^^^^^^^^^
36 |     fn can_seek(&self) -> nonblock::MethodReply<bool>;
   |        ^^^^^^^^
37 |     fn can_control(&self) -> nonblock::MethodReply<bool>;
   |        ^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `apex-mpris2` (lib) generated 1 warning
   Compiling apex-tux v1.0.3 (/tmp/apex-tux)
error[E0425]: cannot find value `device` in this scope
  --> src/main.rs:95:5
   |
95 |     device.clear().await?;
   |     ^^^^^^ not found in this scope

error[E0425]: cannot find value `device` in this scope
  --> src/main.rs:97:40
   |
97 |     let mut scheduler = Scheduler::new(device);
   |                                        ^^^^^^ not found in this scope

warning: unused import: `anyhow::anyhow`
 --> src/providers/music.rs:3:5
  |
3 | use anyhow::anyhow;
  |     ^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: this function depends on never type fallback being `()`
   --> src/dbus/notifications.rs:110:5
    |
110 |     fn stream<'this>(&'this mut self) -> Result<Self::NotificationStream<'this>> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748>
    = help: specify the types explicitly
note: in edition 2024, the requirement `!: ReadAll` will fail
   --> src/dbus/notifications.rs:139:18
    |
139 |                 .method_call(
    |                  ^^^^^^^^^^^
    = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default

warning: unused import: `apex_hardware::AsyncDevice`
  --> src/main.rs:52:5
   |
52 | use apex_hardware::AsyncDevice;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0425`.
warning: `apex-tux` (bin "apex-tux") generated 3 warnings
error: could not compile `apex-tux` (bin "apex-tux") due to 2 previous errors; 3 warnings emitted

Rustc version: rustc 1.81.0-nightly (24d2ac0b5 2024-07-15)

You should make sure that usb is part of the --features list. So: --features dbus-support,usb and it will work.