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

Apache License 2.0
24 stars 15 forks source link

macOS support M1 #7

Closed jorgeucano closed 1 year ago

jorgeucano commented 1 year ago

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 ?

adambezecny commented 1 year ago

please read respective section in REDME file

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

jorgeucano commented 1 year ago

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

adambezecny commented 1 year ago

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.

adambezecny commented 1 year ago

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!

jorgeucano commented 1 year ago

Nope

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

adambezecny commented 1 year ago

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

adambezecny commented 1 year ago

addressed by version 0.2.2