plasma-desktop: force HAVE_X11=0; KWindowSystem X11 needs Qt's xcb platform

plasma-desktop compiled deep into its tree (105 packages cooked) and failed on
  applets/taskmanager/backend.h:16: fatal error: netwm.h
because adding the X11 libraries made find_package(X11) succeed, so
CMakeLists.txt:211 set HAVE_X11=1 -- and the code then legitimately includes
KWindowSystem's X11-only headers, which our KWindowSystem does not install.

I tried the coherent fix first: KWINDOWSYSTEM_X11=ON. It fails because Qt here
is built without the xcb platform:
  src/platforms/xcb/kxerrorhandler_p.h:15: fatal error: private/qtx11extras_p.h
That header ships only with Qt's X11 support, so enabling KWindowSystem X11
cascades into rebuilding qtbase with the entire xcb plugin stack. Too large to
start mid-build; reverted with the reason recorded at the flag.

So HAVE_X11=1 asserts "Qt/KDE X11 integration is available", which is false
here. Forced to 0 -- the honest value -- and the gating script compiles those
paths out. The X11 libraries remain, because they ARE required: X11 is TYPE
REQUIRED in plasma-desktop and libxcb is needed unconditionally.

Also promotes xcb-util-keysyms and xcb-util-wm (built and staged:
libxcb-keysyms.a, libxcb-icccm.a, libxcb-ewmh.a), which KWindowSystem X11 would
need and which are cheap to have available.
This commit is contained in:
2026-08-05 03:27:31 +03:00
parent ec4015ad58
commit 68a4a45e5b
5 changed files with 48 additions and 0 deletions
+2
View File
@@ -295,6 +295,8 @@ libxkbfile = {}
util-macros = {}
xcb-util = {}
xcb-util-image = {}
xcb-util-wm = {}
xcb-util-keysyms = {}
# libice/libsm deliberately NOT included: they are X11 session-management
# libraries used only by ksmserver, which is inside if(WITH_X11) and is not
# built. They also need xorg util-macros, which is in no recipe here -- so
@@ -10,6 +10,12 @@ blake3 = "7d97020c517d228d3ca442d68fb3db899a8b6ae0e5b1f5ccc92701ef691a8ecf"
[build]
template = "custom"
dependencies = [
"libxrender",
"libxfixes",
"xcb-util-wm",
"xcb-util-keysyms",
"libxcb",
"libx11",
"qtbase",
# KWINDOWSYSTEM_QML=ON (below) builds the QML module, whose CMakeLists does
# find_package(Qt6Qml) via ECMQmlModule. Qt6Qml comes from qtdeclarative, so
@@ -41,6 +47,27 @@ done
rm -f CMakeCache.txt
rm -rf CMakeFiles
# KWINDOWSYSTEM_X11 stays OFF -- enabling it needs Qt built with the xcb
# platform, which this qtbase is not:
# src/platforms/xcb/kxerrorhandler_p.h:15: fatal error:
# private/qtx11extras_p.h: No such file or directory
# That header ships only with Qt's X11 support, so turning KWindowSystem X11 on
# would cascade into rebuilding qtbase with the whole xcb plugin stack. The X11
# LIBRARIES are still present and linkable (they satisfy find_package(X11) for
# consumers); what is absent is Qt-level X11 integration. Consumers therefore
# compile with HAVE_X11=0 -- see plasma-desktop, which forces it explicitly.
#
# Original note kept for context:
# KWINDOWSYSTEM_X11=ON would install netwm.h,
# KX11Extras, KStartupInfo, KWindowInfo or KSelectionOwner. That was consistent
# while nothing could find X11 -- but the real X11 stack is now in the sysroot,
# so consumers' config-X11.h sets HAVE_X11=1 and they legitimately include those
# headers:
# applets/taskmanager/backend.h:16: fatal error: netwm.h (plasma-desktop)
# Libraries present + KWindowSystem X11 absent is the inconsistent state; this
# makes the two agree, and lets the per-file gating be removed rather than grown.
# Needs XCB components XCB/KEYSYMS/RES/ICCCM (source CMakeLists.txt:64): libxcb
# supplies xcb and xcb-res, xcb-util-keysyms and xcb-util-wm the other two.
cmake "${COOKBOOK_SOURCE}" \
-DKF_SKIP_PO_PROCESSING=ON \
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
@@ -136,6 +136,23 @@ fi
sed -i 's|if (NOT EXISTS "${CMAKE_SYSROOT}/${XKBDIR}")|if (NOT EXISTS "${CMAKE_SYSROOT}/${XKBDIR}" AND NOT EXISTS "${XKBDIR}")|' \
"${COOKBOOK_SOURCE}/ConfigureChecks.cmake"
# Force HAVE_X11 to 0 even though find_package(X11) succeeds.
#
# CMakeLists.txt:211 does `if(X11_FOUND) set(HAVE_X11 1) endif()`. The X11
# LIBRARIES are now in the sysroot (they are needed: X11 is TYPE REQUIRED here,
# and libxcb is required unconditionally), so X11_FOUND is true -- but Qt is
# built without the xcb platform and KWindowSystem without its X11 component,
# so the X11-only KDE headers do not exist:
# applets/taskmanager/backend.h:16: fatal error: netwm.h
#
# HAVE_X11=1 asserts "Qt/KDE X11 integration is available", which is false here.
# Enabling it for real means rebuilding qtbase with the whole xcb plugin stack
# (kxerrorhandler_p.h needs private/qtx11extras_p.h) -- tracked, not attempted
# mid-build. Until then the honest value is 0, and the gating script compiles
# those paths out.
# Idempotent: after rewriting, the original line no longer matches.
sed -i 's/^ set(HAVE_X11 1)$/ set(HAVE_X11 0)/' "${COOKBOOK_SOURCE}/CMakeLists.txt"
python3 "${COOKBOOK_ROOT}/local/scripts/gate-kx11extras.py" "${COOKBOOK_SOURCE}"
# BUILD_DOC=OFF -- KF6DocTools is REQUIRED when docs are on and is not ported.
@@ -11,6 +11,7 @@ autotools_recursive_regenerate
[build]
dependencies = [
"util-macros",
"libxcb",
]
template = "custom"
@@ -11,6 +11,7 @@ autotools_recursive_regenerate
[build]
dependencies = [
"util-macros",
"libxcb",
]
template = "custom"