Adding external libraries deploying QT app mac OSX

后端 未结 2 1557
情深已故
情深已故 2020-12-21 10:46

I am facing difficulty while deploying QT app which is using openCV as an external library.

In http://doc.qt.io/qt-5/osx-deployment.html page it says : To inc

相关标签:
2条回答
  • 2020-12-21 11:14

    I don't know if you have found the answer but here is a solution:

    After compiling your application, you have a bundle. Use macdeployqt to embed Qt frameworks in your bundle.

    After that, open your bundle, go to Contents/Frameworks, you must have all necessary Qt Frameworks here. Simply add your opencv libraries here.

    Your bundle now contains everything needed.

    Regards

    0 讨论(0)
  • 2020-12-21 11:14

    In macOS, a dylib has an embedded path to where it expects to be placed in the file system. Applications linking against those dylibs will expect to find the dylib in that location. This is the path that you can modify with install_name_tool and inspect with otool -L.

    @rpath is a placeholder that represents the runtime path of the application linking against the dll. The runtime path of the application is set by passing the -rpath flag to the linker. The runtime path itself can use the placeholder @executable_path, with which you can set paths relative to the executable.

    In your case, if you set -rpath @executable_path/../Frameworks, you must copy the Qt libraries to the Frameworks folder inside the application bundle for your application to find them.

    0 讨论(0)
提交回复
热议问题