Adding external libraries deploying QT app mac OSX

后端 未结 2 1558
情深已故
情深已故 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

    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.

提交回复
热议问题