0

我正在准备一个 shell 脚本来将我的 QtApp 构建为 OSX 的 .app。我在我的脚本中执行以下操作

qmake MyApp.pro -spec macx-clang CONFIG+=release CONFIG+=x86_64 CONFIG+=qml_debug
make
macdeployqt MyApp/MyApp.app

我得到了 MyApp.app。到这里为止都很棒!但是当我双击打开它时,我收到以下错误:

You can’t open the application “MyApp.app” because it is not supported on this type of Mac.

我试图围绕这个问题进行搜索。看起来我需要在我的脚本中添加更多与otool&相关的代码行,install_name_tool如 Qt 的以下官方链接中所述:http: //doc.qt.io/qt-5/osx-deployment.html#macdeploy

它公平地解释了哪些工具和在 Qt 下工作以获得最终的 .app,但我无法弄清楚到底要在我的脚本中放入什么,以便我得到一个与 Qt 库静态链接的 MyApp.app,该库在我的构建后的osx机器。

问题:
有人可以指出在 macdeployqt 命令之后要在我的脚本中添加什么来获得适用于 OSX 的正确 MyApp.app 吗?

顺便说一句,otool在 MyApp 上运行命令会给出以下输出:

otool -L MyApp.app/Contents/MacOS/MyApp
MyApp.app/Contents/MacOS/MyApp:
@rpath/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.6.0, current version 5.6.1)
@rpath/QtQml.framework/Versions/5/QtQml (compatibility version 5.6.0, current version 5.6.1)
@rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.6.0, current version 5.6.1)
@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.1)
/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/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.1)
/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 120.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
4

0 回答 0