[SOLVED] qt-creator could not find or load the Qt platform plugin xcb ?



  • I am seeking advice on building and installing Qt and Qt Creator from source.

    I used the following to build from source under CentOS 6.4 64-bit under my non-root user account:

    @

    Build Qt5

    sudo yum install libxcb libxcb-devel xcb-util xcb-util-devel
    cd ~/projects
    git clone git://gitorious.org/qt/qt5.git qt5
    cd qt5
    git checkout stable
    perl init-repository
    ./configure -opensource -nomake examples -nomake tests -no-gtkstyle -confirm-license
    make
    export QTDIR=/home/esutton/projects/qt5/qtbase

    Build Qt Creator...

    cd ~/projects
    git clone git://gitorious.org/qt-creator/qt-creator.git
    cd qt-creator
    which qmake
    ${QTDIR}/bin/qmake -r
    make

    #Launch qtcreator
    ./bin/qtcreator &
    @

    • I receive the following error:
      @
      [1] 4136
      [esutton@centos64x64 qt-creator]$ This application failed to start because it could not find or load the Qt platform plugin "xcb".

    Reinstalling the application may fix this problem.
    @

    • libqxcb.so exists.
    • I tried setting the LD_LIBRAY_PATH to the containing ${QTDIR}/plugins/platforms folder.
      @
      ls -al ${QTDIR}/plugins/platforms
      total 1400
      drwxrwxr-x. 2 esutton esutton 4096 Jul 31 14:40 .
      drwxrwxr-x. 18 esutton esutton 4096 Jul 31 12:40 ..
      -rwxrwxr-x. 1 esutton esutton 177760 Jul 31 14:40 libqlinuxfb.so
      -rwxrwxr-x. 1 esutton esutton 33952 Jul 31 14:40 libqminimal.so
      -rwxrwxr-x. 1 esutton esutton 144672 Jul 31 14:40 libqoffscreen.so
      -rwxrwxr-x. 1 esutton esutton 1056912 Jul 31 14:40 libqxcb.so
      @

    Background:

    This is my first time building Qt from source. Previously I had downloaded the binary installers when I was working and targeting RHEL 5.2. Unfortunately the Standard C Libraries packaged with CentOS 6.4 are older than the pre-built Qt5 expects. It apeared building from source on CentOS 6.4 was the best solution for deploying Qt5 apps to stock CentOS 6.4 installations.

    Any tips or directions are much appreciated,

    -Ed


  • Moderators

    You forgot to mention or run make install for Qt. You need to run it for non-prefixed and non-developer builds. Also, make sure all dependencies from "the guide":http://qt-project.org/wiki/Building_Qt_5_from_Git are installed.



  • Thank you very much for your reply and suggestions.

    I used the guide you referenced and xcb is installed.

    I think I did do a "make install" but I did not understand what this did for a non- prefixed build or where it was installing to ?

    I will try a "make install" again. I am doing this in a VM and have taken so many snapshots, deleted, and reverted that I am not sure if the current state of the VM includes the make install. I will read up on prefix as well.

    Thanks again for your help.


  • Moderators

    XCB stuff might be just that something is still missing in the OS. Linux distro packagers vary a lot, a thing that works flawlessly on one distro can easily fail on another.

    As for prefix/ nonprefix stuff. I'll give you a short description. Just bear in mind I'm heavily biased in this area :P

    A "standard" way of installing Qt is to do it without a prefix. When you run "make", Qt is compiled and all libraries and headers remain inside your build directory (usually Qt source dir). When you run "make install", make copies libraries to standard OS-dependent set of locations (on linux it's /usr/bin for binaries, /usr/lib for libraries, etc. Other OSes copy the stuff to compeltely different locations). This makes Qt work without hassles, but you can't install another version in parallel (it would overwrite the current one) and is rather hard to track (as you've mentioned, files are copied all over the filesystem. It's even worse on Mac).

    Another approach (I'm using this one all the time) is to configure Qt using -prefix $PWD or -develope-build. This builds Qt inside source dir and running make install is not required. Resulting package is big (all sources, libs, headers, object files are there), but it's self contained: you can compile another in parallel, in another folder. When something fails, you simply remove the directory and your system remains clean. In order to use the package, you have to point the environment to it (add bin directory to $PATH, optionally add $QTDIR, too).



  • I * think * I have all xcb dependencies installed:
    @
    yum install libxcb libxcb-devel xcb-util xcb-util-devel
    rpm -qa |grep xcb
    libxcb-1.8.1-1.el6.x86_64
    xcb-util-devel-0.3.6-1.el6.x86_64
    libxcb-devel-1.8.1-1.el6.x86_64
    xcb-util-0.3.6-1.el6.x86_64
    @

    Thank you very much for detailing the "standard" way of installing Qt! I will try your approach.

    I am working on building a kickstart for a 64-bit CentOS 6.4 build machine that will be used to build and port our old 32-bit CentOS 5.2 software. The "-developer-build" option did not seem appropriate for a build machine that build software and makes RPM packages for distribution.

    Attempting to use Qt 5 installers downloaded fromhttp://qt-project.org resulted in complaints about the old packages used in CentOS 6.4 which are:
    @
    libstdc++-4.4.7-3.el6.x86_64
    gcc-4.4.7-3.el6.x86_64
    @

    So I * think * I need to build Qt5 from source to create a new build machine using the older CentOS 6.4 4.4.7 libraries. Does this make sense?

    Or is it better to upgrade to 4.7 versions of libc and libstdc++ and then build software releases using RPATH to a new 4.7 libstdc++.so that I deploy with my software?

    Opinions and recommendations are much appreciated.

    Thanks again,

    -Ed



  • All is good! Thank you!

    I discovered the Red Hat DevTools 1.1 for CentOS-5/6 x86_64 and updated GCC tools on my CentOS 6.4 build machine from gcc version 4.4.7 to 4.7.

    The devtools work great! I wished I had discovered them sooner. They use Software Collections (SCLs) that install all the tools under /opt directory without polluting any of the existing gcc version 4.4.7 CentOS 6.4 developer tools. Now if I could only figure out how to install and use both 32-bit and 64-bit Red Hat DevTools to build software apps under 64-bit CentoOS 6.4?

    Recipe used:
    @

    Install missing Qt build dependencies:

    yum install libxcb libxcb-devel xcb-util xcb-util-devel

    Install Red Hat DevTools 1.1 for CentOS-5/6 x86_64

    wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -O /etc/yum.repos.d/devtools-1.1.repo
    yum install devtoolset-1.1

    Open new terminal in ~/projects folder and enable devtoolset-1.1

    mkdir ~/projects
    cd ~/projects
    scl enable devtoolset-1.1 bash

    Test - Expect to see gcc version 4.7.2 ( * not * gcc version 4.4.7 )

    gcc -v

    Git Qt source

    git clone git://gitorious.org/qt/qt5.git qt5
    cd qt5
    git checkout stable
    perl init-repository

    Clean and configure

    Optional clean is needed if re-configuring

    git submodule foreach --recursive "git clean -dfx"
    ./configure -opensource -nomake examples -nomake tests -no-gtkstyle -confirm-license -qt-libpng -no-c++11

    If making on multi-core, for example a quad-core,use "make -j 4"

    make

    make install copies to /usr/local/Qt-5.1.2/

    Run as su or using sudo

    make install

    Build Qt Creator

    export QTDIR=/usr/local/Qt-5.1.2/

    Git Qt Creator source

    cd ~/projects
    git clone git://gitorious.org/qt-creator/qt-creator.git
    cd qt-creator

    ${QTDIR}/bin/qmake -r
    make

    ./bin/qtcreator &
    @

    Thanks again for your help!

    -Ed


  • Moderators

    I think it's a good candidate for posting on a wiki. Care to update "the guide":http://qt-project.org/wiki/Building_Qt_5_from_Git yourself or should I do it? I think a lot of people can benefit from your description - questions about building on CentOS are rather frequent.



  • Sure, I'll take a stab at it.

    Thanks!



  • I changed my mind. Can you please update the guide for me?

    It was not clear to me how you would edit an existing wiki article without damaging existing content. I am used to MediaWiki.

    Thanks!

    -Ed


  • Moderators

    OK no problem, I'll do it right away.

    Edit: done.



  • EdOfTheMountain's guide doesn't work for me.

    [quote author="EdOfTheMountain" date="1375458145"]
    make
    [/quote]

    @.obj/moc_qqmlvaluetype_p.o: file not recognized: File format not recognized
    collect2: error: ld returned 1 exit status
    make[3]: *** [../../lib/libQt5Qml.so.5.2.0] Error 1
    make[3]: Leaving directory /opt/sw/qt5/qt5/qtdeclarative/src/qml' make[2]: *** [sub-qml-make_first-ordered] Error 2 make[2]: Leaving directory/opt/sw/qt5/qt5/qtdeclarative/src'
    make[1]: *** [sub-src-make_first] Error 2
    make[1]: Leaving directory `/opt/sw/qt5/qt5/qtdeclarative'
    make: *** [module-qtdeclarative-make_first] Error 2@



  • Hi guys,

    I followed the steps listed but with yesterday's source and on centos 6.4 and everything works fine, except for the mouse scroll wheel. I VNC into the box that qt-creator compiled and installed from sources, but VNC or no VNC, the scrollwheel just doesn't work. I recompiled Qt and Qt-Creator a number of times but still no go. I have all the xcb packages installed but the scrollwheel just doesn't work. Did anyone experience this issue?

    Thanks


  • Moderators

    No, I have not had that problem. Check out the configure output: maybe there are some hints there.



  • I checked the output and didn't find anything out of the norms. Let me post the output here, maybe your eyes may find something.

    @
    Configure summary

    Build type: linux-g++ (x86_64, CPU features: mmx sse sse2)
    Platform notes:

            - Also available for Linux: linux-kcc linux-icc linux-cxx
    

    Build options:
    Configuration .......... accessibility accessibility-atspi-bridge alsa audio-backend avx avx2 clock-gettime clock-monotonic compile_examples concurrent dbus evdev eventfd fontconfig full-config getaddrinfo getifaddrs glib iconv inotify ipv6ifname large-config largefile linuxfb medium-config minimal-config mremap nis no-harfbuzz opengl openssl pcre 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-zlib xcb xcb-glx xcb-plugin xcb-render xcb-sm xcb-xlib xinput2 xkbcommon-qt xlib xrender
    Build parts ............ libs tools
    Mode ................... release
    Using C++11 ............ no
    Using PCH .............. yes
    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 (loading dbus-1 at runtime)
    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 ................... no
    FontConfig ............. yes
    FreeType ............... yes (system library)
    Glib ................... yes
    GTK theme .............. no
    HarfBuzz ............... no
    Iconv .................. yes
    ICU .................... no
    Image formats:
    GIF .................. yes (plugin, using bundled copy)
    JPEG ................. yes (plugin, using system library)
    PNG .................. yes (in QtGui, using bundled copy)
    journald ............... no
    mtdev .................. no
    Networking:
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    OpenSSL .............. yes (loading libraries at run-time)
    NIS .................... yes
    OpenGL / OpenVG:
    EGL .................. no
    OpenGL ............... desktop
    OpenVG ............... no
    PCRE ................... yes (bundled copy)
    pkg-config ............. yes
    PulseAudio ............. yes
    QPA backends:
    DirectFB ............. no
    EGLFS ................ no
    KMS .................. no
    LinuxFB .............. yes
    XCB .................. yes (system library)
    EGL on X ........... no
    GLX ................ yes
    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 ................ no
    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
    udev ................... no
    xkbcommon .............. yes (bundled copy, XKB config root: /usr/share/X11/xkb)
    zlib ................... yes (system library)

    NOTE: libxkbcommon and libxkbcommon-x11 0.4.0 or higher not found on the system, will use
    the bundled version from 3rd party directory.

    Qt is now configured for building. Just run 'gmake'.
    Once everything is built, you must run 'gmake install'.
    Qt will be installed into /usr/local/Qt-5.3.0

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.

    @


  • Moderators

    Looks good to me, too...



  • Would this qualify as a bug? I can reproduce this everytime on a Centos 6.4 and 6.5.


  • Moderators

    Yes, please "report it":https://qt-project.org/wiki/ReportingBugsInQt.

    The wiki page is not part of documentation per se, so you can't claim it's a bug because a thing from the docs is not working, but I think it's important to notify the Qt dev that something is wrong.



  • Hi sierdzio,

    Apparently, there is an existing "bug":https://bugreports.qt-project.org/browse/QTBUG-38169 with 5.3beta1, which I am experiencing since I cloned a few days back. I read the bug report and it looks like 5.2.1 was all good. I want to follow the same instructions listed on this post to "build 5.2.1 from source.":http://download.qt-project.org/official_releases/qt/5.2/5.2.1/single/ .Would they work? The file I was hoping to download is qt-everywhere-opensource-src-5.2.1.tar.gz.

    Thanks.


  • Moderators

    [quote author="alphabit" date="1398321241"]Would they work? The file I was hoping to download is qt-everywhere-opensource-src-5.2.1.tar.gz.Thanks.[/quote]

    You need to check yourself. I have seen enough errors on CentOS to try to stay away from that OS as far as possible.

    I often build Qt on Kubuntu linux and sometimes on OpenSUSE - there it works without problems, every time.


Log in to reply
 

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