Linux deployment: "QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled"

  • The only problem with that message is that the app works just fine running from the command line as long as the paths to my Qt installation are complete. (To test the deployment and make sure i have the dependencies I need I rename the Qt directory to HIDE_Qt.)

    I use the shell script sample from the linux deployment page shown below to create a shell script for my application:

    appname=`basename $0 | sed s,\.sh$,,`
    dirname=`dirname $0`
    if [ "${dirname%$tmp}" != "/" ]; then
    export LD_LIBRARY_PATH
    $dirname/$appname "$@"

    My application's has the qml directory present, all the libs referenced by ldd (against the executable), and the platform plugin.

    Running the application gives me the dreaded:

    QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled

    Now, the problem with this is that if I unhide the Qt directory it all works perfectly fine.

    This suggests to me that the binaries I am copying from the GCC 64-bit directory do not actually match (in configuration) the binaries referenced when the loader evaluates the Qt directory.

    It appears to be finding my Qml code, it appears to be finding my platform plugin (I copied ALL the platform plugins there just in case there's a problem with just including the Xcb lib), and yet it's complaining as if EGL and GLX were not configured in the build for one of those 64-bit binaries copied from the 5.7 Qt GCC-64 bit directory.

    Works if I don't hide Qt, emits that error if I do hide Qt and use the script to point the loader to my directory.

    Anyone recognize this problem?

    Thanks :)

  • Lifetime Qt Champion


    Did you follow the steps for deploying an application on Linux ?

  • As far as I can tell, yes - and found that they failed to mention several things (maybe those are obvious to others.) Such as running ldd against all of the Qt libs your first run of ldd against your executable told you to include.

    It also didn't mention how you should package your Qml dependencies (or if the linux version has Qml dependencies) - I presume it does so I copied over Qml, I copied over all of the plugins in case that was the problem, and I copied over all of the platform plugins in case that was the problem.

    All from the GCC 64 bin and libexec directories, because I'm building with the x64 GCC kit.

  • Lifetime Qt Champion

    Do you mean you copied system libraries ?

  • No, only libraries found in the Qt pathing of my system.

  • Hi, I have got the exact same problem, also tried to build Qt with -qt-xcb configuration
    (From the Qt docu: "It's possible to configure Qt with -qt-xcb, which compiles in a set of xcb helper libraries instead of trying to link against the system versions. This can help make Qt less dependent on some of the xcb helper libraries that might not be available on all distributions.")

    But I still get the "QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled", with the Qt dev directory in place everything works fine, also tested it on another fresh vm with Ubuntu 15.

    My Application file structure looks like this:

    Shell script for starting with correct LD path
    SCRIPT=$(readlink -f "$0")
    SCRIPTPATH=$(dirname "$SCRIPT")
    export QT_QPA_PLATFORM_PLUGIN_PATH="$SCRIPTPATH/plugins/platforms"
    "$SCRIPTPATH/Application" &

  • @FireEarl I'm going to bump this to paid support (we have a commercial license) so if they solve this I'll post the result here.

    I'm using the gcc 64 libs that Qt themselves built and shipped and still haven't found a way around this (I put it aside for a bit to polish up the Windows/OSX side of things.)

    Probably the easiest solution would be for someone to create an example gzip/tar/whatever of the Qt minibrowser sample on Linux that was totally self contained (without static linking of course.)

    This would be an relatively simple example of exactly what to do that included a widespread of potential dependencies (QTWebEngineProcess, QML, Xcb platform plugin, et cetera.)

    The weird thing is that if I don't hide my Qt directory everything works fine, if I do hide it I get the Xcb error. I'll submit to support and then try running down all the individual dependencies of the Xcb shared object library. I thought I'd done that last time I tried to fix this and saw only references to system library paths, but I'll double check.

  • Strangely the problem seems to be related to the Qt/<version#>/gcc_64/plugins/xcbglintegrations directory.

    I hide everything from Qt EXCEPT this directory it starts up fine.
    If I hide this directory it fails with the error we are both getting.

    Here's the weird part - if I rename the SOs in that directory to hide them, they are found anyhow and the app loads just fine.

    If I move them into a subdirectory, the app fails to load.

    They are NOT listed as dependencies to my application or the platform plugin, suggesting that they are explicitly loaded at runtime via a direct load call and that load call seems to enumerate any SO in that specific directory (since I can rename the files and it still loads.)

    If I move either of them to their original directory I can name them anything I want and the app will load and run properly. E.g. I renamed the file to something bizarre:

    mv wtfisgoingon.dll

    And the application still loaded and ran fine.

    This seems to be a real issue since something is hardcoded to look in that specific directory for any files in it...

  • Qt Champions 2017

    See the last part of the deployment page. Since you're deploying your own set of Qt binaries I think the note about paths is relevant:

    The search path for Qt plugins (as well as a few other paths) is hard-coded into the QtCore library. By default, the first plugin search path will be hard-coded as /path/to/Qt/plugins. As mentioned above, using predetermined paths has certain disadvantages, so you need to examine various alternatives to make sure that the Qt plugins are found:

    Have you tried providing your own qt.conf that sets the search paths for the plugins?

    Kind regards.

  • @kshegunov said:

    last part

    As far as I can tell, this is exactly what the example shell script from the linux deployment page is supposed to handle.

    I use the default file layout in my application directory as those found in the qt.conf specification.

    I know, for a certainty, that my application can find other Qt plugins properly because when I unhide those two libqxcb- shared libraries, the app runs and loads all the other plugins in my plugins directory (like svg support) just fine (in other words, I hide everything in the Qt folder except those those two SOs.)

    It is only those two SOs that seem be to be loaded via dlopen and the runtime (I presume the platform plugin) enumerates ANY file inside of that hardcoded path. Very strange.

    Then again, I may be wrong, but I'm trying to be careful about that...

  • Just managed to fix this by explicitly overriding the plugins in the shell script like this:

    export QT_PLUGIN_PATH=$dirname/plugins

    Where $dirname is the directory containing the executable.

    Odd that this solves the issue as Qt found all the other necessary plugins without it.

    Note that I had to place the two .so files in the directory like this:


    Must be tied to code that enumerates Xcb integration plugins.

    Anyhow, glad to have gotten past this.

    @kshegunov I should have thought less and just blindly followed your advice ;) Would have gotten farther faster. Cheers!

  • Qt Champions 2017

    @VRHans said:

    I should have thought less and just blindly followed your advice ;) Would have gotten farther faster.

    Perhaps, but thinking less is never good advice. ;)
    I'm glad you were able to solve it.


  • Thanks, it also worked in my scenario!
    Hope this will be added to the Deployment page of Qt / WebEngine.

  • @FireEarl Cool :)

    There's probably a reason that it works this way, but if not - these plugins should work the same way the others do.

  • Qt Champions 2017

    @VRHans said:

    There's probably a reason that it works this way, but if not - these plugins should work the same way the others do.

    If my initial suspicion, based on your description of renaming libraries and folders, is correct, then you had used the system installed integration plugins instead of the ones you deployed. Thus before overriding the plugin search path the plugins are searched for in the wrong place, at least that's what I suspect.

    @FireEarl said:

    Hope this will be added to the Deployment page of Qt / WebEngine.

    It kind of is, I quoted exactly the deployment page. Perhaps it could be rephrased to be more explicit, but the info is there.

    Kind regards.

Log in to reply

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