Apple M1设备ffmpeg依赖libmbedcrypto.13.dylib缺失求助
解决Apple M1设备上ffmpeg缺失libmbedcrypto.13.dylib的问题
问题重现
执行appium-doctor时触发ffmpeg报错,运行ffmpeg -version返回如下错误:
dyld[89251]: Library not loaded: '/opt/homebrew/opt/mbedtls/lib/libmbedcrypto.13.dylib' Referenced from: '/opt/homebrew/Cellar/librist/0.2.7_2/lib/librist.4.dylib' Reason: tried: '/opt/homebrew/opt/mbedtls/lib/libmbedcrypto.13.dylib' (no such file), '/usr/local/lib/libmbedcrypto.13.dylib' (no such file), '/usr/lib/libmbedcrypto.13.dylib' (no such file), '/opt/homebrew/Cellar/mbedtls/3.4.1/lib/libmbedcrypto.13.dylib' (no such file), '/usr/local/lib/libmbedcrypto.13.dylib' (no such file), '/usr/lib/libmbedcrypto.13.dylib' (no such file) zsh: abort ffmpeg -version
已尝试通过Homebrew卸载重装相关组件,但问题未解决。
解决方案
按顺序执行以下步骤:
重新安装并链接mbedtls
重装mbedtls并强制覆盖链接,确保系统能定位到正确的库文件:brew reinstall mbedtls brew link --overwrite mbedtls从源码编译安装librist
问题根源是librist依赖的mbedtls版本不匹配,源码编译可确保依赖关联正确:brew uninstall librist brew install librist --build-from-source彻底重装ffmpeg
卸载现有ffmpeg并重新安装,让它重新绑定正确的依赖链:brew uninstall --force ffmpeg brew install ffmpeg手动修正动态库路径(若上述步骤无效)
先查看librist的依赖路径:otool -L /opt/homebrew/Cellar/librist/0.2.7_2/lib/librist.4.dylib找到
libmbedcrypto.13.dylib的错误路径,用install_name_tool手动替换为当前mbedtls的实际安装路径(替换[你的mbedtls版本]为实际版本,比如3.4.1):install_name_tool -change /opt/homebrew/opt/mbedtls/lib/libmbedcrypto.13.dylib /opt/homebrew/Cellar/mbedtls/[你的mbedtls版本]/lib/libmbedcrypto.13.dylib /opt/homebrew/Cellar/librist/0.2.7_2/lib/librist.4.dylib
完成后运行ffmpeg -version验证修复效果,再执行appium-doctor检查状态。
内容的提问来源于stack exchange,提问作者moxspoy
相关产品推荐
相关产品推荐

