我正在开发一个我希望在mac上部署的QT gui应用程序。通过各种论坛阅读后,我创建了一个包含框架和库的应用程序,但应用程序崩溃了。我已经验证应用程序在编译为命令行工具时有效。我在下面给出了步骤和输出,希望有人可以帮我解决问题。
我有三个静态链接的库,所以我认为它们不是问题:QGLViewer(http://www.libqglviewer.com/),GLE(http://www.linas.org/gle/)和GLEW。
1 - 我将代码编译为app-bundle,并检查lib依赖项:
otool -L ./AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer
./AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer:
/Users/bhatia4/macports/Library/Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.3.0, current version 5.3.2)
/Users/bhatia4/macports/Library/Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.2)
/Users/bhatia4/macports/Library/Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.2)
/Users/bhatia4/macports/Library/Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2)
/Users/bhatia4/macports/Library/Frameworks/QtXml.framework/Versions/5/QtXml (compatibility version 5.3.0, current version 5.3.2)
/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)
/Users/bhatia4/macports/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.20.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/Users/bhatia4/macports/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
2 - 我使用macdeployqt部署应用程序,并再次检查lib依赖项
otool -L ./AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer
./AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer:
@executable_path/../Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.3.0, current version 5.3.2)
@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.2)
@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.2)
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2)
@executable_path/../Frameworks/QtXml.framework/Versions/5/QtXml (compatibility version 5.3.0, current version 5.3.2)
/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)
@executable_path/../Frameworks/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.20.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
@executable_path/../Frameworks/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
3 - 这一切似乎都很好。但是,当我双击应用程序时,它会崩溃并显示以下错误日志。
Process: AtomTrajectoryViewer [12044]
Path:
/Users/USER/*/AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer
Identifier: com.yourcompany.AtomTrajectoryViewer
Version: ???
Code Type: X86-64 (Native)
Parent Process: launchd [432]
Responsible: AtomTrajectoryViewer [12044]
User ID: 37086
Date/Time: 2015-04-24 14:50:17.069 -0700
OS Version: Mac OS X 10.9.5 (13F1077)
Report Version: 11
Anonymous UUID: 3AD366C6-C5BA-EB79-EA67-6D293D1A8B8B
Sleep/Wake UUID: 962187D8-70E2-4886-8371-03303761E575
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8edec866 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff9a95435c pthread_kill + 92
2 libsystem_c.dylib 0x00007fff8e955b1a abort + 125
3 QtCore 0x0000000100cb5709 0x100c92000 + 145161
4 QtCore 0x0000000100cb6bb1 QMessageLogger::fatal(char const*, ...) const + 161
5 QtGui 0x0000000100815c08 QGuiApplicationPrivate::createPlatformIntegration() + 5672
6 QtGui 0x0000000100815c2b QGuiApplicationPrivate::createEventDispatcher() + 27
7 QtCore 0x0000000100e68401 QCoreApplication::init() + 113
8 QtCore 0x0000000100e68377 QCoreApplication::QCoreApplication(QCoreApplicationPrivate&) + 39
9 QtGui 0x000000010081338e QGuiApplication::QGuiApplication(QGuiApplicationPrivate&) + 14
10 QtWidgets 0x000000010022de0e QApplication::QApplication(int&, char**, int) + 206
11 com.yourcompany.AtomTrajectoryViewer 0x00000001000f28e9 main + 41
12 com.yourcompany.AtomTrajectoryViewer 0x0000000100003854 start + 52
Thread 1:
0 libsystem_kernel.dylib 0x00007fff8edece6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff9a954f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff9a957fb9 start_wqthread + 13
Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff8eded662 kevent64 + 10
1 libdispatch.dylib 0x00007fff990aa421 _dispatch_mgr_invoke + 239
2 libdispatch.dylib 0x00007fff990aa136 _dispatch_mgr_thread + 52
Thread 3:
0 libsystem_kernel.dylib 0x00007fff8edece6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff9a954f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff9a957fb9 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x00007fff7f5fe310 rcx: 0x00007fff5fbff418 rdx: 0x0000000000000000
rdi: 0x0000000000000707 rsi: 0x0000000000000006 rbp: 0x00007fff5fbff440 rsp: 0x00007fff5fbff418
r8: 0x0000000103700ac0 r9: 0x0000000000000000 r10: 0x0000000008000000 r11: 0x0000000000000206
r12: 0x0000000100f723c8 r13: 0x00000001032006c0 r14: 0x0000000000000006 r15: 0x00007fff5fbffbf0
rip: 0x00007fff8edec866 rfl: 0x0000000000000206 cr2: 0x0000000100b402f3
Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133
任何帮助,如果感激。如果错误可能需要更多详细信息,请与我们联系。感谢。