Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Deploying project with OpenCV and FFMPEG Error
Clarky last edited by Clarky
I'm trying to deploy an application that uses opencv and ffmpeg on OSX however I'm getting a crash at run time where the application is looking for a dylib.
Dyld Error Message: Library not loaded: /usr/local/Cellar/ffmpeg/4.1.3/lib/libswresample.3.dylib Referenced from: /Applications/myApp.app/Contents/Frameworks/libavcodec.58.dylib Reason: image not found
I can see all the libraries within the package contents after I've ran macdeploy. I have tried using the intall_name_tool to try and fix this issue with the following command:
install_name_tool -change /usr/local/Cellar/ffmpeg/4.1.3/lib/libswresample.3.dylib @executable_path/libswresample.3.dylib /Users/me/code/build_output/MyAppQML/myApp.app/Contents/Frameworks/libavcodec.58.dylib
The command runs however when I check the library with otool -L nothing has changed.
@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)
Am I using the correct parameters for the install_name_tool?
Im using QT 5.12.1 and Xcode 9.4.1.
Im also using this in my shared.pri file:
QT_CONFIG -= no-pkg-config CONFIG += link_pkgconfig PKGCONFIG += opencv
Hi and welcome to devnet,
From the looks of it, the command is correct. Note that your new path is wrong, it should be
Clarky last edited by
From the looks of it, the command is correct. Note that your new path is wrong, it should be @executable_path/../Frameworks/libswresample.3.dylib
Hey, thanks for the reply, I fixed my command using your suggestion and managed to get my app working until it comes to the part with opencv where it just crashes.
Dyld Error Message: Symbol not found: ___emutls_get_address Referenced from: /Applications/myApp.app/Contents/MacOS/../Frameworks/libgomp.1.dylib Expected in: /usr/lib/libSystem.B.dylib
I've tried using the tool again to fix this but I'm not sure if that's the correct way to fix the issue as its a symbol issue rather than a library problem?
Clarky last edited by Clarky
Managed to fix this by using:
install_name_tool -change /usr/local/lib/gcc/8/libgcc_s.1.dylib @executable_path/../Frameworks/libgcc_s.1.dylib /Applications/myApp.app/Contents/Frameworks/libgomp.1.dylib
libgomp.1.dylib was originally pointing to an older version of gcc inside /usr/local/lib/gcc
Thanks for your help!