Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QXcbIntegration: neither GLX nor EGL are enabled on Yocto Linux



  • I have an application running on Yocto Zeus 3.0.1 with Qt5 and relies on OpenGL EGL. I want to use the XCB platform backend of Qt. I am building the application on target board. The application builds fine, but fails with the following message at runtime:

    QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
    QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled
    QOpenGLWidget: Failed to create context
    

    I have added all the needed OpenGL drivers in image .bb file:

    IMAGE_INSTALL += "libegl-mesa libgl-mesa mesa libegl-mesa-dev libgl-mesa-dev libgles3-mesa-dev mesa-megadriver xserver-xorg xserver-xorg-extension-glx libx11 gsl-dev"
    

    In local.conf, added:

    DISTRO_FEATURES_append = " opengl x11 systemd"
    

    The following is my qt5/qtbase_%.bbappend file.

    FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
    
    PACKAGECONFIG_append = "gles2 mtdev sql-sqlite glib fontconfig gif accessibility"
    
    PACKAGECONFIG_append = " widgets"
    
    do_configure_prepend () {
        cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
        # the below indentation is important - Soham
    
    QMAKE_LIBS_EGL += -lEGL -ldl -lglib-2.0 -lpthread
    QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lgsl -lEGL -ldl -lglib-2.0 -lpthread
    
    QMAKE_CFLAGS += -DLINUX=1 -DWL_EGL_PLATFORM -DEGL_API_FB=1
    QMAKE_CXXFLAGS += -DLINUX=1 -DWL_EGL_PLATFORM -DEGL_API_FB=1
    
    QT_QPA_DEFAULT_PLATFORM = xcb
    load(qt_config)
    EOF
    }
    
    

    As I am building the application on the target itself, Therefore, I added the -dev files. I have turned on the QT_DEBUG_PLUGINS=1, but still did not get any meaningful output. I have checked the file at /usr/lib/plugins/platforms/libqxcb.so, and all the dependent libraries exist there.

    What am I missing here? Any help?


Log in to reply