无法在Macos上使用Azure Speech golang SDK

问题描述 投票:0回答:1

当我按照官方 guide 使用 Azure Speech SDK golang 时,出现

 Undefined symbols for architecture x86_64
错误。更改了架构值等,但没有用。

 /usr/local/Cellar/go/1.20.5/libexec/pkg/tool/darwin_amd64/link: running cc failed: exit status 1
 ld: warning: -no_pie is deprecated when targeting new OS versions
 ld: warning: ignoring file <speech-sdk-path>/lib/x86/libMicrosoft.CognitiveServices.Speech.core.so, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
 Undefined symbols for architecture x86_64:
   "_add_source_lang_config_to_auto_detect_source_lang_config", referenced from:
       __cgo_c0b4197be0b1_Cfunc_add_source_lang_config_to_auto_detect_source_lang_config in 000011.o
azure macos go azure-speech
1个回答
0
投票

我在认知服务-语音-sdk-go 存储库下的一个问题中找到了这些说明,我终于发现 Azure 指南未针对 MacOS 正确更新。

将语音 SDK 安装到您的 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"

设置 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"

此后,您应该能够在项目中使用 Azure Speech SDK golang。

© www.soinside.com 2019 - 2024. All rights reserved.