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



  • Hi,

    I have compiled Qt 5.3.2 on an ARM device which runs Lubuntu/X11 with OpenGL ES2.

    Unfortunately, when I compile and run my application (containing QtQuick) I get the following error:
    QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled

    I searched the web to find similar cases which led me to the source:
    https://qt.gitorious.org/qt/qtbase/source/300534fc214f2547a63594ce0891e9a54c8f33ca:src/plugins/platforms/xcb/qxcbintegration.cpp#L174

    It seams that XCB_USE_GLX is not defined although I have compiled Qt with xcb & glx support. Typing glxgears in the command line displays a smooth gears animation so I suppose GLX works

    My QT_CONFIG:
    @minimal-config small-config medium-config large-config full-config fontconfig libudev evdev xlib xrender xcb-plugin xcb-render xcb-glx xcb-xlib xcb-sm xkbcommon-qt accessibility-atspi-bridge linuxfb c++11 accessibility egl eglfs opengl opengles2 shared qpa reduce_exports clock-gettime clock-monotonic posix_fallocate mremap getaddrinfo ipv6ifname getifaddrs inotify eventfd system-jpeg system-png png system-freetype no-harfbuzz system-zlib nis iconv glib dbus xcb xinput2 rpath alsa pulseaudio icu concurrent audio-backend release@

    Can someone help me solve this problem?

    Thanks!



  • Config summary:
    @ Configure summary

    Build type: linux-g++ (arm, CPU features:)
    Platform notes:

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

    Build options:
    Configuration .......... accessibility accessibility-atspi-bridge alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent dbus egl eglfs evdev eventfd fontconfig full-config getaddrinfo getifaddrs glib iconv icu inotify ipv6ifname large-config largefile libudev linuxfb medium-config minimal-config mremap nis no-harfbuzz opengl opengles2 pcre png posix_fallocate precompile_header pulseaudio qpa qpa reduce_exports release rpath shared small-config system-freetype system-jpeg system-png system-zlib xcb xcb-glx xcb-plugin xcb-render xcb-sm xcb-xlib xinput2 xkbcommon-qt xlib xrender
    Build parts ............ libs tools examples
    Mode ................... release
    Using C++11 ............ yes
    Using PCH .............. yes
    Target compiler supports:
    iWMMXt/Neon .......... no/auto

    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
    Evdev .................. yes
    FontConfig ............. yes
    FreeType ............... yes (system library)
    Glib ................... yes
    GTK theme .............. no
    HarfBuzz ............... no
    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)
    journald ............... no
    mtdev .................. no
    Networking:
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    OpenSSL .............. no
    NIS .................... yes
    OpenGL / OpenVG:
    EGL .................. yes
    OpenGL ............... yes (OpenGL ES 2.x)
    OpenVG ............... no
    PCRE ................... yes (bundled copy)
    pkg-config ............. yes
    PulseAudio ............. yes
    QPA backends:
    DirectFB ............. no
    EGLFS ................ yes
    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 ................ no
    OCI .................. no
    ODBC ................. no
    PostgreSQL ........... no
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. no
    udev ................... yes
    xkbcommon .............. yes (bundled copy, XKB config root: /usr/share/X11/xkb)
    zlib ................... yes (system library)

    NOTE: libxkbcommon and libxkbcommon-x11 0.4.1 or higher not found on the system, will use
    the bundled version from 3rd party directory.
    NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
    Configure with '-qreal float' to create a build that is binary compatible with 5.1.@



  • It's because of "EGL on X ........... no". ES2 defaults to preferring EGL over GLX (since you don't normally use GLX with ES). Not sure if there's an easy fix. You could manyally change xcb-plugin.pro to force GLX. (search for something like contains(QT_CONFIG, xcb-xlib):!contains(QT_CONFIG, opengles2))



  • Thanks for your feedback. In the meanwhile I have compiled Qt with -opengl desktop and now the QML files show up but it's very slow. Following error appears in the console:

    @libGL error: failed to load driver: Mali DRI2
    libGL error: Try again with LIBGL_DEBUG=verbose for more details.@

    I'll try to compile Qt with EGL on X, fyi here is why the test failed :

    @In file included from egl-x11.cpp:42:0:
    egl-x11.cpp: In function ‘int main(int, char**)’:
    egl-x11.cpp:55:20: error: invalid conversion from ‘EGLNativeDisplayType {aka void*}’ to ‘Display* {aka _XDisplay*}’ [-fpermissive]
    Display dpy = EGL_DEFAULT_DISPLAY;
    ^
    egl-x11.cpp:57:9: error: invalid conversion from ‘EGLNativeDisplayType {aka void
    }’ to ‘Display* {aka _XDisplay*}’ [-fpermissive]
    dpy = egldpy;
    ^
    egl-x11.cpp:58:79: error: invalid conversion from ‘Window {aka long unsigned int}’ to ‘EGLNativeWindowType {aka fbdev_window*}’ [-fpermissive]
    EGLNativeWindowType w = XCreateWindow(dpy, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    ^
    egl-x11.cpp:59:26: error: invalid conversion from ‘EGLNativeWindowType {aka fbdev_window*}’ to ‘Window {aka long unsigned int}’ [-fpermissive]
    XDestroyWindow(dpy, w);
    ^
    In file included from egl-x11.cpp:44:0:
    /usr/include/X11/Xlib.h:2255:12: error: initializing argument 2 of ‘int XDestroyWindow(Display*, Window)’ [-fpermissive]
    extern int XDestroyWindow(
    ^@



  • Compilation with -opengl es2 fails at this line :

    @../../include/QtGui/../../src/gui/opengl/qopengles2ext.h:402:9: error: ‘khronos_int64_t’ does not name a type
    ../../include/QtGui/../../src/gui/opengl/qopengles2ext.h:403:9: error: ‘khronos_uint64_t’ does not name a type
    ../../include/QtGui/../../src/gui/opengl/qopengles2ext.h:1348:92: error: ‘GLuint64’ has not been declared@

    dpkg -S /usr/include/KHR/khrplatform.h:
    @mali400-dev: /usr/include/KHR/khrplatform.h@



  • I had the same problem on a different platform. I patched egl-x11.cpp to do a cast from void* to Display*, now it reports "EGL on X ........... yes". I did not test it on the hardware though.

    This might be worth a bug report.



  • More info on this: In EGL 1.3 (which is from 2008 btw), the eglplatform.h defines EGLNativeDisplayType as void*. From EGL 1.4 on, EGLNativeDisplayType is defined as Display*. Maybe our toolchains are too old.

    After patching egl-x11.cpp, the same error happens on qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp. There is a bug report concerning that file: https://bugreports.qt-project.org/browse/QTBUG-36551



  • On ARM device, if EGL-X11 auto-detection ... () is enabling EGL-X11, but you do not want this enabled, how do you state this as a configuration option?

    My Summary:
    @Build options:
    Configuration .......... alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile dbus egl egl_x11 eglfs evdev eventfd freetype full-config getaddrinfo getifaddrs glib iconv inotify ipv6ifname large-config largefile libudev linuxfb medium-config minimal-config mremap nis no-harfbuzz opengl opengles2 openssl-linked pcre png posix_fallocate qpa qpa reduce_exports release shared silent small-config system-jpeg system-png system-zlib xlib
    Build parts ............ tools libs
    Mode ................... release
    Using C++11 ............ yes
    Using PCH .............. no
    Target compiler supports:
    iWMMXt/Neon .......... no/auto

    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 .......... no
    ALSA ................... yes
    CUPS ................... no
    Evdev .................. yes
    FontConfig ............. no
    FreeType ............... yes (bundled copy)
    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 system library)
    journald ............... no
    mtdev .................. no
    Networking:
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    OpenSSL .............. yes (linked to the libraries)
    NIS .................... yes
    OpenGL / OpenVG:
    EGL .................. yes
    OpenGL ............... yes (OpenGL ES 2.x)
    OpenVG ............... no
    PCRE ................... yes (bundled copy)
    pkg-config ............. yes
    PulseAudio ............. no
    QPA backends:
    DirectFB ............. no
    EGLFS ................ yes
    KMS .................. no
    LinuxFB .............. yes
    XCB .................. no
    Session management ..... no
    SQL drivers:
    DB2 .................. no
    InterBase ............ no
    MySQL ................ no
    OCI .................. no
    ODBC ................. no
    PostgreSQL ........... no
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. no
    udev ................... yes
    xkbcommon .............. no
    zlib ................... yes (system library)@

    My configuration statement:
    @ ${S}/configure -v
    -opensource -confirm-license
    -sysroot ${STAGING_DIR_TARGET}
    -no-gcc-sysroot
    -prefix ${OE_QMAKE_PATH_PREFIX}
    -bindir ${OE_QMAKE_PATH_BINS}
    -libdir ${OE_QMAKE_PATH_LIBS}
    -datadir ${OE_QMAKE_PATH_DATA}
    -sysconfdir ${OE_QMAKE_PATH_SETTINGS}
    -docdir ${OE_QMAKE_PATH_DOCS}
    -headerdir ${OE_QMAKE_PATH_HEADERS}
    -archdatadir ${OE_QMAKE_PATH_ARCHDATA}
    -libexecdir ${OE_QMAKE_PATH_LIBEXECS}
    -plugindir ${OE_QMAKE_PATH_PLUGINS}
    -importdir ${OE_QMAKE_PATH_IMPORTS}
    -qmldir ${OE_QMAKE_PATH_QML}
    -translationdir ${OE_QMAKE_PATH_TRANSLATIONS}
    -testsdir ${OE_QMAKE_PATH_TESTS}
    -examplesdir ${OE_QMAKE_PATH_EXAMPLES}
    -hostbindir ${OE_QMAKE_PATH_HOST_BINS}
    -hostdatadir ${OE_QMAKE_PATH_HOST_DATA}
    -external-hostbindir ${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}
    -platform ${TOPDIR}/out/sysroots/x86_64-linux/usr/lib/qt5/mkspecs/linux-g++
    -xplatform linux-oe-g++
    -optimized-qmake
    -shared \
    -silent \
    -no-pch \
    -no-rpath \
    -pkg-config \
    -no-xcb
    -no-sql-db2
    -no-mtdev
    -no-gtkstyle
    -nomake tests
    -system-libjpeg
    -openssl-linked
    -nomake examples
    -no-xfixes
    -no-sql-mysql
    -opengl es2
    -eglfs
    -qpa eglfs
    -make tools \
    -qt-pcre
    -iconv
    -no-xkb
    -no-xkbcommon
    -no-fontconfig
    -no-kms
    -system-libpng
    -no-tslib
    -no-icu
    -no-directfb
    -glib
    -no-sql-oci
    -no-xinerama
    -no-sql-sqlite2
    -accessibility
    -widgets
    -no-xrandr
    -linuxfb
    -no-libudev
    -no-xcursor
    -no-sql-psql
    -make libs
    -nis
    -no-openvg
    -no-xvideo
    -no-xsync
    -no-sql-tds
    -no-xshape
    -dbus
    -system-zlib
    -no-pulseaudio
    -no-xrender
    -no-mitshm
    -no-sm
    -no-xinput
    -no-sql-ibase \
    -no-xinput2
    -alsa
    -no-sql-odbc
    -release @



  • On ARM device, if EGL-X11 auto-detection ... () is enabling EGL-X11, but you do not want this enabled, how do you state this as a configuration option?

    My Summary:
    @Build options:
    Configuration .......... alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile dbus egl egl_x11 eglfs evdev eventfd freetype full-config getaddrinfo getifaddrs glib iconv inotify ipv6ifname large-config largefile libudev linuxfb medium-config minimal-config mremap nis no-harfbuzz opengl opengles2 openssl-linked pcre png posix_fallocate qpa qpa reduce_exports release shared silent small-config system-jpeg system-png system-zlib xlib
    Build parts ............ tools libs
    Mode ................... release
    Using C++11 ............ yes
    Using PCH .............. no
    Target compiler supports:
    iWMMXt/Neon .......... no/auto

    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 .......... no
    ALSA ................... yes
    CUPS ................... no
    Evdev .................. yes
    FontConfig ............. no
    FreeType ............... yes (bundled copy)
    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 system library)
    journald ............... no
    mtdev .................. no
    Networking:
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    OpenSSL .............. yes (linked to the libraries)
    NIS .................... yes
    OpenGL / OpenVG:
    EGL .................. yes
    OpenGL ............... yes (OpenGL ES 2.x)
    OpenVG ............... no
    PCRE ................... yes (bundled copy)
    pkg-config ............. yes
    PulseAudio ............. no
    QPA backends:
    DirectFB ............. no
    EGLFS ................ yes
    KMS .................. no
    LinuxFB .............. yes
    XCB .................. no
    Session management ..... no
    SQL drivers:
    DB2 .................. no
    InterBase ............ no
    MySQL ................ no
    OCI .................. no
    ODBC ................. no
    PostgreSQL ........... no
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. no
    udev ................... yes
    xkbcommon .............. no
    zlib ................... yes (system library)@

    My configuration statement:
    @ ${S}/configure -v
    -opensource -confirm-license
    -sysroot ${STAGING_DIR_TARGET}
    -no-gcc-sysroot
    -prefix ${OE_QMAKE_PATH_PREFIX}
    -bindir ${OE_QMAKE_PATH_BINS}
    -libdir ${OE_QMAKE_PATH_LIBS}
    -datadir ${OE_QMAKE_PATH_DATA}
    -sysconfdir ${OE_QMAKE_PATH_SETTINGS}
    -docdir ${OE_QMAKE_PATH_DOCS}
    -headerdir ${OE_QMAKE_PATH_HEADERS}
    -archdatadir ${OE_QMAKE_PATH_ARCHDATA}
    -libexecdir ${OE_QMAKE_PATH_LIBEXECS}
    -plugindir ${OE_QMAKE_PATH_PLUGINS}
    -importdir ${OE_QMAKE_PATH_IMPORTS}
    -qmldir ${OE_QMAKE_PATH_QML}
    -translationdir ${OE_QMAKE_PATH_TRANSLATIONS}
    -testsdir ${OE_QMAKE_PATH_TESTS}
    -examplesdir ${OE_QMAKE_PATH_EXAMPLES}
    -hostbindir ${OE_QMAKE_PATH_HOST_BINS}
    -hostdatadir ${OE_QMAKE_PATH_HOST_DATA}
    -external-hostbindir ${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}
    -platform ${TOPDIR}/out/sysroots/x86_64-linux/usr/lib/qt5/mkspecs/linux-g++
    -xplatform linux-oe-g++
    -optimized-qmake
    -shared \
    -silent \
    -no-pch \
    -no-rpath \
    -pkg-config \
    -no-xcb
    -no-sql-db2
    -no-mtdev
    -no-gtkstyle
    -nomake tests
    -system-libjpeg
    -openssl-linked
    -nomake examples
    -no-xfixes
    -no-sql-mysql
    -opengl es2
    -eglfs
    -qpa eglfs
    -make tools \
    -qt-pcre
    -iconv
    -no-xkb
    -no-xkbcommon
    -no-fontconfig
    -no-kms
    -system-libpng
    -no-tslib
    -no-icu
    -no-directfb
    -glib
    -no-sql-oci
    -no-xinerama
    -no-sql-sqlite2
    -accessibility
    -widgets
    -no-xrandr
    -linuxfb
    -no-libudev
    -no-xcursor
    -no-sql-psql
    -make libs
    -nis
    -no-openvg
    -no-xvideo
    -no-xsync
    -no-sql-tds
    -no-xshape
    -dbus
    -system-zlib
    -no-pulseaudio
    -no-xrender
    -no-mitshm
    -no-sm
    -no-xinput
    -no-sql-ibase \
    -no-xinput2
    -alsa
    -no-sql-odbc
    -release @



  • [quote author="Cmdr" date="1415800297"]More info on this: In EGL 1.3 (which is from 2008 btw), the eglplatform.h defines EGLNativeDisplayType as void*. From EGL 1.4 on, EGLNativeDisplayType is defined as Display*. Maybe our toolchains are too old.

    After patching egl-x11.cpp, the same error happens on qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp. There is a bug report concerning that file: https://bugreports.qt-project.org/browse/QTBUG-36551[/quote]

    It does not work like that. If your EGL implementation is targetting X then the native display/window types will usually (but not always) be the corresponding Xlib pointer types. If the EGL implementation is targetting fbdev only (no support under X, only raw framebuffer, i.e. eglfs) then it is like to be a void * or similar. In some cases the EGL implementation supports both, which is achieved either via ifdefs for these types or by using a generic type like void *. In any case, you will need to know in advance what the vendor-provided driver (the EGL implementation) in question supports (fbdev? X? both?) and plan/configure Qt accordingly.



  • [quote author="Cmdr" date="1415800297"]More info on this: In EGL 1.3 (which is from 2008 btw), the eglplatform.h defines EGLNativeDisplayType as void*. From EGL 1.4 on, EGLNativeDisplayType is defined as Display*. Maybe our toolchains are too old.

    After patching egl-x11.cpp, the same error happens on qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp. There is a bug report concerning that file: https://bugreports.qt-project.org/browse/QTBUG-36551[/quote]

    It does not work like that. If your EGL implementation is targetting X then the native display/window types will usually (but not always) be the corresponding Xlib pointer types. If the EGL implementation is targetting fbdev only (no support under X, only raw framebuffer, i.e. eglfs) then it is like to be a void * or similar. In some cases the EGL implementation supports both, which is achieved either via ifdefs for these types or by using a generic type like void *. In any case, you will need to know in advance what the vendor-provided driver (the EGL implementation) in question supports (fbdev? X? both?) and plan/configure Qt accordingly.


Log in to reply
 

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