Cross compile QT with xcb, Feature 'xkbcommon' was enabled, but the pre-condition 'libs.xkbcommon' failed
-
Hi,
I am trying to cross compile QT on Ubuntu 20.04, targeting an ARM chip, the toolchain is a OpenWRT-based one.
The build was fine with -no-xcb configure option. However when I try to enable xcb, I get the errors:
- ERROR: Feature 'xkbcommon' was enabled, but the pre-condition 'libs.xkbcommon' failed.
- ERROR: Feature 'xcb' was enabled, but the pre-condition 'features.thread && features.xkbcommon && libs.xcb' failed.
I see that most people get the second error, but not a lot of people get the first one, and fewer in cross compiling. I have installed
"sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev"
But it did not help, I guess it's because I'm cross compiling.In my verbose log I see:
/path/to/pkg-config --exists --silence-errors xkbcommon '>=' 0.5.0
pkg-config did not find package.
=> source produced no result.
Trying source 1 (type inline) of library xkbcommon ...
None of [libxkbcommon.so libxkbcommon.a] found in [] and global paths.
=> source produced no result.I also noticed that the libxkbcommon has been removed from qtbase source tree. So my question to start is: would I have to build libxkbcommon myself with my toolchain? Because I assume the ones I can find under /usr/lib won't do as they're for either i386 or x86_64, not ARM.
-
@SanZ said in Cross compile QT with xcb, Feature 'xkbcommon' was enabled, but the pre-condition 'libs.xkbcommon' failed:
Also, I have a bunch of -skip options in my configure, maybe one of them stopped xcb from being configured/built?
I don't think so. XCB support only depends on the system's XCB and other graphical libraries. It doesn't depend on other Qt modules (whereas
-skip
only disables Qt modules)Check the output of your configuration script (I believe you'll have a file called
configure.summary
) -- it should list what components are found or not found.It seems that -qt-xcb option was removed from 5.12.1 onward?
Yes, it was removed in recent versions of Qt, for 2 reasons:
- Security: It is safer for users to link to the latest XCB libraries than to use an old, bundled version
- Maintenance: It takes up resources for Qt to keep updating and patching its own copy of XCB
As @ChrisW67 said, use your toolchain to cross-compile XCB first, then cross-compile Qt.
-
Thank you Chris. That's what I was afraid of... But it doesn't make sense to me that QT would make it so difficult for people to cross compile this xcb platform plugin as I read somewhere else on this forum that the cross compile was fine with QT5.10.1 ...
-
Some additional notes after a bit more search...
It seems that -qt-xcb option was removed from 5.12.1 onward? I am using 5.12.11, and when I try to remove -qt-xcb, the build is OK but does not generate libqxcb.so which is what I needed in the first place.
Also, I have a bunch of -skip options in my configure, maybe one of them stopped xcb from being configured/built? Is there a documentation somewhere on what -skip or -no-feature options would disable what components?
-
@SanZ said in Cross compile QT with xcb, Feature 'xkbcommon' was enabled, but the pre-condition 'libs.xkbcommon' failed:
Also, I have a bunch of -skip options in my configure, maybe one of them stopped xcb from being configured/built?
I don't think so. XCB support only depends on the system's XCB and other graphical libraries. It doesn't depend on other Qt modules (whereas
-skip
only disables Qt modules)Check the output of your configuration script (I believe you'll have a file called
configure.summary
) -- it should list what components are found or not found.It seems that -qt-xcb option was removed from 5.12.1 onward?
Yes, it was removed in recent versions of Qt, for 2 reasons:
- Security: It is safer for users to link to the latest XCB libraries than to use an old, bundled version
- Maintenance: It takes up resources for Qt to keep updating and patching its own copy of XCB
As @ChrisW67 said, use your toolchain to cross-compile XCB first, then cross-compile Qt.
-