You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

macOS 11.7运行Azure语音转文本工具遇DllNotFound异常求助

解决方案:Azure语音转文本在macOS 11.7上的System.DllNotFoundException问题

问题背景

使用Azure语音转文本工具时,尽管官方文档标注支持macOS 10.12,但在macOS 11.7的.NET项目中运行时抛出以下异常:

System.DllNotFoundException: Unable to load shared library 'libMicrosoft.CognitiveServices.Speech.core.dylib' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(/Users/jonataswalker/my_path/libMicrosoft.CognitiveServices.Speech.core.dylib.dylib, 1): Symbol not found: _ZNKSt3_115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv Referenced from: /Users/jonataswalker/my_path/libMicrosoft.CognitiveServices.Speech.core.dylib.dylib (which was built for Mac OS X 12.0

核心问题:当前项目依赖的libMicrosoft.CognitiveServices.Speech.core.dylib是针对macOS 12.0编译的,与你的macOS 11.7系统不兼容,导致缺失必要符号。


可行解决方案

1. 降级Azure语音SDK版本

部分新版本SDK默认采用了macOS 12作为最低编译目标,回退到明确支持macOS 11.x的旧版本即可解决:

  • 在NuGet包管理器中,将Microsoft.CognitiveServices.Speech包降级到1.25.0及之前的版本(该版本兼容macOS 10.12+,未切换高版本系统编译目标)。
  • 执行命令更新包:
    dotnet add package Microsoft.CognitiveServices.Speech --version 1.25.0
    

2. 手动替换兼容动态库

如果无法降级SDK,可手动替换项目中的动态库:

  • 从Azure语音SDK 1.25.0版本的macOS安装包中提取libMicrosoft.CognitiveServices.Speech.core.dylib。
  • 替换项目输出目录或依赖路径中的对应文件,确保使用的是针对macOS 10.12+编译的库文件。

3. 调整项目框架与运行时设置

  • 确认项目目标框架与macOS 11.7兼容(优先选择.NET 6/.NET 5,避免使用仅支持macOS 12+的框架版本)。
  • 在项目的.csproj文件中添加明确的运行时配置:
    <PropertyGroup>
      <RuntimeIdentifier>osx-x64</RuntimeIdentifier>
      <TargetFramework>net6.0</TargetFramework>
      <SupportedOSPlatformVersion>10.12</SupportedOSPlatformVersion>
    </PropertyGroup>
    

4. 补全系统依赖

确保macOS 11.7上安装了必要的系统依赖库:

  • 安装Xcode命令行工具,更新系统C++标准库:
    xcode-select --install
    
  • 通过Homebrew更新兼容的C++库:
    brew install libcxx
    

内容的提问来源于stack exchange,提问作者Jonatas Walker

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 03:05:05