添加部署QT App Mac OSX的外部库 [英] Adding external libraries deploying QT app mac OSX

查看:286
本文介绍了添加部署QT App Mac OSX的外部库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在部署使用openCV作为外部库的QT应用程序时,我遇到了困难。

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

http://doc.qt.io/qt-5/osx-deployment.html 页上显示:要在应用程序捆绑包中包含第3方库,请在创建捆绑包后手动将库复制到捆绑包中。
所以我应该在里面复制哪里.app 文件夹?

In http://doc.qt.io/qt-5/osx-deployment.html page it says : To include a 3rd party library in the application bundle, copy the library into the bundle manually, after the bundle is created. So where should I copy inside the.app folder?

http://www.dafscollaborative.org/opencv-deploy.html 博客说要使用 install_name_tool 通过Qt应用程序部署openCV,但是我不知道他使用的路径以及在我的情况下该错误。

Also http://www.dafscollaborative.org/opencv-deploy.html blog is saying to use install_name_tool to deploy openCV with Qt app, but the path that he is using is not clear to me and its giving error in my case.

那么,我应该怎么做才能用opencv库部署QT应用程序?

So, what should I do to deploy my QT app with opencv library?

运行 otool -L MyApplication.app/Contents/MacOS/MyApplication 给我以下内容:

@rpath/libopencv_calib3d.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_features2d.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_highgui.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_videoio.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_imgcodecs.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_video.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_photo.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_ml.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_imgproc.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_flann.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_core.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.10.0, current version 5.10.0)
@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.10.0, current version 5.10.0)
@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.10.0, current version 5.10.0)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
@rpath/QtXml.framework/Versions/5/QtXml (compatibility version 5.10.0, current version 5.10.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)


推荐答案

我不知道您是否找到答案,但这是解决方案:

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

编译应用程序后,您将获得一个捆绑包。使用macdeployqt将Qt框架嵌入包中。

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

然后,打开包,转到Contents / Frameworks,这里必须具有所有必要的Qt框架。只需在此处添加您的opencv库即可。

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.

注意事项

这篇关于添加部署QT App Mac OSX的外部库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆