我正在尝试按照此链接在Mac上部署一个Qt程序。通过对我的可执行文件及其依赖库运行otool -L,我将它们复制到应用程序包中后,在QtCreator的应用程序输出中运行时出现以下错误:
此应用程序无法启动,因为找不到或加载Qt平台插件“cocoa”。
重新安装应用程序可能会解决此问题。 程序意外终止。
我已尝试复制qt平台插件libqcocoa.dylib并更改qt.conf中的插件目录如此, 但仍然失败。
值得注意的是,我首先尝试使用qt的macdeployqt工具,但尽管这是我第一次在可执行文件上运行它,但它仍然失败并显示以下消息:
错误:无法找到“MyProgram.app/Contents/MacOS/MyProgram”的bundle二进制文件 错误:“otool:无法打开文件:(没有这样的文件或目录)” 警告: 警告:在“MyProgram.app/Contents/MacOS/MyProgram”中找不到任何外部Qt框架 警告:也许macdeployqt已经在“MyProgram.app/Contents/MacOS/MyProgram”上使用过? 警告:如果是这样,您需要在再次尝试之前重新构建“MyProgram.app/Contents/MacOS/MyProgram” 错误:无法找到“MyProgram.app/Contents/MacOS/MyProgram”的bundle二进制文件 错误:从“/Developer/Applications/Qt/plugins/platforms/libqcocoa.dylib”复制文件失败 到“MyProgram.app/Contents/MacOS/MyProgram/Contents/PlugIns/platforms/libqcocoa.dylib” 错误:从“/Developer/Applications/Qt/plugins/printsupport/libcocoaprintersupport.dylib”复制文件失败 到“MyProgram.app/Contents/MacOS/GraphiteMiniEditor/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib”