emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
22.47k stars 1.61k forks source link

Check.sh fails to compile speech-dispatcher #1125

Closed juancampa closed 2 years ago

juancampa commented 2 years ago

Describe the bug check.sh fails to run ith the following compilation error

Click to expand check.sh output ``` + cargo check --workspace --all-targets --all-features Checking egui v0.16.1 (/home/juan/git/egui/egui) Checking speech-dispatcher v0.9.0 error[E0308]: mismatched types --> /home/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.9.0/src/lib.rs:35:13 | 35 | Male1 = SPDVoiceType::SPD_MALE1, | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32` error[E0308]: mismatched types --> /home/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.9.0/src/lib.rs:36:13 | 36 | Male2 = SPDVoiceType::SPD_MALE2, | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32` error[E0308]: mismatched types --> /home/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.9.0/src/lib.rs:37:13 | 37 | Male3 = SPDVoiceType::SPD_MALE3, | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32` error[E0308]: mismatched types --> /home/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.9.0/src/lib.rs:38:15 | 38 | Female1 = SPDVoiceType::SPD_FEMALE1, | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32` error[E0308]: mismatched types --> /home/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.9.0/src/lib.rs:39:15 | 39 | Female2 = SPDVoiceType::SPD_FEMALE2, | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32` error[E0308]: mismatched types --> /home/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.9.0/src/lib.rs:40:15 | 40 | Female3 = SPDVoiceType::SPD_FEMALE3, | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32` error[E0308]: mismatched types --> /home/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.9.0/src/lib.rs:41:17 | 41 | ChildMale = SPDVoiceType::SPD_CHILD_MALE, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32` error[E0308]: mismatched types --> /home/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.9.0/src/lib.rs:42:19 | 42 | ChildFemale = SPDVoiceType::SPD_CHILD_FEMALE, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32` For more information about this error, try `rustc --explain E0308`. error: could not compile `speech-dispatcher` due to 8 previous errors warning: build failed, waiting for other jobs to finish... error: build failed ```

To Reproduce Steps to reproduce the behavior:

  1. Clone master
  2. Run sh/check.sh
  3. Notice it finishes with errorrs

Expected behavior It finishes without errors

Desktop (please complete the following information):

Additional context Originally brought up in #1119

emilk commented 2 years ago

Have you run the setup code in https://github.com/emilk/egui#demo (sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev)?

juancampa commented 2 years ago

I'm on Arch Linux, so no apt-get. But I did the equivalent for Arch using pacman. I also tried upgrading to the latest tts crate, which in turn uses the latest speech-dispatcher but that didn't help either.

emilk commented 2 years ago

Note that you don't need speech-dispatcher - it is only for the experimental screen_reader feature.

Pjottos commented 2 years ago

Also ran into this issue on Arch Linux since it ships a more recent version of speech-dispatcher than Ubuntu. I worked around it by temporarily updating the tts dependency in both eframe and egui-winit.

coderedart commented 2 years ago

Yeah. I could not compile it on arch too. I though something was wrong with my system.

The main issue was being unable to run the CI command to check if everything was working properly. I could not use the --all-features flag as that would fail with compilation of speechd.

Had to make a commit, Check why CI failed on github, fix that and repeat .

It was so exhausting:( almost wanted to just install ubuntu on my old laptop just to deal with this

emilk commented 2 years ago

A lot of people seems to be affected by this - anyone want to work on it? Either by disabling speech-dispatcher on Arch, or fixing speech-dispatcher upstream, or altering check.sh, or any other means necessary.

emilk commented 2 years ago

I pushed a commit that makes it easier to just disable tts when you want to test on Linux. If you apply this patch, then cargo check --all-features will work:

index 2e983d9a..3df2a370 100644
--- a/eframe/Cargo.toml
+++ b/eframe/Cargo.toml
@@ -52,7 +52,6 @@ puffin = ["dep:puffin", "egui_glow?/puffin"]
 ## Enable screen reader support (requires `ctx.options().screen_reader = true;`)
 screen_reader = [
   "egui-winit/screen_reader",
-  "tts",
 ]

 ## Use [`wgpu`](https://docs.rs/wgpu) for painting (via [`egui_wgpu`](https://github.com/emilk/egui/tree/master/egui_wgpu)).
diff --git a/egui-winit/Cargo.toml b/egui-winit/Cargo.toml
index e76a399e..63fba4a7 100644
--- a/egui-winit/Cargo.toml
+++ b/egui-winit/Cargo.toml
@@ -34,7 +34,7 @@ links = ["webbrowser"]
 puffin = ["dep:puffin"]

 ## Experimental support for a screen reader.
-screen_reader = ["tts"]
+screen_reader = []

 ## Allow serialization of [`WindowSettings`] using [`serde`](https://docs.rs/serde).
 serde = ["egui/serde", "dep:serde"]

Still unsure what a good long-term solution is. Should we just never use tts on Linux?

coderedart commented 2 years ago

after A LOT of debugging

  1. speech-dispatcher has a type mismatch issue with C FFI. which is fixed in a later version, but has one more fn pointer issue which is due to older version of bindgen.
  2. Cargo.lock relying on an older 0.60.1 version of bindgen used by the speech-dispatcher crate. that bindgen has some issue with mismatch in function pointer signature thingy which causes speech-dispatcher compilation to fail. bump to 0.61 .
  3. unfortunately, latest bindgen uses core::ffi types, and they are stabilized in 1.64 version of rust. so, gotta bump min rust version too.

after the above three changes, I got no compilation errors.

@emilk If you are okay with bumping min rust version and doing a cargo update for updating bindgen version in lockfile , this issue can be fixed.

coderedart commented 2 years ago

rust 1.63 introduces a lint https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq and a lot of structs in egui implement partial_eq but not eq, so this will touch a lot of files if we want to pass the CI checks :)

RobWalt commented 2 years ago

I'm on Nixos using the latest stable version of speechd and I'm running into the same issue.

coderedart commented 2 years ago

I will try making a PR tonight