如何在Mac上部署我的应用程序助理,而不部署Qt Frameworks的多个副本? [英] How do I deploy Assistant with my app on Mac without deploying multiple copies of Qt Frameworks?

查看:245
本文介绍了如何在Mac上部署我的应用程序助理,而不部署Qt Frameworks的多个副本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试部署使用助手的Qt应用程序来显示帮助,Mac(OS X 10.6-10.9,Qt 4.8)

  QStringList args =-collectionFile+my_help_file; 
QString app =path /+Assistant.app;
m_helpProcess-> start(app,args);

我将Assistant.app放在Resources文件夹中。



由于我在没有安装qt的系统上部署应用程序,所以我将所有的QT依赖项放在Contents / Frameworks中,并运行了install_name_tool

 #用于QtCore:
install_name_tool -id @executable_path /../ Frameworks / QtCore.framework / Version / QtCore.framework / Versions / 4 / QtCore xxx.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore
install_name_tool -change QtCore.framework / Versions / 4 / QtCore @executable_path /../ Frameworks / QtCore.framework / Versions / 4 / QtCore xxx.app/Contents/MacOs/xxx

install_name_tool -change QtCore.framework / Versions / 4 / QtCore @executable_path /../ Frameworks / QtCore.framework / Versions / 4 / QtCore xxx.app/内容/资源/ Assistant.app / Contents / MacOS / Assistant

应用程序获取它,它是功能但是助手不...显然这是一个不同的层次。



我不想放置多个框架副本...除此之外我确信如果我有冲突的话做...



调用助手没有它的包没有工作...(我希望将可执行文件放在xxx可执行文件旁边)



由于我想我将框架的id设置为@executable_path中的一个目录,所以我无法在别的地方看到帮助...



如何将助理与框架正确连接?



注意:我尝试过:

 #用于QtCore:
install_name_tool -id @executable_path /../ Frameworks / QtCore.framework / Version / QtCore.framework / Versions / 4 / QtCore xxx.app/Contents /Frameworks/QtCore.framework/Versions/4/QtCore
install_name_tool -change QtCore.framework / Versions / 4 / QtCore @executable_path /../ Frameworks / QtCore.framework / Versions / 4 / QtCore xxx.app/Contents / MacOs / xxx

install_name_tool -change QtCore.framework / Versions / 4 / QtCore @executable_path /../../../ Frameworks / QtCore.framework / Versions / 4 / QtCore xxx.app /Contents/Resources/Assistant.app/Contents/MacOS/Assistant

没有找到图书馆...我猜这个id必须匹配路径...但是lib的一个实例,它只是不能...



我还试图对Qt库进行符号链接(别名?),在助理会看...它试图失败,抱怨格式错误的文件。



更新以回答评论:



在资源文件夹中的助手包中的助手上运行otool -L:

  @可执行文件路径/../框架/ QtCore.framework /版本/ 4 / QtCore 

找到真正在

  @executable_path /../../../ Frameworks / QtCore.framework /版本/ 4 / QtCore 


解决方案

意外的是,甚至从QT创建者之外。一旦我给了助理和资源文件绝对路径。 (我可以为助理可执行文件或整个软件包执行此操作)



我将可执行文件助手复制到与我的应用程序可执行文件相同的文件夹中。



当然,添加依赖库并将链接路径设置为@executable_path /../框架是必需的,如部署任何应用程序。 (我只是手动执行,而不是macdeployqt,因为macdeployqt无法复制插件)



很重要的是,需要获得助手所需的sqldrivers插件。而且...这是一个艰难的一个...设置框架上的插件的依赖关系。



自己的助手本来是很好的bundle(资源内部)...但是与Qt库依赖关系仍然在主包的资源中,以避免多次复制相同的库。我无法做到这一点将Qt框架放在捆绑包之外不是一个选择,因为我不能依靠用户不要删除项目或安装其他版本。


I am trying to deploy a Qt application that uses the Assistant to show help, on mac (OS X 10.6-10.9, Qt 4.8)

QStringList args = "-collectionFile " + "my_help_file";
QString app = "path/"+"Assistant.app";
m_helpProcess->start(app, args);

I placed the Assistant.app inside the Resources folder.

Since I deploy the app on a system with no qt installed, I placed all he QT dependencies in Contents/Frameworks, and ran install_name_tool

# for QtCore:
install_name_tool -id @executable_path/../Frameworks/QtCore.framework/Version/QtCore.framework/Versions/4/QtCore xxx.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore
install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore xxx.app/Contents/MacOs/xxx

install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore xxx.app/Contents/Resources/Assistant.app/Contents/MacOS/Assistant

The app gets it, it is functional, but Assistant doesn't... obviously it is a different level.

I don't want to place multiple copies of the frameworks... besides I am sure there will be conflicts if i do...

Calling Assistant without its bundle didn't work... (I would love to place the executable next to the xxx executable)

Since I guess I set the id for the Frameworks as one directory down from @executable_path, I can't tell help to look elsewhere...

How do I link the Assistant properly with the Frameworks ?

Note: I have tried:

# for QtCore:
install_name_tool -id @executable_path/../Frameworks/QtCore.framework/Version/QtCore.framework/Versions/4/QtCore xxx.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore
install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore xxx.app/Contents/MacOs/xxx

install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../../../Frameworks/QtCore.framework/Versions/4/QtCore xxx.app/Contents/Resources/Assistant.app/Contents/MacOS/Assistant

Did not find libraries... I guess the id has to match the path... but for a single instance of the lib, it just can't...

I also tried to make symbolic link (alias ?) to the Qt library, in the location where Assistant will look... It tried and failed, complaining of a malformed file.

Update to answer comment:

Running otool -L on the assistant in the Assistant bundle in the Resources folder:

@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore

And the Assistant can't find the library which really is at

@executable_path/../../../Frameworks/QtCore.framework/Versions/4/QtCore 

解决方案

Unexpectedly, the Assistant opened correctly even from outside the QT Creator.. Once I gave both the assistant and the resource file absolute paths. (I could have done that for either the Assistant executable or an entire bundle)

I copied the executable Assistant inside the same folder as my app executable.

Of course, adding dependent libraries and setting the link paths to @executable_path/../Frameworks was required, like for deploying any app. (I just did it manually, not with macdeployqt because macdeployqt failed to copy the plugins)

And quite important, getting the sqldrivers Plugin required for Assistant was needed. And... that was a tough one... setting the dependencies for the Plugin on Frameworks as well.

It would have been great to have the Assistant in its own bundle (inside Resources)... but with the Qt library dependencies still in the resources of the main bundle, to avoid copying the same libraries multiple times. I was unable to do that. Placing Qt frameworks outside the bundle was not an option, since I cannot rely on users not to remove items or install other versions.

这篇关于如何在Mac上部署我的应用程序助理,而不部署Qt Frameworks的多个副本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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