The One Flag Everyone Assumes Disables X11, and Sixteen Packages That Needed a Different Fix Each Time

A build flag meant to turn off X11 support gets added to nearly every KDE package script in this from-scratch build — 128 of roughly 150. It's a real, documented flag. It's also, for most of those packages, not the flag that actually controls anything. The same specific bug — X11 support compiling in as dead code on a system with no Xorg at all — got independently discovered and separately patched in at least sixteen different packages, each one leaving behind a comment naming the others.

Why the libraries exist in the first place

This system is Wayland-only. No Xorg server, no X11 session, nothing that should need X11 client libraries at all. But one package, kscreenlocker, has a real, unconditional runtime dependency on libX11: it compiles in both a Wayland lock-screen backend and an X11 one, and the choice between them happens at runtime, not compile time, so the X11 backend's code has to exist and link even though it's never actually reached. That one dependency pulled in a real, working X11 client-library stack — libX11, libxcb, xcb-util-keysyms, libXfixes, and a few others — genuinely present on disk, genuinely functional as libraries.

What that stack does to everything downstream

Every other package's own build system checks for X11 support the ordinary way: find_package(X11), find_package(XCB ...). Those checks report the honest truth — the libraries are there — and each package's own build turns on its X11 code paths accordingly. What none of them can see is that Qt6 itself was never built with an X11 platform plugin, so nothing above the library level can ever actually use any of it. KWindowSystem::isPlatformX11() and QX11Info::isPlatformX11() — the actual runtime checks Plasma's own code uses to decide which backend it's running under — return false everywhere, always, on this system. The result is a specific, repeatable shape of bug: library-presence checks say yes, the real platform-support question says no, and everything gated only by the first check compiles in dead code that happens to build cleanly.

The flag everyone reached for, and why it usually didn't work

-D WITH_X11=OFF is a real CMake option, and it's the first thing anyone would reach for here. The problem is that it isn't the option most of these packages actually check. libplasma and kstatusnotifieritem define their own WITHOUT_X11 instead — the opposite name, easy to miss, and WITH_X11=OFF is silently accepted as a no-op flag that does nothing. kwin has its own KWIN_BUILD_X11, a real option controlling real functionality (Xwayland support), unrelated to the generic flag. plasma-workspace has WITH_X11_SESSION, which — worse — forces WITH_X11=1 back on internally the moment it's left at its own default. kwindowsystem has KWINDOWSYSTEM_X11, hard-requiring real Xorg libraries by default. Packages with none of these options at all — bluedevil, oxygen, polkit-kde-agent-1, plasma-integration, powerdevil, xdg-desktop-portal-kde — needed the dead code removed at the source level instead, since there was never a flag to turn off in the first place.

Sixteen packages, one comment thread across a codebase

Each fix, once found, got written down — and each new package's script comment points back at the ones before it. plasma-integration's comment names the exact same gap already documented in plasma-desktop's. oxygen's cites both. bluedevil's patch explicitly says "same recurring gap as plasma-workspace." That's not sixteen unrelated discoveries — it's the same bug, recognized as the same bug each subsequent time, by someone who'd already seen its shape once. The pattern held across CMake options with completely different names, in code written by different KDE teams over different years, because the actual root cause was never inside any of those sixteen packages. It was one shared dependency, three tiers below all of them, that happened to make a build-time check come back true when the real answer was no.

What actually proves the code is dead

None of these sixteen fixes were guesses. Each one traces the specific runtime guard that already exists in the source — isPlatformX11(), checked at the exact call site the patch touches — and confirms it always evaluates false on this system before removing or disabling anything. That's the difference between "this looks unused" and "this is provably unreachable": the code itself already contains the check that proves it, written by the original KDE developers for a different reason (supporting X11 and Wayland from the same binary), repurposed here as the evidence for why a whole category of dead code was safe to strip out sixteen times over.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Please share this article on your favorite website or platform.