microsoft / cognitive-services-speech-sdk-go

Go bindings for the Microsoft Cognitive Services Speech SDK
MIT License
88 stars 29 forks source link

Finish installation documentation for macs #72

Closed boosh closed 1 year ago

boosh commented 2 years ago

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

ralph-msft commented 2 years 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

hyorigo commented 1 year ago

@ralph-msft Hi Microsoft guys! I just can't understand why does this SDK must use cgo? Any pure Go solutions?

jhakulin commented 1 year ago

@hyorigo The Speech SDK for Go depends on native C++ libraries which are called via C interface.

hyorigo commented 1 year ago

@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 🚢

jhakulin commented 1 year ago

@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.

jhakulin commented 1 year ago

closing as answered

OarkcnWang commented 1 year ago

@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: screenshot-20230305-155335 Maybe you need add some methods to deal this problem in QA part(if has and necessary). Thank you for reading! Wish good day!

Strider-Alex commented 1 year ago

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.

aetherwu commented 7 months ago

@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.

aetherwu commented 7 months ago

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:

https://learn.microsoft.com/en-us/azure/ai-services/speech-service/get-started-text-to-speech?tabs=macos%2Cterminal&pivots=programming-language-go

https://learn.microsoft.com/en-us/azure/ai-services/speech-service/quickstarts/setup-platform?tabs=macos%2Cubuntu%2Cdotnetcli%2Cdotnet%2Cjre%2Cmaven%2Cnodejs%2Cmac%2Cpypi&pivots=programming-language-go

bos-hieu commented 1 month ago

@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: screenshot-20230305-155335 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