Closed boosh closed 1 year ago
We have a work item for this, I'll talk with the team about increasing the priority.
In the meantime, you are most likely missing the environment variable CGO_CFLAGS environment variable that points to the extracted speech SDK tar. The Linux instructions here should point you in the direction in terms of steps needed: https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform?pivots=programming-language-go&tabs=windows%2Cubuntu%2Cdotnet%2Cjre%2Cmaven%2Cbrowser%2Cmac%2Cpypi#install-the-speech-sdk
@ralph-msft Hi Microsoft guys! I just can't understand why does this SDK must use cgo? Any pure Go solutions?
@hyorigo The Speech SDK for Go depends on native C++ libraries which are called via C interface.
@jhakulin Thanks for your reply!
Apart from the hardware things for microphone access or speakers, are the other parts so complicated or performance-sensitive, and must use C++ to do the job?
Some developers use Go because it's easy to build cross-platform and distribute easily, and choose Cognitive Services SDK over REST API because it's simpler and provides detailed events. But this Cgo SDK fails.
I really hope the PM of your team should put "providing pure Go SDK" in your next milestone and as P0 feature 🚢
@boosh
Answering to your original problem with using Speech SDK for Go on Mac. Please see the instructions below how to take this SDK in use on Mac. I will make sure these are updated in our docs.
Install Speech SDK to your Mac
export SPEECHSDK_ROOT="/your/path"
mkdir -p "$SPEECHSDK_ROOT"
wget -O MicrosoftCognitiveServicesSpeech.xcframework.zip https://aka.ms/csspeech/macosbinary
unzip MicrosoftCognitiveServicesSpeech.xcframework.zip -d "$SPEECHSDK_ROOT"
Setup compiler and linker flags for Go
export CGO_CFLAGS="-I$SPEECHSDK_ROOT/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64/MicrosoftCognitiveServicesSpeech.framework/Headers"
export CGO_LDFLAGS="-Wl,-rpath,$SPEECHSDK_ROOT/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64 -F$SPEECHSDK_ROOT/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64 -framework MicrosoftCognitiveServicesSpeech"
After this you should be able to build and run the samples under the samples directory of this repository.
go build
go run main.go <give required parameters here>
@hyorigo I understand that pure Go solution would be easier to handle by customers. Currently the Speech SDK is based on native libraries expect Speech SDK for JavaScript which is done with pure JavaScript. Making pure Go solution is not currently in our plans for the near future.
closing as answered
@boosh
Answering to your original problem with using Speech SDK for Go on Mac. Please see the instructions below how to take this SDK in use on Mac. I will make sure these are updated in our docs.
Install Speech SDK to your Mac
export SPEECHSDK_ROOT="/your/path" mkdir -p "$SPEECHSDK_ROOT" wget -O MicrosoftCognitiveServicesSpeech.xcframework.zip https://aka.ms/csspeech/macosbinary unzip MicrosoftCognitiveServicesSpeech.xcframework.zip -d "$SPEECHSDK_ROOT"
Setup compiler and linker flags for Go
export CGO_CFLAGS="-I$SPEECHSDK_ROOT/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64/MicrosoftCognitiveServicesSpeech.framework/Headers" export CGO_LDFLAGS="-Wl,-rpath,$SPEECHSDK_ROOT/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64 -F$SPEECHSDK_ROOT/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64 -framework MicrosoftCognitiveServicesSpeech"
After this you should be able to build and run the samples under the samples directory of this repository.
go build go run main.go <give required parameters here>
@hyorigo I understand that pure Go solution would be easier to handle by customers. Currently the Speech SDK is based on native libraries expect Speech SDK for JavaScript which is done with pure JavaScript. Making pure Go solution is not currently in our plans for the near future.
Hey bro! Thank you for writting this reply, it's really useful. After setting this, I can complie codes with goland. But i meet one problem: when I wanna run the codes, security notice will show and program will exit. The notice looks like this: Maybe you need add some methods to deal this problem in QA part(if has and necessary). Thank you for reading! Wish good day!
Can you please check if https://github.com/microsoft/cognitive-services-speech-sdk-go/issues/72#issuecomment-1339115103 is correctly recored in a public document? I don't find it.
@jhakulin Thanks for your reply!
Apart from the hardware things for microphone access or speakers, are the other parts so complicated or performance-sensitive, and must use C++ to do the job?
Some developers use Go because it's easy to build cross-platform and distribute easily, and choose Cognitive Services SDK over REST API because it's simpler and provides detailed events. But this Cgo SDK fails.
I really hope the PM of your team should put "providing pure Go SDK" in your next milestone and as P0 feature 🚢
This is the essential and critical question, however they just dismiss and ignore it.
Answering to your original problem with using Speech SDK for Go on Mac. Please see the instructions below how to take this SDK in use on Mac. I will make sure these are updated in our docs.
These are proper instructions but couldn't find it anywhere on:
@boosh Answering to your original problem with using Speech SDK for Go on Mac. Please see the instructions below how to take this SDK in use on Mac. I will make sure these are updated in our docs. Install Speech SDK to your Mac
export SPEECHSDK_ROOT="/your/path" mkdir -p "$SPEECHSDK_ROOT" wget -O MicrosoftCognitiveServicesSpeech.xcframework.zip https://aka.ms/csspeech/macosbinary unzip MicrosoftCognitiveServicesSpeech.xcframework.zip -d "$SPEECHSDK_ROOT"
Setup compiler and linker flags for Go
export CGO_CFLAGS="-I$SPEECHSDK_ROOT/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64/MicrosoftCognitiveServicesSpeech.framework/Headers" export CGO_LDFLAGS="-Wl,-rpath,$SPEECHSDK_ROOT/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64 -F$SPEECHSDK_ROOT/MicrosoftCognitiveServicesSpeech.xcframework/macos-arm64_x86_64 -framework MicrosoftCognitiveServicesSpeech"
After this you should be able to build and run the samples under the samples directory of this repository.
go build go run main.go <give required parameters here>
@hyorigo I understand that pure Go solution would be easier to handle by customers. Currently the Speech SDK is based on native libraries expect Speech SDK for JavaScript which is done with pure JavaScript. Making pure Go solution is not currently in our plans for the near future.
Hey bro! Thank you for writting this reply, it's really useful. After setting this, I can complie codes with goland. But i meet one problem: when I wanna run the codes, security notice will show and program will exit. The notice looks like this: Maybe you need add some methods to deal this problem in QA part(if has and necessary). Thank you for reading! Wish good day!
I faced the same error. Is there anyway to fix it? Thanks
As per #66 the current installation docs are incomplete. I'm also getting the error
fatal error: 'speechapi_c_error.h' file not found
, but I don't speak Chinese so can't follow that issue.Please complete the docs for how to install this SDK on a Mac