在Ubuntu Server上运行QT应用程序时崩溃

时间:2018-09-27 00:18:29

标签: c++ qt ubuntu server

我看到,如果我在Ubuntu桌面版上运行QT应用程序,则可以运行该应用程序。如果我使用相同的应用程序并尝试在Ubuntu服务器版本上运行,则启动QT应用程序时会看到崩溃。到目前为止,我已经看到需要通过设置以下环境变量来将QT设置为渲染到屏幕外:

export QT_QPA_PLATFORM=offscreen

然后,当我运行应用程序时,我得到了堆栈跟踪,并导致应用程序崩溃:

Thread 3 "hmi" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7fa8700 (LWP 18084)]
0x00007fffdf88decb in ?? () from /Qt5.6.2/5.6/gcc_64/plugins/platforms/libqoffscreen.so
(gdb) bt
#0  0x00007fffdf88decb in ?? () from /Qt5.6.2/5.6/gcc_64/plugins/platforms/libqoffscreen.so
#1  0x00007fffdf88e283 in ?? () from /Qt5.6.2/5.6/gcc_64/plugins/platforms/libqoffscreen.so
#2  0x00007ffff399a78d in QOpenGLContext::create() () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Gui.so.5
#3  0x00007ffff41d2a67 in ?? () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Quick.so.5
#4  0x00007ffff41d32d2 in ?? () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Quick.so.5
#5  0x00007ffff39633ea in QWindow::event(QEvent*) () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Gui.so.5
#6  0x00007ffff4206553 in QQuickWindow::event(QEvent*) () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Quick.so.5
#7  0x00007ffff4eb25ca in QCoreApplication::notify(QObject*, QEvent*) () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Core.so.5
#8  0x00007ffff4eb2720 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Core.so.5
#9  0x00007ffff3958c69 in QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*) () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Gui.so.5
#10 0x00007ffff39597fd in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Gui.so.5
#11 0x00007ffff393aad3 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Gui.so.5
#12 0x00007fffdf88e3f0 in ?? () from /Qt5.6.2/5.6/gcc_64/plugins/platforms/libqoffscreen.so
#13 0x00007fffe9eb3197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007fffe9eb33f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007fffe9eb349c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff4f01f07 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Core.so.5
#17 0x00007ffff4eb076a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Core.so.5
#18 0x00007ffff4eb85fd in QCoreApplication::exec() () from /Qt5.6.2/5.6/gcc_64/lib/libQt5Core.so.5

我使用相同的应用程序并在屏幕外设置下运行,而在桌面版上,我没有看到相同的崩溃。我没有看到有关QT库libqoffscreen.so的太多信息,也找不到用于预建库的符号以获得更好的堆栈跟踪。为了让我运行此QT应用程序,我是否需要在Ubuntu服务器上安装任何东西?

1 个答案:

答案 0 :(得分:0)

您正在尝试使用Qt Quick,并且该方法不适用于屏幕外平台,因为那里不支持OpenGL。我不明白您为什么想要无头运行这样的应用程序-大概不会有用。由于它是您的代码,因此您不应该在无头模式下显示GUI:添加命令选项以在没有GUI的情况下启动,或者使用编译选项(例如,从makefile传递的宏)禁用GUI代码。