Skip to content

-common -prefix=… (non-root local install) fails: yosys readline dep does a root-only apt-get #4266

@mguthaus

Description

@mguthaus

Summary

The -common dependency phase is intended to run without root and install into a user-specified prefix (-prefix=DIR / -local). But it tries to apt-get install libreadline-dev for the yosys build, which requires root, so a non-privileged local install fails.

Steps to reproduce

On a fresh master checkout:

source dev_env.sh
sudo ./etc/DependencyInstaller.sh -base
./etc/DependencyInstaller.sh -common -prefix="./dependencies"
./build_openroad.sh

During the third step (-common), it fails:

[INFO] Installing libreadline-dev for yosys... ✖
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
[ERROR] Failed to execute: apt-get -y install --no-install-recommends libreadline-dev

Environment

  • OS: Ubuntu 24.04.4 LTS
  • ORFS: master (7b05472e7)
  • OpenROAD submodule pin: 04cbde6e14

Root cause

In tools/OpenROAD/etc/DependencyInstaller.sh, readline was moved out of the -base package lists and into a build-time step that runs during -common:

# OpenROAD itself uses vendored linenoise, so readline is no longer in the
# base package lists. Yosys still requires it at compile time, so install it
# here right before the yosys build.
_install_yosys_dependencies() {
    if _command_exists "apt-get"; then
        export DEBIAN_FRONTEND="noninteractive"
        _execute "Installing libreadline-dev for yosys..." \
            apt-get -y install --no-install-recommends libreadline-dev
    ...

Call chain: -common → (-eqy) _install_equivalence_deps_install_yosys_install_yosys_dependenciesapt-get install libreadline-dev.

libreadline-dev no longer appears in any -base/-all apt list, so it is only installed from this path. This puts a privileged, system-wide apt-get inside the unprivileged -common phase, which contradicts the -prefix/-local non-root use case (and setup.sh, which deliberately runs -common as $SUDO_USER).

What's the intended fix for a non-root "local" -common build?

A few options — would appreciate guidance on the preferred one:

  1. Move readline back into -base (the privileged phase), where the other system -dev packages live. -common then assumes it's already present. Simplest and matches the original layout.
  2. Skip the apt-get in -common when unprivileged / already present, e.g. guard _install_yosys_dependencies with [[ -f /usr/include/readline/readline.h ]] || [[ "$(id -u)" -ne 0 ]] && return 0, and document that readline must be installed via -base/system beforehand.
  3. Build readline into the prefix like the other -common deps (heaviest; probably overkill for a system lib).

More broadly: is a fully non-root -common -prefix=… (tools into a user tree, system -dev libs via a one-time sudo -base) a supported workflow? It seems like a common thing to want, so it's surprising it currently breaks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions