Skip to content

install: check GUI deps before building#9772

Closed
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
Pinata-Consulting:bazel-install
Closed

install: check GUI deps before building#9772
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
Pinata-Consulting:bazel-install

Conversation

@oharboe
Copy link
Copy Markdown
Collaborator

@oharboe oharboe commented Mar 16, 2026

Check for required xcb system packages before starting the expensive Bazel build. Fails fast with a helpful error message showing the exact apt install command on Ubuntu-based systems.

This follows the principle of least astonishment: rather than failing deep in the build with cryptic errors, check upfront and tell the user exactly what to install.

Check for required xcb system packages before starting the
expensive Bazel build. Fails fast with a helpful error message
showing the exact apt install command on Ubuntu-based systems.

This follows the principle of least astonishment: rather than
failing deep in the build with cryptic errors, check upfront
and tell the user exactly what to install.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe oharboe requested a review from maliberty March 16, 2026 06:01
@oharboe
Copy link
Copy Markdown
Collaborator Author

oharboe commented Mar 16, 2026

@gadfort FYI

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown
Contributor

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

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 aims to add a pre-build check for GUI dependencies to fail fast. While the dependency checking logic itself is sound, its placement within bazel/install.sh means it will run after the expensive Bazel build, not before. The bazelisk run //:install command first builds all dependencies of the //:install target (which includes the main OpenROAD application) and only then executes the script. This defeats the primary goal of failing fast. The check should be moved to a mechanism that runs before the build is initiated.

Comment thread bazel/install.sh
Comment on lines +6 to +32
# Check for required system dependencies before expensive build.
# Each tool checks its own deps (separation of concerns).
#
# Currently only Ubuntu/Debian is checked. Dependency checking for
# other platforms (macOS, RHEL, Fedora, etc.) is not implemented
# because we cannot test them. Contributions welcome.
check_ubuntu_deps() {
local missing=()
# GUI deps (xcb libraries needed for Qt)
for pkg in libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev \
libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev; do
if ! dpkg -s "$pkg" &>/dev/null 2>&1; then
missing+=("$pkg")
fi
done
if [[ ${#missing[@]} -gt 0 ]]; then
echo "ERROR: Missing dependencies for OpenROAD GUI build."
echo ""
echo "On Ubuntu this would be:"
echo " sudo apt install ${missing[*]}"
exit 1
fi
}

if command -v dpkg &>/dev/null; then
check_ubuntu_deps
fi
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.

critical

This dependency check is intended to run before the build, but its placement in this script will cause it to run after the build. When bazelisk run //:install is executed, Bazel first builds all the dependencies of the //:install target. Since this script consumes the build artifact openroad.tar, the expensive build will complete before this check is ever run, defeating the purpose of failing fast.

To fix this, the dependency check logic should be moved to a script or mechanism that is executed before the bazelisk build or bazelisk run command that triggers the main application build.

@oharboe
Copy link
Copy Markdown
Collaborator Author

oharboe commented Mar 16, 2026

Closing this — the dep check is unnecessary.

The OpenROAD Bazel build produces a statically linked binary with no runtime dependency on xcb or Qt system packages:

$ ldd tools/install/OpenROAD/bin/openroad
    linux-vdso.so.1
    libm.so.6
    libc.so.6
    /lib64/ld-linux-x86-64.so.2
$ dpkg -s libxcb-icccm4-dev 2>&1
dpkg-query: package 'libxcb-icccm4-dev' is not installed

GUI works fine without any of the checked packages installed. Bazel handles Qt/xcb internally.

@oharboe oharboe closed this Mar 16, 2026
@oharboe
Copy link
Copy Markdown
Collaborator Author

oharboe commented Mar 16, 2026

@maliberty Do we have any dependencies that we need to install on a blank ubuntu anymore?

I have installed the dependencies on my machines long ago, so I can't check.

@maliberty
Copy link
Copy Markdown
Member

If you build with the gui then you do need a bunch see #8532 (still in progress)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants