Qt应用程序启动崩溃

时间:2014-05-14 05:59:19

标签: c++ linux qt crash x86-64

我正在做一个更大 - 仍然很小的游戏项目作为家庭作业。它基于Qt 4.8.6,在Windows 7 64位上运行完美。它也可以在64位Linux上编译,但在启动时崩溃。崩溃点似乎很常见,不同的堆栈跟踪,但我没有在网上找到我的情况,我不知道如何解决它。

我试过

  • 重新编译项目。重新编译Qt。
  • 搜索网络。再次。试。
  • 在gdb中上下移动(将使用调试符号重新编译qt)
  • 用strace观看,最后一次移动加载/usr/lib/libicudata.so.44

gdb backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000ecf720 in QResourceRoot::operator==(QResourceRoot const&) const ()
(gdb) bt
#0  0x0000000000ecf720 in QResourceRoot::operator==(QResourceRoot const&) const ()
#1  0x0000000000ecd175 in qRegisterResourceData (version=1, tree=0x10d8f60 "", name=0x10d8ee0 "", data=0x10d8320 "") at io/qresource.cpp:846
#2  0x0000000000bda227 in qInitResources_qmessagebox () at .rcc/debug-static/qrc_qmessagebox.cpp:257
#3  0x0000000000bda27a in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at .rcc/debug-static/qrc_qmessagebox.cpp:261
#4  0x0000000000bda2be in global constructors keyed to qrc_qmessagebox.cpp () at .rcc/debug-static/qrc_qmessagebox.cpp:270
#5  0x0000000000fee3e6 in __do_global_ctors_aux ()
#6  0x000000000040ee1b in _init ()
#7  0x0000000000000000 in ?? ()

(当Qt没有使用“-debug”时的原文:http://pastebin.com/6GsKDM8d

  • Application: public QApplication
  • 构造函数不执行任何操作,只需向前传递argcargv
  • 我没有全球Q件事。我没有一般的全局事物,只有一些简单的常量。

程序编译(每种示例):

  • uic:uic inc/ed/gomoku/ui/FEditProfile.ui -o inc/ed/gomoku/ui/FEditProfile.ui.h
  • moc:moc -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../thirdparty/qt/include inc/ed/gomoku/ui/FEditProfile.h -o inc/ed/gomoku/ui/FEditProfile.moc.cpp
  • cxx:g++ -DDEBUG -g -o inc/ed/gomoku/ui/FEditProfile.moc.o -c -fmessage-length=0 -fpermissive -Wall -Wextra -Wno-long-long -Wno-variadic-macros -Wno-unused-local-typedefs -MMD -MP -MF"inc/ed/gomoku/ui/FEditProfile.moc.d" -MT"inc/ed/gomoku/ui/FEditProfile.moc.d" -Iinc/ed -I../utils/inc/ed -I../ejson/inc/ed -I../thirdparty/boost -I../thirdparty/qt/include -c inc/ed/gomoku/ui/FEditProfile.moc.cpp
  • cxx:g++ -DDEBUG -g -o src/ed/gomoku/ui/FEditProfile.o -c -fmessage-length=0 -fpermissive -Wall -Wextra -Wno-long-long -Wno-variadic-macros -Wno-unused-local-typedefs -MMD -MP -MF"src/ed/gomoku/ui/FEditProfile.d" -MT"src/ed/gomoku/ui/FEditProfile.d" -Iinc/ed -I../utils/inc/ed -I../ejson/inc/ed -I../thirdparty/boost -I../thirdparty/qt/include -c src/ed/gomoku/ui/FEditProfile.cpp
  • link:g++ -DDEBUG -g -o gomoku_client gomoku_client.a ../ejson/ejson.a ../utils/utils.a ../thirdparty/boost/stage/lib/libboost_regex.a ../thirdparty/boost/stage/lib/libboost_date_time.a ../thirdparty/boost/stage/lib/libboost_filesystem.a ../thirdparty/boost/stage/lib/libboost_system.a ../thirdparty/boost/stage/lib/libboost_thread.a ../thirdparty/boost/stage/lib/libboost_chrono.a ../thirdparty/qt/lib_lin64/libQtGui.a ../thirdparty/qt/lib_lin64/libQtCore.a -lpthread -lz -ldl -lX11 -lXft -lXext -lglib-2.0 -lgthread-2.0 -lgobject-2.0 -lSM

ldd输出:

    linux-vdso.so.1 =>  (0x00007fff91fff000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f51ce520000)
    libz.so.1 => /usr/lib/libz.so.1 (0x00007f51ce309000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f51ce104000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f51cddc9000)
    libXft.so.2 => /usr/lib/libXft.so.2 (0x00007f51cdbb5000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f51cd9a2000)
    libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f51cd6c6000)
    libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f51cd4c2000)
    libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f51cd27a000)
    libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f51cd072000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f51ccd5e000)
    libm.so.6 => /lib/libm.so.6 (0x00007f51ccadb000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f51cc8c5000)
    libc.so.6 => /lib/libc.so.6 (0x00007f51cc563000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f51ce75c000)
    libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f51cc32d000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f51cc0a5000)
    libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f51cbe9b000)
    librt.so.1 => /lib/librt.so.1 (0x00007f51cbc92000)
    libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f51cba77000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f51cb85b000)
    libpcre.so.3 => /lib/libpcre.so.3 (0x00007f51cb62a000)
    libuuid.so.1 => /lib/libuuid.so.1 (0x00007f51cb426000)
    libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f51cb1fd000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f51caffa000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f51cadf5000)

Qt configure:./configure -prefix ~/local/qt -opensource -confirm-license -static -no-sql-sqlite -no-qt3support -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -qt-zlib -qt-libpng -qt-libtiff -qt-libmng -qt-libjpeg -no-openssl -nomake demos -nomake examples -no-nis -no-cups -no-iconv -no-dbus -no-opengl

/ proc / version:Linux version 2.6.32-5-amd64 (Debian 2.6.32-48squeeze4) (dannf@debian.org) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Mon Sep 23 22:14:43 UTC 2013

1 个答案:

答案 0 :(得分:0)

如果我们使用的qt include目录不完全适用于我们使用的库(.lib.a),则可能会发生错误的崩溃。应用程序可以在没有任何警告的情况下编译和链接,但可能很容易出现意外崩溃。