Solved Configure for cross-compile does not check for xcb-glx-integrations
-
I'm building Qt5 on Linux (Fedora 35).
When I build for the host machine the 'XCB GLX' plugin is checked for during configure, and the plugin lib is generated (plugins/xcbglintegrations/libqxcb-glx-integration.so)
./configure -opensource -shared -release -sql-sqlite -opengl desktop -no-openvg -no-accessibility -qt-zlib -qt-libpng -qt-libjpeg -no-openssl -make tools -nomake examples -no-dbus -skip qtwebengine -skip qtactiveqt -skip qtdeclarative -prefix /usr/local/myqt/lincross/Qt-5.15.2 -no-pch -xcb -egl -eglfs -reduce-relocations
Result:
Checking for Vulkan... no Checking for X11 prefix... /usr Checking for XCB GLX... yes <--------------------- Checking for X11 session management... yes
XCB: Using system-provided xcb-xinput ..... no Native painting (experimental) ....... no GL integrations: GLX Plugin ......................... yes XCB GLX .......................... yes <-------- EGL-X11 Plugin ..................... no
When I build for the target toolchain (also Linux GCC but with an older version of GLIBC) it doesn't even check for the XCB GLX at all. Configure is called as above but with these additional options:
-device linux-generic-g++ -device-option CROSS_COMPILE=x86_64-unknown-linux-gnu-
Checking for Vulkan... no Checking for X11 prefix... /usr Checking for X11 session management... no
XCB: Using system-provided xcb-xinput ..... no Native painting (experimental) ....... no GL integrations: GLX Plugin ......................... no <--------------- EGL-X11 Plugin ..................... no
Aside from this Qt builds fine and I can also build my program. But when my program tries to open an OpenGL view, of course it crashes with the message: "QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled"
The target toolchain was a very minimal one made with crosstool-ng, so to get Qt building at all I had to manually copy many headers and libs into it. I did this by looking at config.log to see which files it was missing for the checks, and providing them. But for this XCB GLX thing, there is no information whatsoever in the config.log
It seems like the check for XCB GLX is being skipped due to a dependency on something else that has already been checked and was missing. If so, then how can I tell what the dependency was, and thereby what libs I need to provide?
-
@iforce2d_where_is_my_old_account said in Configure for cross-compile does not check for xcb-glx-integrations:
it doesn't even check for the XCB GLX at all
Why do you think so?
I'm sure the configure script do the check, but the result is no.
To find out why check the config.log file. -
Okay I figured this out. By searching the whole Qt source tree for "XCB GLX" I found this rule in qtbase/src/gui/configure.json which seems to be what causes the build check to be skipped.
"xcb-glx-plugin": { "label": "GLX Plugin", "emitIf": "features.xcb", "condition": "features.xcb-xlib && features.opengl && !features.opengles2", "output": [ "privateFeature" ] },
In my case xcb-xlib being missing was the failing condition. By adding -xcb-xlib to the configure options, I could force configure to run the checks, and then resume my earlier procedure of looking at config.log to see details about what failed, and then copying the missing headers/libs into the target toolchain (libxcb-xinput.so in this case).
The reason libxcb-xinput.so did not exist is because I was copying in libs and headers from Ubuntu 16.04, which simply does not have libxcb-xinput. Fortunately I was able to build that from source easily enough.