xvfb: probe host DRI paths so GLX is advertised on non-EL distros (#78)
Some checks failed
ci / build (linux-x86_64) (push) Failing after 4s
ci / build (macos) (push) Failing after 42s
ci / build (linux-arm64) (push) Has been cancelled
ci / test distro (archlinux:latest) (push) Has been cancelled
ci / test distro (debian:bookworm-slim) (push) Has been cancelled
ci / test distro (fedora:41) (push) Has been cancelled
ci / test distro (ghcr.io/void-linux/void-glibc:latest) (push) Has been cancelled
ci / test distro (opensuse/tumbleweed:latest) (push) Has been cancelled
ci / test distro (ubuntu:20.04) (push) Has been cancelled
ci / test distro (ubuntu:24.04) (push) Has been cancelled
ci / publish wheels (push) Has been cancelled

Xvfb's bundled libGLdispatch is hardcoded to look for DRI drivers under
/usr/lib64/dri (the AlmaLinux 8 layout). On Debian/Ubuntu they live in
/usr/lib/x86_64-linux-gnu/dri, so the GL provider fails to load and the
server brings up without the GLX extension — which silently breaks any
GLX client (raylib/GLFW). Set LIBGL_DRIVERS_PATH from the wrapper to a
list of standard distro paths so the host's swrast driver is found.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adeeb Shihadeh
2026-04-30 19:05:56 -07:00
committed by GitHub
parent 975313a86f
commit cf61c10458
2 changed files with 19 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "xvfb" name = "xvfb"
version = "1.20.11" version = "1.20.11.post1"
description = "Xvfb (X virtual framebuffer) headless X server" description = "Xvfb (X virtual framebuffer) headless X server"
requires-python = ">=3.8" requires-python = ">=3.8"

View File

@@ -10,12 +10,30 @@ XVFB_BIN = os.path.join(BIN_DIR, "Xvfb")
XKBCOMP_BIN = os.path.join(BIN_DIR, "xkbcomp") XKBCOMP_BIN = os.path.join(BIN_DIR, "xkbcomp")
# Common host paths where Mesa DRI drivers (e.g. swrast_dri.so) live. Xvfb
# was built on AlmaLinux 8 with /usr/lib64/dri baked in; on other distros
# (Debian/Ubuntu in particular) the drivers are elsewhere, and without them
# Xvfb fails to bring up a GL provider and silently disables the GLX
# extension. Probing the standard locations lets the host's drivers be
# found regardless of distro.
_DRI_PATHS = (
"/usr/lib64/dri",
"/usr/lib/x86_64-linux-gnu/dri",
"/usr/lib/aarch64-linux-gnu/dri",
"/usr/lib/dri",
)
def _run_xvfb(): def _run_xvfb():
# The bundled Xvfb has its compile-time XkbBinDirectory blanked out so it # The bundled Xvfb has its compile-time XkbBinDirectory blanked out so it
# invokes xkbcomp via PATH lookup; prepend our bin dir so the bundled # invokes xkbcomp via PATH lookup; prepend our bin dir so the bundled
# xkbcomp wins. -xkbdir points the server at the bundled keymap data. # xkbcomp wins. -xkbdir points the server at the bundled keymap data.
env = os.environ.copy() env = os.environ.copy()
env["PATH"] = BIN_DIR + os.pathsep + env.get("PATH", "") env["PATH"] = BIN_DIR + os.pathsep + env.get("PATH", "")
if "LIBGL_DRIVERS_PATH" not in env:
found = [p for p in _DRI_PATHS if os.path.isdir(p)]
if found:
env["LIBGL_DRIVERS_PATH"] = os.pathsep.join(found)
args = sys.argv[1:] args = sys.argv[1:]
if not any(a == "-xkbdir" for a in args): if not any(a == "-xkbdir" for a in args):
args = ["-xkbdir", XKB_DIR] + args args = ["-xkbdir", XKB_DIR] + args