Qt 5.12.1 Cannot load library /opt/Qt/5.12.1/gcc_64/plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)

  • I was trying to upgrade my Centos 7.5 Dockerfile from using 5.12.0 to 5.12.1.

    The only thing that I change in the Dockerfile were the version numbers (5.12.0 to 5.12.1) in the following lines:

    #install qt5.12
    ADD qt-installer-noninteractive.qs .
    RUN wget -q http://download.qt.io/archive/qt/5.12/5.12.1/qt-opensource-linux-x64-5.12.1.run
    RUN chmod +x qt-opensource-linux-x64-5.12.1.run
    RUN ./qt-opensource-linux-x64-5.12.1.run --platform minimal --script qt-installer-noninteractive.qs --verbose
    RUN /opt/Qt/Tools/QtCreator/bin/qbs setup-toolchains --detect 
    RUN /opt/Qt/Tools/QtCreator/bin/qbs setup-qt '/opt/Qt/5.12.1/gcc_64/bin/qmake' QtProfile
    RUN /opt/Qt/Tools/QtCreator/bin/qbs config profiles.QtProfile.baseProfile clang
    ENV PATH="/opt/Qt/5.12.1/gcc_64/bin:${PATH}"
    ENV LD_LIBRARY_PATH="/opt/Qt/5.12.1/gcc_64/lib:${LD_LIBRARY_PATH}"

    Now when I run a very basic application (just a empty QMainwindow) using a docker-compose file it crashes.

    I saw in another post here on the forum that suggested using QT_DEBUG_PLUGINS=1
    Where I got the following error message:

    application-run        | Got keys from plugin meta data ("xcb")
    application-run        | QFactoryLoader::QFactoryLoader() checking directory path "/home/polaris/bin/platforms" ...
    application-run        | Cannot load library /opt/Qt/5.12.1/gcc_64/plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)
    application-run        | QLibraryPrivate::loadPlugin failed on "/opt/Qt/5.12.1/gcc_64/plugins/platforms/libqxcb.so" : "Cannot load library /opt/Qt/5.12.1/gcc_64/plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)"
    application-run        | qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    application-run      | This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    application-run        |
    application-run        | Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
    application-run       |

    I've tried all the suggestions in the post that I linked to above, and non of them fix this problem.

    Again this application runs fine on Qt 5.12.0.

  • Moderators

    you need to install additional packages (e.g. for debian: "apt install libxkbcommon-x11-0")
    Maybe the base image has updated in the meantime?

  • @raven-worx No the base image has not been updated. I've created a new image with 5.12.0 and another with 5.12.1 . The error only comes in 5.12.1. I've tried to reinstall libqxcb and libxkbcommon but that does not fix anything.

  • Lifetime Qt Champion

    What version of Xkbcommon do you have ?
    Once installed what does ldd /opt/Qt/5.12.1/gcc_64/plugins/platforms/libqxcb.so return ?

Log in to reply

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