Skip to content

etc: install readline as a yosys build dep - #10475

Merged
sombraSoft merged 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:yosys-readline-dep
May 21, 2026
Merged

sombraSoft merged 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:yosys-readline-dep

Conversation

@openroad-ci

@openroad-ci openroad-ci commented May 21, 2026 •

Copy link
Copy Markdown
Member

Why

Commit 7ebd5e3 ("Replace tclreadline+GNU readline with vendored linenoise") removed libreadline-dev / readline-devel / tcl-tclreadline from OpenROAD's base package lists, since OpenROAD itself now uses vendored linenoise. However, _install_yosys still requires readline at compile time, so any caller of ./etc/DependencyInstaller.sh -eqy (e.g. OpenROAD-flow-scripts) hits:

kernel/driver.cc:29:12: fatal error: readline/readline.h: No such file or directory

OR's own CI didn't catch this because the OR Dockerfile passes -base -common but never -eqy, so _install_yosys never runs in OR-Public/master. ORFS-Nightly began failing on 2026-05-19 because it bumps the OR submodule to OR master and does pass -eqy. Two workaround PRs have already landed on ORFS (#4246, #4248) that add readline to ORFS's own package lists or reorder the Dockerfile invocation. Both are functional but neither addresses the root cause: yosys's build deps belong with yosys's install, not split across a downstream repo's OS package lists.

What

Add _install_yosys_dependencies() that installs the OS-appropriate readline development package:

OS Package
Ubuntu / Debian libreadline-dev
RHEL / Rocky / AlmaLinux readline-devel
openSUSE Leap readline-devel (zypper)
Darwin readline (brew)

It's called from inside _install_yosys right before the git clone / make. The install happens only when yosys is actually going to be built (gated by the existing version-mismatch check), so users with yosys already at the right version don't pay any cost.

OpenROAD's own base package lists stay free of the GPLv3 readline dep, preserving the licensing intent of 7ebd5e3.

Effect on downstream

Once this lands, both ORFS workarounds become redundant and can be reverted in a follow-up:

Test plan

  • Local ./etc/DependencyInstaller.sh -ci -eqy -common -yosys-ver=v0.64 on ubuntu:22.04 and ubuntu:24.04 — yosys compiles cleanly
  • Same on rockylinux:8 and rockylinux:9
  • Confirm _install_yosys_dependencies is skipped (gated by version check) when yosys is already at the required version

Add _install_yosys_dependencies() that installs the OS-appropriate
readline development package (libreadline-dev on Debian/Ubuntu,
readline-devel on RHEL/openSUSE, readline brew formula on Darwin) and
call it from inside _install_yosys right before the git clone / make.

OpenROAD itself uses vendored linenoise so readline is no longer in the
base package lists, but _install_yosys still requires the headers at
compile time. This co-locates the dep with its consumer instead of
relying on downstream callers to add readline to their own package
lists.

Signed-off-by: SombraSoft <sombrio@sombrasoft.dev>
@openroad-ci
openroad-ci requested a review from a team as a code owner May 21, 2026 01:07
@openroad-ci
openroad-ci requested a review from eder-matheus May 21, 2026 01:07
@sombraSoft

Copy link
Copy Markdown
Contributor

Local validation

All four OS targets pass the yosys build with the new _install_yosys_dependencies() function:

OS Result
Ubuntu 22.04 ✅ Installing libreadline-dev for yosys... ✔ → Building Yosys... ✔ (log:237-240)
Ubuntu 24.04 ✅ same pattern (log:271-274)
Rocky Linux 8 ✅ readline portion: Installing readline-devel for yosys... ✔ (log:545). Note: yosys still fails afterwards on a pre-existing stock-rocky:8 issue (Python 3.6 < 3.7 required by yosys's helper scripts) — unrelated to readline; would have hit any installer regardless.
Rocky Linux 9 ✅ Installing readline-devel for yosys... ✔ → Building Yosys... ✔ (log:654-656)

Reproducer (each OS):

docker run --rm -v <OR-repo>:/openroad -w /openroad <ubuntu:22.04|ubuntu:24.04|rockylinux:8|rockylinux:9> \
  bash -c '<bootstrap deps> && ./etc/DependencyInstaller.sh -all -ci -eqy -yosys-ver=v0.64'

Gating verified

Ran the installer twice in the same Ubuntu 22.04 container:

===== FIRST RUN =====
[INFO] Checking Yosys (System: none, Required: 0.64)
[INFO] Installing libreadline-dev for yosys... ✔
[INFO] Building Yosys... ✔
===== SECOND RUN =====
[INFO] Checking Yosys (System: 0.64, Required: 0.64)

Installing libreadline-dev for yosys occurrence count across both runs: 1 (only the first). The dependency install is correctly skipped when yosys is already at the required version, as expected from being inside the if [[ "${yosys_installed_version}" != "${required_version}" ]] block.

@github-actions

Copy link
Copy Markdown
Contributor

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

@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 introduces a new function, _install_yosys_dependencies, in etc/DependencyInstaller.sh to ensure that readline is installed before building Yosys. This change is necessary because OpenROAD now uses vendored linenoise, while Yosys still requires readline at compile time. Feedback suggests refactoring the new function to use _command_exists for more robust package manager detection and replacing dnf with yum to maintain consistency with the existing script's conventions for RHEL-based distributions.

Comment thread etc/DependencyInstaller.sh Resolved
Refactor _install_yosys_dependencies to use _command_exists for package
manager detection (matching _install_bazel's pattern) and switch from
dnf to yum on RHEL paths (matching _install_rhel_packages and the rest
of the script). Removes the implicit dependency on the dynamically
scoped ${os} variable.

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

Copy link
Copy Markdown
Contributor

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

@sombraSoft
sombraSoft enabled auto-merge May 21, 2026 15:30
@sombraSoft
sombraSoft merged commit 44af3fb into The-OpenROAD-Project:master May 21, 2026
16 checks passed
@sombraSoft
sombraSoft deleted the yosys-readline-dep branch May 21, 2026 16:52
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