Qt5 installed on CentOS 7, Qt application windows not showing up



  • Hi,

    I've recently built and installed Qt5.6.0 from source on a CentOS 7 machine ( CentOS Linux release 7.2.1511 (Core) ). I originally built Qt5.5.1 on this machine, but I had the same issue below.

    I've been having an issue where my Qt applications don't launch properly (no windows show up). I've checked that X11 is working with the xeyes and xclock utilities, and those work correctly. (I have also built and installed Qt5.5.1 on Fedora21, Debian 8, and Ubuntu 14, and I don't have this issue on these systems.)

    I've created a simple application:

    #include <QApplication>
    #include <QMainWindow>
    
    int main(int argc, char *argv[]) {
      QApplication app(argc, argv);
      QMainWindow w;
      w.setVisible(true);
      return app.exec();
    }
    // EOF
    

    When I try to run this application on my CentOS 7 machine, the main window never shows up on screen.

    I tried using gdb to see what was going on. I ended up setting a break point at line 7 ( w.setVisible(true) ), and then stepping to see what would happen. It seems that this line was having issues as nothing happened. After waiting a while, I sent an INTERRUPT and then did a backtrace, yielding the following:

    #0  0x00007ffff5c0c6d5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    #1  0x00007ffff27e04a9 in _xcb_conn_wait () from /lib64/libxcb.so.1
    #2  0x00007ffff27e1c9f in wait_for_reply () from /lib64/libxcb.so.1
    #3  0x00007ffff27e1db2 in xcb_wait_for_reply () from /lib64/libxcb.so.1
    #4  0x00007ffff2c89b41 in dri3_create_screen () from /lib64/libGL.so.1
    #5  0x00007ffff2c5d719 in __glXInitialize () from /lib64/libGL.so.1
    #6  0x00007ffff2c592a7 in glXGetFBConfigs () from /lib64/libGL.so.1
    #7  0x00007ffff2c5a0b6 in glXChooseFBConfigSGIX () from /lib64/libGL.so.1
    #8  0x00007ffff7f477df in ?? ()
       from /local/v006/plugins/xcbglintegrations/libqxcb-glx-integration.so
    #9  0x00007ffff7f479c9 in ?? ()
       from /local/v006/plugins/xcbglintegrations/libqxcb-glx-integration.so
    #10 0x00007fffe8b25fac in QXcbWindow::create() ()
       from /local/v006/lib/libQt5XcbQpa.so.5
    #11 0x00007fffe8b12642 in QXcbIntegration::createPlatformWindow(QWindow*) const ()
       from /local/v006/lib/libQt5XcbQpa.so.5
    #12 0x00007ffff748dfcd in QWindowPrivate::create(bool) ()
       from /local/v006/lib/libQt5Gui.so.5
    #13 0x00007ffff6ecd9a3 in QWidgetPrivate::create_sys(unsigned long long, bool, bool) ()
       from /local/v006/lib/libQt5Widgets.so.5
    #14 0x00007ffff6ecce2e in QWidget::create(unsigned long long, bool, bool) ()
       from /local/v006/lib/libQt5Widgets.so.5
    #15 0x00007ffff6ed821a in QWidget::setVisible(bool) ()
       from /local/v006/lib/libQt5Widgets.so.5
    #16 0x0000000000400ae1 in main (argc=1, argv=0x7fffffffdec8) at X11test.cpp:7
    

    If this is useful, I have the config log for my Qt5 build as well:

    Build type:    linux-g++ (x86_64, CPU features: mmx sse sse2)
    Platform notes:
    
    Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
            
    qmake vars .......... styles += mac fusion windows DEFINES += QT_NO_MTDEV CONFIG += use_libmysqlclient_r QT_LIBS_DBUS = -L/lib64 -ldbus-1   QT_CFLAGS_DBUS = -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include   QT_HOST_CFLAGS_DBUS = -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include   QT_CFLAGS_GLIB = -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   QT_LIBS_GLIB = -pthread -lgthread-2.0 -lglib-2.0   QT_CFLAGS_PULSEAUDIO = -D_REENTRANT -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   QT_LIBS_PULSEAUDIO = -lpulse-mainloop-glib -lpulse -lglib-2.0   QMAKE_INCDIR_OPENGL =  "/usr/include/libdrm" QMAKE_LIBDIR_OPENGL =  QMAKE_LIBS_OPENGL =  "-lGL" QMAKE_CFLAGS_OPENGL =  QMAKE_CFLAGS_FONTCONFIG = -I/usr/include/freetype2   QMAKE_LIBS_FONTCONFIG = -lfontconfig -lfreetype   QMAKE_INCDIR_LIBUDEV =   QMAKE_LIBS_LIBUDEV = -ludev   DEFINES += QT_NO_TSLIB QMAKE_INCDIR_XKBCOMMON_EVDEV =   QMAKE_LIBS_XKBCOMMON_EVDEV = -lxkbcommon   DEFINES += QT_NO_LIBINPUT QMAKE_LIBXI_VERSION_MAJOR = 1 QMAKE_LIBXI_VERSION_MINOR = 7 QMAKE_LIBXI_VERSION_PATCH = 4 QMAKE_X11_PREFIX = /usr QMAKE_XKB_CONFIG_ROOT = /usr/share/X11/xkb QMAKE_INCDIR_EGL = /usr/include/libdrm   QMAKE_LIBS_EGL = -lEGL   QMAKE_CFLAGS_EGL =   QMAKE_CFLAGS_XCB =   QMAKE_LIBS_XCB = -lxcb   sql-drivers =  sql-plugins =  mysql psql sqlite qmake switches ......... 
    
    Build options:
      Configuration .......... accessibility accessibility-atspi-bridge alsa audio-backend avx avx2 c++11 clock-gettime clock-monotonic compile_examples concurrent cups dbus dbus-linked egl eglfs egl_x11 enable_new_dtags evdev eventfd fontconfig full-config getaddrinfo getifaddrs glib harfbuzz iconv icu inotify ipv6ifname kms large-config largefile libudev linuxfb medium-config minimal-config mremap nis opengl openssl png posix_fallocate precompile_header pulseaudio qpa qpa reduce_exports reduce_relocations release rpath shared small-config sse2 sse3 sse4_1 sse4_2 ssse3 system-freetype system-jpeg system-png system-zlib threadsafe-cloexec use_gold_linker xcb xcb-plugin xcb-qt xcb-sm xcb-xlib xinput2 xkbcommon-evdev xkbcommon-qt xlib xrender 
      Build parts ............ libs tools examples
      Mode ................... release
      Using sanitizer(s)...... none
      Using C++ standard ..... c++11
      Using gold linker....... yes
      Using new DTAGS ........ yes
      Using PCH .............. yes
      Using LTCG ............. no
      Target compiler supports:
        SSE2/SSE3/SSSE3 ...... yes/yes/yes
        SSE4.1/SSE4.2 ........ yes/yes
        AVX/AVX2 ............. yes/yes
    
    Qt modules and options:
      Qt D-Bus ............... yes (linked to dbus-1)
      Qt Concurrent .......... yes
      Qt GUI ................. yes
      Qt Widgets ............. yes
      Large File ............. yes
      QML debugging .......... yes
      Use system proxies ..... no
    
    Support enabled for:
      Accessibility .......... yes
      ALSA ................... yes
      CUPS ................... yes
      Evdev .................. yes
      FontConfig ............. yes
      FreeType ............... yes (system library)
      Glib ................... yes
      GStreamer .............. no
      GTK theme .............. no
      HarfBuzz ............... yes (bundled copy)
      Iconv .................. yes
      ICU .................... yes
      Image formats: 
        GIF .................. yes (plugin, using bundled copy)
        JPEG ................. yes (plugin, using system library)
        PNG .................. yes (in QtGui, using system library)
      libinput................ no
      Logging backends: 
        journald ............... no
        syslog   ............... no
      mtdev .................. no
      Networking: 
        getaddrinfo .......... yes
        getifaddrs ........... yes
        IPv6 ifname .......... yes
        libproxy.............. no
        OpenSSL .............. yes (loading libraries at run-time)
      NIS .................... yes
      OpenGL / OpenVG: 
        EGL .................. yes
        OpenGL ............... desktop
        OpenVG ............... no
      PCRE ................... system
      pkg-config ............. yes 
      PulseAudio ............. yes
      QPA backends: 
        DirectFB ............. no
        EGLFS ................ yes
          EGLFS i.MX6 ........ no
          EGLFS i.MX6 Wayland. no
          EGLFS EGLDevice .... no
          EGLFS GBM .......... no
          EGLFS Mali ......... no
          EGLFS Raspberry Pi . no
          EGLFS X11 .......... yes
        LinuxFB .............. yes
        Mir client............ no
        XCB .................. yes (bundled copy)
          EGL on X ........... yes
          GLX ................ no
          MIT-SHM ............ yes
          Xcb-Xlib ........... yes
          Xcursor ............ yes (loaded at runtime)
          Xfixes ............. yes (loaded at runtime)
          Xi ................. no
          Xi2 ................ yes
          Xinerama ........... yes (loaded at runtime)
          Xrandr ............. yes (loaded at runtime)
          Xrender ............ yes
          XKB ................ yes
          XShape ............. yes
          XSync .............. yes
          XVideo ............. yes
      Session management ..... yes
      SQL drivers: 
        DB2 .................. no
        InterBase ............ no
        MySQL ................ yes (plugin)
        OCI .................. no
        ODBC ................. no
        PostgreSQL ........... yes (plugin)
        SQLite 2 ............. no
        SQLite ............... yes (plugin, using bundled copy)
        TDS .................. no
      tslib .................. no
      udev ................... yes
      xkbcommon-x11........... yes (bundled copy, XKB config root: /usr/share/X11/xkb)
      xkbcommon-evdev......... yes
      zlib ................... yes (system library)
    

    I'm not too sure how to proceed to try to fix this issue. Any ideas?



  • @ianh
    What happens if you remove

    w.setVisible(true);

    as this should not be necessary...



  • @KeithS
    The window still doesn't show up. From gdb it seems like the Qt event loop is working though.

    Using host libthread_db library "/lib64/libthread_db.so.1".
    [New Thread 0x7fffe73ec700 (LWP 13467)]
    [New Thread 0x7fffe69e0700 (LWP 13468)]
    Detaching after fork from child process 13469.
    ^C
    Program received signal SIGINT, Interrupt.
    0x00007ffff5f08bcd in poll () from /lib64/libc.so.6
    Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-13.el7.x86_64 dbus-libs-1.6.12-13.el7.x86_64 elfutils-libelf-0.163-3.el7.x86_64 elfutils-libs-0.163-3.el7.x86_64 expat-2.1.0-8.el7.x86_64 fontconfig-2.10.95-7.el7.x86_64 freetype-2.4.11-11.el7.x86_64 glib2-2.42.2-5.el7.x86_64 glibc-2.17-106.el7_2.1.x86_64 libICE-1.0.9-2.el7.x86_64 libSM-1.2.2-2.el7.x86_64 libX11-1.6.3-2.el7.x86_64 libXau-1.0.8-2.1.el7.x86_64 libXcursor-1.1.14-2.1.el7.x86_64 libXdamage-1.1.4-4.1.el7.x86_64 libXext-1.3.3-3.el7.x86_64 libXfixes-5.0.1-2.1.el7.x86_64 libXi-1.7.4-2.el7.x86_64 libXrender-0.9.8-2.1.el7.x86_64 libXxf86vm-1.1.3-2.1.el7.x86_64 libattr-2.4.46-12.el7.x86_64 libcap-2.22-8.el7.x86_64 libdrm-2.4.60-3.el7.x86_64 libgcc-4.8.5-4.el7.x86_64 libicu-50.1.2-15.el7.x86_64 libpng-1.5.13-7.el7_2.x86_64 libselinux-2.2.2-6.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64 libuuid-2.23.2-26.el7.x86_64 libxcb-1.11-4.el7.x86_64 libxshmfence-1.2-1.el7.x86_64 mesa-libEGL-10.6.5-3.20150824.el7.x86_64 mesa-libGL-10.6.5-3.20150824.el7.x86_64 mesa-libgbm-10.6.5-3.20150824.el7.x86_64 mesa-libglapi-10.6.5-3.20150824.el7.x86_64 pcre-8.32-15.el7.x86_64 systemd-libs-219-19.el7.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64
    (gdb) bt
    #0  0x00007ffff5f08bcd in poll () from /lib64/libc.so.6
    #1  0x00007ffff3353a84 in g_main_context_iterate.isra.24 () from /lib64/libglib-2.0.so.0
    #2  0x00007ffff3353bac in g_main_context_iteration () from /lib64/libglib-2.0.so.0
    #3  0x00007ffff7bd9b9c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /local/v006/lib/libQt5Core.so.5
    #4  0x00007ffff7b87ceb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
       from /local/v006/lib/libQt5Core.so.5
    #5  0x00007ffff7b8fa46 in QCoreApplication::exec() ()
       from /local/v006/lib/libQt5Core.so.5
    #6  0x0000000000400a85 in main (argc=1, argv=0x7fffffffdeb8) at X11test.cpp:8
    
    


  • @ianh

    Just looked at an example of mine and I have w.show() instead of w.setVisible(true)



  • @KeithS
    I've tried this code with show() as well and it didn't work. I think show() and setVisible(true) both can be used to show a widget.

    Also, it may be worth mentioning that I cannot run the basic examples (such as analogclock and calculator) on my CentOS 7 Qt5 build. Running these examples gives me the same problem where no windows are ever displayed. (I can successfully run the basic examples on my Fedora21, Debian 8, and Ubuntu 14 Qt5 builds.)

    I'm rebuilding Qt5.5.1 on CentOS 7 with the -debug flag set, so maybe I can get a lead or some more information with the Qt debug libraries.



  • @ianh

    yes I think you're right, setVisible() and show() appear to do the same thing.

    I am running CentOS7 with Qt 5.5.0 on VMware and it seems to be fine. From your backtrace it seems to be a display issue with OpenGL. Are you running with native graphics card drivers or with mesa? Have you tried updating the drivers if applicable? And does glxinfo give any clues?



  • @KeithS
    You're right, it does seem like a rendering issue regarding glx.

    I was ssh'ing with X11 fowarding to the CentOS 7 machine, so my host machine (running Fedora 21) was actually doing the rendering. Trying to run glxgears hanged as well.

    I actually tried ssh'ing from a windows desktop (with xming and putty) to this CentOS 7 machine and running glxgears, and it works! So it seems like it is a rendering issue or Xserver issue with my Fedora 21 desktop, not a Qt5 issue...

    Thank you for all the help!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.