刚刚完成了以下教程:http: //qt-project.org/doc/qt-4.8/deployment-mac.html#the-bundle
当我在我的应用程序上运行 otool 时,它看起来像这样:
qjson.framework/Versions/0/qjson (compatibility version 0.7.0, current version 0.7.1)
libboost_date_time.dylib (compatibility version 0.0.0, current version 0.0.0)
libQt.Shared.1.dylib (compatibility version 1.0.0, current version 1.0.0)
libQt.Framework.1.dylib (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.1)
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.1)
@executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.1)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
在我这样做之前它运行良好并指向这个:
/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.1)
/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.1)
/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.1)
现在,当我打开我的应用程序时,它会立即崩溃。当我尝试在终端中打开它时,出现以下问题:
objc[44337]: Class QNSImageView is implemented in both
/Users/me/MyApp/MyApp.app/Contents/MacOS/./../Frameworks/QtGui.framework/Versions/4/QtGui and /Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
由“段错误”完成
我怎样才能使它不冲突?我尝试运行 Qts 部署脚本,但这也不起作用。我究竟做错了什么?
编辑:
我再次尝试使用他们的脚本,这次我做了以下内容:
macdeployqt MyApp.app -dmg -no-plugins
这创建了一个 .dmg,其中包含运行的我的应用程序。现在的问题是什么都没有发生,当我在终端中运行它时,我收到了这个错误:
QEventLoop: Cannot be used without QApplication
QEventLoop: Cannot be used without QApplication
我的事件循环发生了什么?自从我从 finder 完美运行它以及部署它并从 deplyod 版本运行它以来,我的应用程序没有任何改变。没有意义
更新:现在我尝试删除旧应用程序并使用 QtCreator 从头开始构建它。然后我做了以下事情:
bash-3.2$ /Users/me/Downloads/macdeployqt-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Release/macdeployqt/macdeployqt MyApp.app
copied "/Library/Frameworks/qjson.framework/Versions/0/qjson" to "MyApp.app/Contents/Frameworks/qjson.framework/Versions/0/qjson"
copied "/usr/lib/libboost_date_time.dylib" to "MyApp.app/Contents/Frameworks//libboost_date_time.dylib"
copied "/usr/lib/libQt.Shared.1.dylib" to "MyApp.app/Contents/Frameworks//libQt.Shared.1.dylib"
copied "/usr/lib/libQt.Framework.My.1.dylib" to "MyApp.app/Contents/Frameworks//libQt.Framework.My.1.dylib"
copied "/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/QtGui" to "MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui"
copied "/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Resources/qt_menu.nib/classes.nib" to "MyApp.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/classes.nib"
copied "/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Resources/qt_menu.nib/info.nib" to "MyApp.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/info.nib"
copied "/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib" to "MyApp.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib"
copied "/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/QtCore" to "MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore"
copied "/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtNetwork.framework/Versions/4/QtNetwork" to "MyApp.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork"
copied "/Users/me/QtSDK1.2.1/Desktop/Qt/4.8.1/gcc/lib/QtXml.framework/Versions/4/QtXml" to "MyApp.app/Contents/Frameworks/QtXml.framework/Versions/4/QtXml"
Deploying plugins from "/usr/plugins"
Created configuration file: "MyApp.app/Contents/Resources/qt.conf"
This file sets the plugin search path to "MyApp.app/Contents/plugins"
当我启动它时,它仍然崩溃,和以前一样。我的两个库“libQt.Shared.1.dylib”和“libQt.Framework.1.dylib”没有被称为,但它们都有与这些名称的符号链接。会不会跟坠机有关系?还是它会破坏链接并将它们复制到其中?这两个库是我自己完成的库,它们都使用 QtCore 和 QtNetwork。不过,使用 otool 时,该应用程序似乎指向了正确的东西:
@executable_path/../Frameworks/qjson.framework/Versions/0/qjson (compatibility version 0.7.0, current version 0.7.1)
@executable_path/../Frameworks/libboost_date_time.dylib (compatibility version 0.0.0, current version 0.0.0)
@executable_path/../Frameworks/libQt.Shared.1.dylib (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/libQt.Framework.My.1.dylib (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.1)
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.1)
@executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.1)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
请帮我...