Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build on arm linux #5

Open
RandomExplosion opened this issue Dec 28, 2020 · 20 comments
Open

Fails to build on arm linux #5

RandomExplosion opened this issue Dec 28, 2020 · 20 comments

Comments

@RandomExplosion
Copy link

Expected Behaviour: Project builds and runs successfully after adding tts to the dependencies list

Actual Behaviour: Project fails to run despite not using the library anywhere in code

error: failed to run custom build command for `speech-dispatcher-sys v0.5.2`

Caused by:
  process didn't exit successfully: `/share/lightbox_rs/target/debug/build/speech-dispatcher-sys-92155df6d9f2566e/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=speechd

--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\', \'libclang-*.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', /home/benjamin.mcgaw/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.56.0/src/lib.rs:1922:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: build failed

running with a backtrace yields the following:

error: failed to run custom build command for `speech-dispatcher-sys v0.5.2`

Caused by:
  process didn't exit successfully: `/share/lightbox_rs/target/debug/build/speech-dispatcher-sys-92155df6d9f2566e/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=speechd

--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\', \'libclang-*.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', /home/benjamin.mcgaw/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.56.0/src/lib.rs:1922:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: build failed
@ndarilek
Copy link
Owner

ndarilek commented Dec 28, 2020 via email

@RandomExplosion
Copy link
Author

i just went and installed a new version of libclang and now i get

error: failed to run custom build command for `speech-dispatcher-sys v0.5.2`

Caused by:
  process didn't exit successfully: `/share/lightbox_rs/target/debug/build/speech-dispatcher-sys-92155df6d9f2566e/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=speechd

--- stderr
wrapper.h:1:10: fatal error: 'speech-dispatcher/libspeechd.h' file not found
wrapper.h:1:10: fatal error: 'speech-dispatcher/libspeechd.h' file not found, err: true
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', /home/benjamin.mcgaw/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-sys-0.5.2/build.rs:9:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@RandomExplosion
Copy link
Author

it also appears to be the same error being hit by docs.rs
https://docs.rs/crate/tts/0.12.2
error

@RandomExplosion
Copy link
Author

I just tried running sudo apt-get install -y libspeechd-dev as that is what you do in your unit tests and I now get this:

error[E0308]: mismatched types
   --> /home/benjamin.mcgaw/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.7.0/src/lib.rs:131:37
    |
131 |     let index_mark = CStr::from_ptr(index_mark);
    |                                     ^^^^^^^^^^ expected `u8`, found `i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*mut i8`

error[E0308]: mismatched types
   --> /home/benjamin.mcgaw/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.7.0/src/lib.rs:208:33
    |
208 |         (*c).callback_im = Some(cb_im);
    |                                 ^^^^^ expected `u8`, found `i8`
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, _, _, *mut u8)`
                  found fn item `unsafe extern "C" fn(_, _, _, *mut i8) {cb_im}`

error[E0308]: mismatched types
   --> /home/benjamin.mcgaw/.cargo/registry/src/github.com-1ecc6299db9ec823/speech-dispatcher-0.7.0/src/lib.rs:329:61
    |
329 |         let v = unsafe { spd_wchar(self.0, priority as u32, wchar) };
    |                                                             ^^^^^ expected `u32`, found `i32`
    |
help: you can convert an `i32` to `u32` and panic if the converted value wouldn't fit
    |
329 |         let v = unsafe { spd_wchar(self.0, priority as u32, wchar.try_into().unwrap()) };
    |                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
error: could not compile `speech-dispatcher`.

@ndarilek
Copy link
Owner

ndarilek commented Dec 28, 2020 via email

@RandomExplosion
Copy link
Author

I'm a bit confused as a lot of the errors seem to be type errors related to the intergers
i'll try modifying the source and seeing if that helps

@ndarilek
Copy link
Owner

ndarilek commented Dec 28, 2020 via email

@prewk
Copy link

prewk commented Jan 25, 2021

Just wanted to mention I'm getting a similar error on a MacBook Air M1 (that is, ARM):

error[E0308]: mismatched types
   --> /Users/oskarthornblad/.cargo/registry/src/github.com-1ecc6299db9ec823/tts-0.14.0/src/backends/appkit.rs:201:27
    |
201 |         Ok(is_speaking == YES)
    |                           ^^^ expected `i8`, found `bool`

@ndarilek
Copy link
Owner

ndarilek commented Jan 25, 2021 via email

@ndarilek
Copy link
Owner

The compilation error has been fixed on the M1, but I can't get speech working on this platform. I also vaguely recall that I didn't get speech working on iOS either, but at the time I didn't debug further since I had other things to work on.

Hoping the Linux issues should be easily fixed, since the compiler is catching them. I'm more worried about macOS, though, since the only way to call these APIs is to unsafely poke a bunch of ObjC at runtime and the compiler can't help. If anyone has any deeper mac experience, that'd be greatly appreciated.

In the meantime, I'll see if I can at least score an Arm Linux server and get things compiling there. I'm curious if this is a general Arm failure, or if it just doesn't work on macOS.

@prewk
Copy link

prewk commented Mar 12, 2021

I have zero experience, but just wanted to let you know that I successfully get speech on my M1 using this: #7

@ndarilek
Copy link
Owner

@prewk meet @Ghorthalon. You're both trying to get this working on M1s, except it works for you and doesn't for him. It also works for me on my Intel mac.

I am genuinely at a loss as to what to try next, other than posting to the Rust forums and hoping some mac Rust expert helps out. Would you two mind connecting sometime and seeing what you can figure out?

You'll want to use master, since I added more logging and fixed the M1 compilation issue. RUST_LOG=trace cargo run --example hello_world should give you a bunch of logging.

I'd be very interested in any differences between your systems that might account for this behavior. Are you using different default languages, different default voices, or something else?

Thanks a bunch.

@prewk
Copy link

prewk commented Mar 12, 2021

I basically just did

let mut tts = TTS::new(Backends::AppKit).unwrap();
speaker.tts.speak("foo".to_string(), true).unwrap();

so everything default, I guess. (with #7)

@ndarilek
Copy link
Owner

ndarilek commented Mar 12, 2021 via email

@prewk
Copy link

prewk commented Mar 12, 2021

Ahh, no my bad I might've just misunderstood how to use it properly haha.

@ndarilek
Copy link
Owner

ndarilek commented Mar 12, 2021 via email

@prewk
Copy link

prewk commented Mar 12, 2021

Tried it - compiled but no sound!

@ndarilek
Copy link
Owner

ndarilek commented Mar 12, 2021 via email

@prewk
Copy link

prewk commented Mar 12, 2021

Haha that's good (and bad!).

@droundy
Copy link

droundy commented Jun 4, 2022

Coming to this late, would suggest that usually when considering a conditional cast to i8 the correct answer is instead to unconditionally use c_char (or whatever it's called, I'm on mobile and holding a baby).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants