jabber-tools/cognitive-services-speech-sdk-rs

macOS support M1

Closed this issue · 7 comments

I'm trying with macOS (m1)... And get this error

  cargo:rustc-link-search=framework=/Users/jorgeucano/speechsdk/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64
  cargo:rustc-link-lib=framework=MicrosoftCognitiveServicesSpeech

  --- stderr
  c_api/wrapper.h:7:10: fatal error: 'speechapi_c.h' file not found
  c_api/wrapper.h:7:10: fatal error: 'speechapi_c.h' file not found, err: true
  thread 'main' panicked at 'Unable to generate bindings: ()', build.rs:155:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Do you know why I got this error ?

please read respective section in REDME file

  • You need first download MS Speech SDK for Mac
  • During build you need to point the build script to downloaded SDK using MACOS_SPEECHSDK_ROOT variable
  • During run use DYLD_FALLBACK_FRAMEWORK_PATH variable

Everything is described in README. Should you have still issues with the build let me know please

Hey I finally run ... but I change only 1 line ...
For support Mac m1 and m2 I changed this line the all for any
https://github.com/jabber-tools/cognitive-services-speech-sdk-rs/blob/main/build.rs#L129

and with that work perfect

hi,

this is not the best change you could do, rather quick ad hoc one purpose fix. See all supported target architectures here: https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch

I was under impression M1 is arm based so aarm64 should work fine. Can you actually test if this will work with your mac?

#[cfg(all(target_os = "macos", target_arch = "arm"))]

If this works the good solution would be something like (you can maybe test this right ahead):

#[cfg(any(all(target_os = "macos", target_arch = "aarch64"), all(target_os = "macos", target_arch = "arm")))]

Please let me know, I will reopen the issue in the meantime. thanks! If this works feel free to open pull request.

hi Jorge,

I have published library version 0.2.2, see https://crates.io/crates/cognitive-services-speech-sdk-rs/0.2.2

Please check it now works for you without any fiddling, just update the version in your project Cargo.toml and let me know build now works. Once confirmed I will close the issue and respective PR. Thanks!

Nope

Error[E0601]: main function not found in crate build_script_build

please provide more details, not sure what you mean. thx. the above seems rather like your app issue than library issue.

addressed by version 0.2.2