我正在准备一个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
&相关的代码行。如{Qt的以下官方链接中所述install_name_tool
:
http://doc.qt.io/qt-5/osx-deployment.html#macdeploy
它对哪些工具和&什么在Qt之下工作以获得最终的.app,但是我无法弄清楚究竟要放在我的脚本中,以便我得到一个MyApp.app与Qt库静态链接,Qt库在构建后在我的osx机器上运行。 / p>
问题:
有人可以在macdeployqt命令之后指出要在我的脚本中添加什么来为OSX获取正确的MyApp.app吗?
顺便说一下,在MyApp上运行otool
命令会给出以下输出:
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)