From 076ca62695cf1added920c9163e4ccb42047252a Mon Sep 17 00:00:00 2001 From: Matthew Guthaus Date: Sat, 30 May 2026 16:11:27 -0700 Subject: [PATCH 1/2] etc: move yosys readline dep from -common to -base The previous _install_yosys_dependencies() helper was invoked from _install_yosys() during the -common phase. -common is meant to be runnable without root (it installs into ${PREFIX:-/usr/local} and setup.sh deliberately runs it as $SUDO_USER), but the helper called apt-get/yum/zypper/brew, all of which need root on Linux. As a result, the standard "setup.sh as sudo" install path (and any unprivileged -common -prefix=... use case) failed with: [INFO] Installing libreadline-dev for yosys... E: Could not open lock file /var/lib/dpkg/lock-frontend ... [ERROR] Failed to execute: apt-get -y install --no-install-recommends libreadline-dev Move the dep into the per-platform -base package lists (_install_ubuntu_packages, _install_rhel_packages, _install_opensuse_packages, _install_darwin_packages) where the other system -dev libs already live and where root is already required, and drop _install_yosys_dependencies entirely. The original "readline isn't in -base anymore because OpenROAD uses vendored linenoise" rationale is fine for OpenROAD itself, but yosys still needs it at build time and it has to be installed by the privileged phase regardless. Slightly enlarges -base (libreadline-dev is small) in exchange for making non-root -common work again. Fixes The-OpenROAD-Project/OpenROAD-flow-scripts#4266. Signed-off-by: Matthew Guthaus --- etc/DependencyInstaller.sh | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/etc/DependencyInstaller.sh b/etc/DependencyInstaller.sh index e39ed49096c..caa3991c317 100755 --- a/etc/DependencyInstaller.sh +++ b/etc/DependencyInstaller.sh @@ -157,31 +157,14 @@ _verify_checksum() { _execute "Verifying ${filename} checksum..." bash -c "echo '${checksum} ${filename}' | md5sum --quiet -c -" } -# ------------------------------------------------------------------------------ -# Yosys build dependencies -# ------------------------------------------------------------------------------ -# 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 - elif _command_exists "yum"; then - _execute "Installing readline-devel for yosys..." \ - yum -y install readline-devel - elif _command_exists "zypper"; then - _execute "Installing readline-devel for yosys..." \ - zypper -n install readline-devel - elif [[ "$OSTYPE" == "darwin"* ]]; then - _execute "Installing readline for yosys..." brew install readline - fi -} - # ------------------------------------------------------------------------------ # Yosys # ------------------------------------------------------------------------------ +# Note: yosys's compile-time readline dependency (libreadline-dev / +# readline-devel / readline brew formula) is installed in the per-platform +# -base package functions below. It used to live in a separate helper invoked +# from here, but that put a root-only apt-get inside the unprivileged -common +# phase (see ORFS issue #4266). _install_yosys() { local yosys_prefix=${PREFIX:-"/usr/local"} local yosys_bin=${yosys_prefix}/bin/yosys @@ -195,7 +178,6 @@ _install_yosys() { local required_version="${YOSYS_VERSION#v}" log "Checking Yosys (System: ${yosys_installed_version}, Required: ${required_version})" if [[ "${yosys_installed_version}" != "${required_version}" ]]; then - _install_yosys_dependencies ( cd "${BASE_DIR}" _execute "Cloning Yosys ${YOSYS_VERSION}..." git clone --depth=1 -b "${YOSYS_VERSION}" --recursive https://github.com/YosysHQ/yosys @@ -1004,7 +986,7 @@ _install_ubuntu_packages() { _execute "Installing base packages..." apt-get -y install --no-install-recommends \ automake autotools-dev binutils bison build-essential ccache clang \ debhelper devscripts flex g++ gcc git groff lcov libbz2-dev libffi-dev libfl-dev \ - libgomp1 libomp-dev libpcre2-dev pandoc \ + libgomp1 libomp-dev libpcre2-dev libreadline-dev pandoc \ pkg-config python3-dev qt5-image-formats-plugins tcl tcl-dev \ tcllib unzip wget libyaml-cpp-dev zlib1g-dev tzdata @@ -1048,7 +1030,7 @@ _install_rhel_packages() { bzip2-devel libffi-devel libtool llvm llvm-devel llvm-libs make \ pcre2-devel pkg-config pkgconf pkgconf-m4 pkgconf-pkg-config python3 \ python3-devel python3-pip qt5-qtbase-devel qt5-qtcharts-devel \ - qt5-qtimageformats tcl-devel \ + qt5-qtimageformats readline-devel tcl-devel \ tcl-thread-devel tcllib wget yaml-cpp-devel \ zlib-devel tzdata redhat-rpm-config rpm-build @@ -1085,7 +1067,7 @@ _install_opensuse_packages() { binutils clang gcc gcc11-c++ git groff gzip lcov libbz2-devel libffi-devel \ libgomp1 libomp11-devel libpython3_6m1_0 libqt5-creator libqt5-qtbase \ libqt5-qtstyleplugins libstdc++6-devel-gcc8 llvm pandoc \ - pcre2-devel pkg-config python3-devel python3-pip tcl \ + pcre2-devel pkg-config python3-devel python3-pip readline-devel tcl \ tcl-devel tcllib wget yaml-cpp-devel zlib-devel _execute "Setting gcc alternatives..." update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 50 @@ -1111,7 +1093,7 @@ EOF exit 1 fi log "Install darwin base packages using homebrew (-base or -all)" - _execute "Installing Homebrew packages..." brew install bison boost bzip2 cmake eigen flex fmt groff googletest icu4c libomp or-tools pandoc pkg-config qt@5 python spdlog tcl-tk@8 zlib swig yaml-cpp + _execute "Installing Homebrew packages..." brew install bison boost bzip2 cmake eigen flex fmt groff googletest icu4c libomp or-tools pandoc pkg-config qt@5 python readline spdlog tcl-tk@8 zlib swig yaml-cpp # _execute "Installing pipx..." brew install pipx _execute "Installing Python click..." pip install click _execute "Linking libomp..." brew link --force libomp From a7cc257be5986a29bbb291826ebe726f79b0ade9 Mon Sep 17 00:00:00 2001 From: Matthew Guthaus Date: Sat, 30 May 2026 18:15:11 -0700 Subject: [PATCH 2/2] etc: add libreadline-dev to _install_debian_packages Missed the Debian path in the previous commit. Same rationale: yosys needs libreadline at build time and the install has to happen in the privileged -base phase, not -common. Caught in PR review. Signed-off-by: Matthew Guthaus --- etc/DependencyInstaller.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/DependencyInstaller.sh b/etc/DependencyInstaller.sh index caa3991c317..6841bfcd211 100755 --- a/etc/DependencyInstaller.sh +++ b/etc/DependencyInstaller.sh @@ -1115,7 +1115,7 @@ _install_debian_packages() { _execute "Installing base packages..." apt-get -y install --no-install-recommends \ automake autotools-dev binutils bison build-essential clang debhelper \ devscripts flex g++ gcc git groff lcov libbz2-dev libffi-dev libfl-dev libgomp1 \ - libomp-dev libpcre2-dev "libtcl${tcl_ver}" \ + libomp-dev libpcre2-dev libreadline-dev "libtcl${tcl_ver}" \ pandoc pkg-config python3-dev qt5-image-formats-plugins tcl-dev \ tcllib unzip wget libyaml-cpp-dev zlib1g-dev tzdata