Skip to content

bazel/Dockerfile: add X11/xcb runtime libs for --//:platform=gui#10844

Merged
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:bazel-gui-x11-runtime-libs
Jul 8, 2026
Merged

bazel/Dockerfile: add X11/xcb runtime libs for --//:platform=gui#10844
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:bazel-gui-x11-runtime-libs

Conversation

@openroad-ci

Copy link
Copy Markdown
Member

Problem

jenkins-ci#155 switches bazelisk test to --//:platform=gui to populate the gui remote cache. That reds the Bazel Tests stage: the gui openroad binary links against the qt-bazel prebuilts, which stub X11 at link time but resolve libX11/libxcb/libxkbcommon from the system at runtime (see the comment in MODULE.bazel). The slim bazel-ci image (FROM ubuntu:24.04) ships no X11 runtime, so every test dies at ld.so:

openroad: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory

All tests fail in ~0.1s (loader-level, before main), which is why the stage failed even though the compile/cache-warm succeeded.

Fix

Install the runtime (non--dev) subset of etc/DependencyInstaller.sh's GUI xcb list into bazel/Dockerfile. These 22 packages exactly cover the gui openroad binary's direct NEEDED entries.

Validation

  • bazelisk build --//:platform=gui //:openroad succeeds locally.
  • readelf -d / ldd on the resulting binary → 22 X11/xcb/dbus/fontconfig/xkbcommon NEEDED libs; each is a hard load-time dep, so the set is minimal.
  • Built this exact bazel/Dockerfile and ran the gui binary inside it as uid 9000: all libs resolve, openroad -version and a CLI tcl script both run (EXIT=0, Features: ... +GUI).
  • No QT_QPA_PLATFORM=offscreen needed — the tcl suite runs in CLI mode and never constructs a QApplication.

Qt is not installed here on purpose — it's hermetic via qt-bazel. Only the system X11 runtime is missing. Matt confirmed there are no GUI tests beyond man-page generation, so this is purely making the existing tests run against the gui binary.

The Qt GUI openroad binary (built with --//:platform=gui) links against
qt-bazel prebuilts, which stub X11 at link time but resolve libX11/libxcb/
libxkbcommon from the system at load time. The slim bazel-ci image ships no
X11 runtime, so every bazel test run against the gui binary dies immediately
at ld.so with:

  openroad: error while loading shared libraries: libX11-xcb.so.1:
  cannot open shared object file: No such file or directory

Install the runtime (non -dev) subset of etc/DependencyInstaller.sh's GUI
xcb package list. This exactly covers the gui openroad binary's direct
NEEDED entries (verified via readelf/ldd); the tcl test suite runs in CLI
mode and needs no X server or QT_QPA_PLATFORM.

This unblocks jenkins-ci#155, which switches `bazelisk test` to the gui
binary to populate the gui cache.

Signed-off-by: SombraSoft <sombrio@sombrasoft.dev>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds runtime X11/xcb libraries to the Bazel Dockerfile to support Qt GUI builds. The reviewer suggested combining these new packages into the existing RUN block to follow Dockerfile best practices, which avoids redundant layers and reduces the overall image size.

Comment thread bazel/Dockerfile
Comment on lines 34 to +65
time

# Runtime X11/xcb libraries for the Qt GUI build (--//:platform=gui).
# Qt itself is hermetic (qt-bazel prebuilts), but the linked openroad binary
# still resolves libX11/libxcb/libxkbcommon from the system at load time, so
# without these every test against the gui binary dies at ld.so with
# "libX11-xcb.so.1: cannot open shared object file". This is the runtime
# (non -dev) subset of etc/DependencyInstaller.sh's GUI xcb list.
RUN apt-get -y update \
&& apt-get -y install --no-install-recommends \
libx11-6 \
libx11-xcb1 \
libsm6 \
libice6 \
libxcb1 \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-shm0 \
libxcb-sync1 \
libxcb-util1 \
libxcb-xfixes0 \
libxcb-xkb1 \
libdbus-1-3 \
libfontconfig1 \
libxkbcommon0 \
libxkbcommon-x11-0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To adhere to Dockerfile best practices, please combine these new packages into the existing RUN block above. This avoids a redundant apt-get update layer, reduces the overall image size, and prevents potential cache-busting issues.

You can move the explanatory comment above the main RUN block (around line 20) to keep the documentation intact.

      time \
      libx11-6 \
      libx11-xcb1 \
      libsm6 \
      libice6 \
      libxcb1 \
      libxcb-cursor0 \
      libxcb-icccm4 \
      libxcb-image0 \
      libxcb-keysyms1 \
      libxcb-randr0 \
      libxcb-render0 \
      libxcb-render-util0 \
      libxcb-shape0 \
      libxcb-shm0 \
      libxcb-sync1 \
      libxcb-util1 \
      libxcb-xfixes0 \
      libxcb-xkb1 \
      libdbus-1-3 \
      libfontconfig1 \
      libxkbcommon0 \
      libxkbcommon-x11-0

@sombraSoft sombraSoft marked this pull request as ready for review July 8, 2026 22:56
@sombraSoft sombraSoft requested a review from a team as a code owner July 8, 2026 22:56
@sombraSoft sombraSoft requested a review from eder-matheus July 8, 2026 22:56
@maliberty maliberty merged commit b27e32e into The-OpenROAD-Project:master Jul 8, 2026
17 checks passed
@maliberty maliberty deleted the bazel-gui-x11-runtime-libs branch July 8, 2026 22:57
@openroad-ci openroad-ci restored the bazel-gui-x11-runtime-libs branch July 8, 2026 22:58
@openroad-ci openroad-ci deleted the bazel-gui-x11-runtime-libs branch July 8, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants