Skip to content

Commit 076ca62

Browse files
committed
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 <mrg@ucsc.edu>
1 parent e98fb4f commit 076ca62

1 file changed

Lines changed: 9 additions & 27 deletions

File tree

etc/DependencyInstaller.sh

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -157,31 +157,14 @@ _verify_checksum() {
157157
_execute "Verifying ${filename} checksum..." bash -c "echo '${checksum} ${filename}' | md5sum --quiet -c -"
158158
}
159159

160-
# ------------------------------------------------------------------------------
161-
# Yosys build dependencies
162-
# ------------------------------------------------------------------------------
163-
# OpenROAD itself uses vendored linenoise, so readline is no longer in the
164-
# base package lists. Yosys still requires it at compile time, so install it
165-
# here right before the yosys build.
166-
_install_yosys_dependencies() {
167-
if _command_exists "apt-get"; then
168-
export DEBIAN_FRONTEND="noninteractive"
169-
_execute "Installing libreadline-dev for yosys..." \
170-
apt-get -y install --no-install-recommends libreadline-dev
171-
elif _command_exists "yum"; then
172-
_execute "Installing readline-devel for yosys..." \
173-
yum -y install readline-devel
174-
elif _command_exists "zypper"; then
175-
_execute "Installing readline-devel for yosys..." \
176-
zypper -n install readline-devel
177-
elif [[ "$OSTYPE" == "darwin"* ]]; then
178-
_execute "Installing readline for yosys..." brew install readline
179-
fi
180-
}
181-
182160
# ------------------------------------------------------------------------------
183161
# Yosys
184162
# ------------------------------------------------------------------------------
163+
# Note: yosys's compile-time readline dependency (libreadline-dev /
164+
# readline-devel / readline brew formula) is installed in the per-platform
165+
# -base package functions below. It used to live in a separate helper invoked
166+
# from here, but that put a root-only apt-get inside the unprivileged -common
167+
# phase (see ORFS issue #4266).
185168
_install_yosys() {
186169
local yosys_prefix=${PREFIX:-"/usr/local"}
187170
local yosys_bin=${yosys_prefix}/bin/yosys
@@ -195,7 +178,6 @@ _install_yosys() {
195178
local required_version="${YOSYS_VERSION#v}"
196179
log "Checking Yosys (System: ${yosys_installed_version}, Required: ${required_version})"
197180
if [[ "${yosys_installed_version}" != "${required_version}" ]]; then
198-
_install_yosys_dependencies
199181
(
200182
cd "${BASE_DIR}"
201183
_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() {
1004986
_execute "Installing base packages..." apt-get -y install --no-install-recommends \
1005987
automake autotools-dev binutils bison build-essential ccache clang \
1006988
debhelper devscripts flex g++ gcc git groff lcov libbz2-dev libffi-dev libfl-dev \
1007-
libgomp1 libomp-dev libpcre2-dev pandoc \
989+
libgomp1 libomp-dev libpcre2-dev libreadline-dev pandoc \
1008990
pkg-config python3-dev qt5-image-formats-plugins tcl tcl-dev \
1009991
tcllib unzip wget libyaml-cpp-dev zlib1g-dev tzdata
1010992

@@ -1048,7 +1030,7 @@ _install_rhel_packages() {
10481030
bzip2-devel libffi-devel libtool llvm llvm-devel llvm-libs make \
10491031
pcre2-devel pkg-config pkgconf pkgconf-m4 pkgconf-pkg-config python3 \
10501032
python3-devel python3-pip qt5-qtbase-devel qt5-qtcharts-devel \
1051-
qt5-qtimageformats tcl-devel \
1033+
qt5-qtimageformats readline-devel tcl-devel \
10521034
tcl-thread-devel tcllib wget yaml-cpp-devel \
10531035
zlib-devel tzdata redhat-rpm-config rpm-build
10541036

@@ -1085,7 +1067,7 @@ _install_opensuse_packages() {
10851067
binutils clang gcc gcc11-c++ git groff gzip lcov libbz2-devel libffi-devel \
10861068
libgomp1 libomp11-devel libpython3_6m1_0 libqt5-creator libqt5-qtbase \
10871069
libqt5-qtstyleplugins libstdc++6-devel-gcc8 llvm pandoc \
1088-
pcre2-devel pkg-config python3-devel python3-pip tcl \
1070+
pcre2-devel pkg-config python3-devel python3-pip readline-devel tcl \
10891071
tcl-devel tcllib wget yaml-cpp-devel zlib-devel
10901072

10911073
_execute "Setting gcc alternatives..." update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 50
@@ -1111,7 +1093,7 @@ EOF
11111093
exit 1
11121094
fi
11131095
log "Install darwin base packages using homebrew (-base or -all)"
1114-
_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
1096+
_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
11151097
# _execute "Installing pipx..." brew install pipx
11161098
_execute "Installing Python click..." pip install click
11171099
_execute "Linking libomp..." brew link --force libomp

0 commit comments

Comments
 (0)