[Development] Is Xlib a hard requirement for Qt5 xcb?

Nicolás Alvarez nicolas.alvarez at gmail.com
Mon Jul 29 22:50:35 CEST 2013

2013/7/26 Nicolás Alvarez <nicolas.alvarez at gmail.com>:
> Hi everyone,
> I attempted to build Qt5 and KF5 in a minimal system, only installing
> dependencies when configure/cmake asks for them, in order to find bugs
> (such as missing dependency checks) in the build system. I was
> successful, in the sense that I found missing checks :)
> I'm configuring Qt with the options suggested in the KF5 wiki:
>     ./configure -prefix $PWD/qtbase -opensource -developer-build
> -nomake tests -nomake examples -dbus -no-separate-debug-info -xcb -qpa
> xcb -no-gtkstyle -no-pch
> My minimal system does not have X11 development files (such as
> Xlib.h), but it does have XCB stuff.
> Compilation fails with:
> make[2]: Entering directory `/home/nicolas/src/qt5/qtbase/src/widgets'
> util/qsystemtrayicon_x11.cpp:60:22: fatal error: X11/Xlib.h: No such
> file or directory
> make[2]: Leaving directory `/home/nicolas/src/qt5/qtbase/src/widgets'
> make[5]: Entering directory
> `/home/nicolas/src/qt5/qtbase/src/plugins/platforms/xcb'
> qxcbmime.cpp:49:23: fatal error: X11/Xutil.h: No such file or directory
> qxcbcursor.cpp:52:28: fatal error: X11/cursorfont.h: No such file or directory
> qxcbxsettings.cpp:46:36: fatal error: X11/extensions/XIproto.h: No
> such file or directory
> make[5]: Leaving directory
> `/home/nicolas/src/qt5/qtbase/src/plugins/platforms/xcb'
> The question is: is Qt5/XCB *supposed* to work without Xlib? I got the
> feeling that there was some attempt to make it work, since some code
> is protected with #ifdef XCB_USE_XLIB checks (though perhaps that
> define is for something else?). If supposed to work, then it's
> currently broken and likely needs some more ifdefs. If not supposed to
> work, then the configure script should abort Xlib isn't present while
> configuring for XCB. I'm interested in fixing it either way, but I
> can't take the decision of what's supported :)

I discussed the issue with Richard Moore on IRC:

<richmoore2> there's a bunch of stuff in the xcb plugin that requires
xlib right now
<richmoore2> for example the system tray support
<richmoore2> i kind of started addressing that one
https://codereview.qt-project.org/#change,48972 but i'm sure there are
<richmoore2> i think i use xlib in qtx11extras too since i need to
offer a Display
<richmoore2> my opinion is that the xcb port is still incomplete and
should be regarded as xlib/xcb at the moment
<richmoore2> the configure script should reflect that
<PovAddict> so xlib should be required?
<richmoore2> yes
<richmoore2> the aim should be to remove the requirement though
<PovAddict> okay so, looking at the script... currently it always
checks for X11 presence, and adds 'xlib' to QT_CONFIG on pass, does
nothing on fail
<PovAddict> is there any platform/qpa/configuration/thing other than
XCB where you'd want to check for and "enable" xlib support?
<richmoore2> not afaik
<PovAddict> ok, then my initial thought would be to move the test
inside if [ "$CFG_XCB" != "no" ] and abort on test fail
<richmoore2> seems reasonable to me

I'm working on a proper patch for this.


More information about the Development mailing list