当我使用 opencv 和 ffmpeg dylibs 构建我的项目时,我的应用程序在出现错误时崩溃:
Dyld 错误消息:库未加载:/usr/local/Cellar/ffmpeg/4.1.3/lib/libswresample.3.dylib
引用自:/Applications/myApp.app/Contents/Frameworks/libavcodec.58.dylib 原因:找不到图像
我尝试使用 install_name_tool 尝试使用以下方法更改路径:
install_name_tool -change libavcodec.58.dylib
@executable_path/../Frameworks/libavcodec.58.dylib
/Users/me/code/build_output/MyAppQML/myApp.app/Contents/MacOS/myApp
尽管这修改了文件,但我仍然遇到相同的错误并在运行时崩溃。
install_name_tool 是否适合解决此问题,还是我应该看其他东西?
我在 libavcodec.58.dylib 上使用了 otool,这表明某些路径链接到 @executable_path
@executable_path/../Frameworks/libavcodec.58.dylib (compatibility version 58.0.0, current version 58.35.100)
/usr/local/Cellar/ffmpeg/4.1.3/lib/libswresample.3.dylib (compatibility version 3.0.0, current version 3.3.100)
/usr/local/Cellar/ffmpeg/4.1.3/lib/libavutil.56.dylib (compatibility version 56.0.0, current version 56.22.100)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
@executable_path/../Frameworks/liblzma.5.dylib (compatibility version 8.0.0, current version 8.4.0)
@executable_path/../Frameworks/libopencore-amrwb.0.dylib (compatibility version 1.0.0, current version 1.3.0)