Qt5找不到平台插件Mac OS X [英] Qt5 cannot find platform plugins Mac OS X

查看:575
本文介绍了Qt5找不到平台插件Mac OS X的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试根据此链接.在我的可执行文件及其所依赖的所有库上使用otool -L进行检查之后,将其复制到应用程序捆绑包中,尝试运行它时,在QtCreator的应用程序输出中出现此错误.

I am trying to deploy a Qt program on Mac according to this link. After going through with otool -L on my executable and all of the libraries that it depends on, which I copied into the application bundle, I get this error in QtCreator's application output when I try to run it.

此应用程序无法启动,因为无法找到或加载Qt平台插件"cocoa".

This application failed to start because it could not find or load the Qt platform plugin "cocoa".

重新安装应用程序可能会解决此问题. 该程序意外完成.

Reinstalling the application may fix this problem. The program has unexpectedly finished.

我尝试复制qt平台插件libqcocoa.dylib并更改qt.conf中的插件目录,

I've tried copying the qt platform plugins libqcocoa.dylib and changing the plugins directory in qt.conf, according to this, but it still fails.

值得一提的是,我第一次尝试使用qt的macdeployqt工具,但是尽管这是我第一次在可执行文件上运行它,但此消息却失败了:

Also worth pointing out, I first tried to use qt's macdeployqt tool, but it fails with this message, despite being the first time I run it on the executable:

错误:找不到"MyProgram.app/Contents/MacOS/MyProgram"的捆绑二进制文件 错误:工具:无法打开文件:(无此文件或目录)"

ERROR: Could not find bundle binary for "MyProgram.app/Contents/MacOS/MyProgram" ERROR: "otool: can't open file: (No such file or directory)"

警告:

警告:在"MyProgram.app/Contents/MacOS/MyProgram"中找不到要部署的任何外部Qt框架

WARNING: Could not find any external Qt frameworks to deploy in "MyProgram.app/Contents/MacOS/MyProgram"

警告:也许macdeployqt已在"MyProgram.app/Contents/MacOS/MyProgram"上使用?

WARNING: Perhaps macdeployqt was already used on "MyProgram.app/Contents/MacOS/MyProgram" ?

警告:如果是这样,您将需要在重新尝试之前重建"MyProgram.app/Contents/MacOS/MyProgram". 错误:找不到"MyProgram.app/Contents/MacOS/MyProgram"的捆绑二进制文件

WARNING: If so, you will need to rebuild "MyProgram.app/Contents/MacOS/MyProgram" before trying again. ERROR: Could not find bundle binary for "MyProgram.app/Contents/MacOS/MyProgram"

错误:"/Developer/Applications/Qt/plugins/platforms/libqcocoa.dylib"中的文件复制失败

ERROR: file copy failed from "/Developer/Applications/Qt/plugins/platforms/libqcocoa.dylib"

错误:到"MyProgram.app/Contents/MacOS/MyProgram/Contents/PlugIns/platforms/libqcocoa.dylib"

ERROR: to "MyProgram.app/Contents/MacOS/MyProgram/Contents/PlugIns/platforms/libqcocoa.dylib"

错误:"/Developer/Applications/Qt/plugins/printsupport/libcocoaprintersupport.dylib"中的文件复制失败

ERROR: file copy failed from "/Developer/Applications/Qt/plugins/printsupport/libcocoaprintersupport.dylib"

错误:到"MyProgram.app/Contents/MacOS/GraphiteMiniEditor/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib"

ERROR: to "MyProgram.app/Contents/MacOS/GraphiteMiniEditor/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib"

推荐答案

macdeployqt失败:似乎,对于macdeployqt的参数,您正在将路径传递给可执行文件,而不是捆绑软件的路径. IE.只需传递.../MyProgram.app而不是.../MyProgram.app/Contents/MacOS/MyProgram.

Re macdeployqt fails: it seems like, for the argument to macdeployqt you are passing the path to the executable instead of the path to the bundle. I.e. just pass .../MyProgram.app instead of .../MyProgram.app/Contents/MacOS/MyProgram.

(但是我也无法在沙盒应用程序中找到libqcocoa.我可能会静态地将其链接到我的应用程序中.)

(But I am also unable to get it find libqcocoa, in a sandboxed app. I may resort to linking that statically into my app.)

这篇关于Qt5找不到平台插件Mac OS X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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