agent-joule/script/linux
David Charlot 53d9704a90
Some checks failed
congrats.yml / build(linux): install protoc — prost-build no longer vendors it (push) Failing after 0s
deploy_docs.yml / build(linux): install protoc — prost-build no longer vendors it (push) Failing after 0s
deploy_nightly_docs.yml / build(linux): install protoc — prost-build no longer vendors it (push) Failing after 0s
extension_bump.yml / build(linux): install protoc — prost-build no longer vendors it (push) Failing after 0s
Agent Joule Release (Windows) / windows (push) Failing after 3m54s
Agent Joule Release (Linux) / linux (clang, clang++, x86_64-unknown-linux-gnu, ubuntu-22.04) (push) Has been cancelled
Agent Joule Release (Linux) / linux (gcc-14, g++-14, aarch64-unknown-linux-gnu, ubuntu-22.04-arm) (push) Has been cancelled
release / run_tests_mac (push) Has been cancelled
release / run_tests_linux (push) Has been cancelled
release / run_tests_windows (push) Has been cancelled
release / clippy_mac (push) Has been cancelled
release / clippy_linux (push) Has been cancelled
release / clippy_windows (push) Has been cancelled
release / check_scripts (push) Has been cancelled
release / create_draft_release (push) Has been cancelled
release / compliance_check (push) Has been cancelled
release / bundle_linux_aarch64 (push) Has been cancelled
release / bundle_linux_x86_64 (push) Has been cancelled
release / bundle_mac_aarch64 (push) Has been cancelled
release / bundle_mac_x86_64 (push) Has been cancelled
release / bundle_windows_aarch64 (push) Has been cancelled
release / bundle_windows_x86_64 (push) Has been cancelled
release / upload_release_assets (push) Has been cancelled
release / validate_release_assets (push) Has been cancelled
release / release_compliance_check (push) Has been cancelled
release / auto_release_preview (push) Has been cancelled
release / push_release_update_notification (push) Has been cancelled
run_tests / orchestrate (push) Has been cancelled
run_tests / check_style (push) Has been cancelled
run_tests / clippy_windows (push) Has been cancelled
run_tests / clippy_linux (push) Has been cancelled
run_tests / clippy_mac (push) Has been cancelled
run_tests / clippy_mac_x86_64 (push) Has been cancelled
run_tests / run_tests_windows (push) Has been cancelled
run_tests / run_tests_linux (push) Has been cancelled
run_tests / run_tests_mac (push) Has been cancelled
run_tests / miri_scheduler (push) Has been cancelled
run_tests / doctests (push) Has been cancelled
run_tests / check_workspace_binaries (push) Has been cancelled
run_tests / build_visual_tests_binary (push) Has been cancelled
run_tests / check_wasm (push) Has been cancelled
run_tests / check_dependencies (push) Has been cancelled
run_tests / check_docs (push) Has been cancelled
run_tests / check_licenses (push) Has been cancelled
run_tests / check_scripts (push) Has been cancelled
run_tests / check_postgres_and_protobuf_migrations (push) Has been cancelled
run_tests / tests_pass (push) Has been cancelled
build(linux): install protoc — prost-build no longer vendors it
The upgraded prost-build/tonic-build require a system protoc, so the proto
crate's build script failed on the Linux runner:

  Could not find `protoc`. If `protoc` is installed, try setting the PROTOC
  environment variable

script/linux is the canonical Linux dep bootstrap, so add the compiler there
(apt/dnf: protobuf-compiler, zypper: protobuf-devel, pacman/xbps: protobuf)
rather than patching one workflow. Also drop the now-unused Rng import in the
gpui queue that RngExt superseded.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-18 03:05:32 -04:00

288 lines
7 KiB
Shell
Executable file

#!/usr/bin/env bash
set -xeuo pipefail
# if root or if sudo/unavailable, define an empty variable
if [ "$(id -u)" -eq 0 ]
then maysudo=''
else maysudo="$(command -v sudo || command -v doas || true)"
fi
function finalize {
# after packages install (curl, etc), get the rust toolchain
which rustup > /dev/null 2>&1 || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
cat <<EOF
Finished installing Linux dependencies with script/linux
EOF
}
# Ubuntu, Debian, Mint, Kali, Pop!_OS, Raspbian, etc.
apt=$(command -v apt-get || true)
if [[ -n $apt ]]; then
deps=(
gcc
g++
libasound2-dev
libfontconfig-dev
libgit2-dev
libglib2.0-dev
libssl-dev
libva-dev
libvulkan1
libwayland-dev
libx11-xcb-dev
libxkbcommon-x11-dev
libzstd-dev
make
cmake
clang
lld
llvm
jq
git
curl
gettext-base
elfutils
libsqlite3-dev
protobuf-compiler
musl-tools
musl-dev
build-essential
pipewire
xdg-desktop-portal
)
if (grep -qP 'PRETTY_NAME="(Debian|Raspbian).+13' /etc/os-release); then
# libstdc++-14-dev is in build-essential
true
elif (grep -qP 'PRETTY_NAME="(Linux Mint 22|.+24\.(04|10))' /etc/os-release); then
deps+=( libstdc++-14-dev )
elif (grep -qP 'PRETTY_NAME="((Debian|Raspbian).+12|Linux Mint 21|.+22\.04)' /etc/os-release); then
deps+=( libstdc++-12-dev )
elif (grep -qP 'PRETTY_NAME="((Debian|Raspbian).+11|Linux Mint 20|.+20\.04)' /etc/os-release); then
# Ubuntu 20.04 ships clang-10 and libstdc++-10 which lack adequate C++20
# support for building webrtc-sys (requires -std=c++20, lambdas in
# unevaluated contexts from clang 17+, and working std::ranges in the
# stdlib).
# Note: the prebuilt libwebrtc.a is compiled with libstdc++, so we must
# use libstdc++ (not libc++) to avoid ABI mismatches at link time.
# libstdc++-11-dev (headers with working pointer_traits/contiguous_range)
# is only available from the ubuntu-toolchain-r PPA. Add the source list
# and GPG key manually instead of using add-apt-repository, whose HKP
# keyserver lookups (port 11371) frequently time out in CI.
$maysudo "$apt" install -y curl gnupg
codename=$(lsb_release -cs)
echo "deb https://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu $codename main" | \
$maysudo tee /etc/apt/sources.list.d/ubuntu-toolchain-r-test.list > /dev/null
curl -fsSL 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F' | \
sed -n '/-----BEGIN PGP PUBLIC KEY BLOCK-----/,/-----END PGP PUBLIC KEY BLOCK-----/p' | \
$maysudo gpg --dearmor -o /etc/apt/trusted.gpg.d/ubuntu-toolchain-r-test.gpg
deps+=( clang-18 libstdc++-11-dev )
fi
$maysudo "$apt" update
$maysudo "$apt" install -y "${deps[@]}"
finalize
exit 0
fi
# Fedora, CentOS, RHEL, Alma, Amazon 2023, Oracle, etc.
dnf=$(command -v dnf || true)
# Old Redhat (yum only): Amazon Linux 2, Oracle Linux 7, etc.
yum=$(command -v yum || true)
if [[ -n $dnf ]] || [[ -n $yum ]]; then
pkg_cmd="${dnf:-${yum}}"
deps=(
protobuf-compiler
musl-gcc
gcc
clang
cmake
alsa-lib-devel
fontconfig-devel
glib2-devel
libva-devel
wayland-devel
libxcb-devel
libxkbcommon-x11-devel
openssl-devel
libzstd-devel
vulkan-loader
sqlite-devel
pipewire
xdg-desktop-portal
jq
git
tar
)
# perl used for building openssl-sys crate. See: https://docs.rs/openssl/latest/openssl/
if grep -qP '^ID="?(fedora)' /etc/os-release; then
deps+=(
perl-FindBin
perl-IPC-Cmd
perl-File-Compare
perl-File-Copy
)
elif grep -qP '^ID="?(rhel|rocky|alma|centos|ol)' /etc/os-release; then
deps+=( perl-interpreter )
fi
# gcc-c++ is g++ on RHEL8 and 8.x clones
if grep -qP '^ID="?(rhel|rocky|alma|centos|ol)' /etc/os-release \
&& grep -qP '^VERSION_ID="?(8)' /etc/os-release; then
deps+=( gcc-c++ )
else
deps+=( g++ )
fi
# libxkbcommon-x11-devel is in a non-default repo on RHEL 8.x/9.x (except on AmazonLinux)
if grep -qP '^VERSION_ID="?(8|9)' /etc/os-release && grep -qP '^ID="?(rhel|rocky|centos|alma|ol)' /etc/os-release; then
$maysudo dnf install -y 'dnf-command(config-manager)'
if grep -qP '^PRETTY_NAME="(AlmaLinux 8|Rocky Linux 8)' /etc/os-release; then
$maysudo dnf config-manager --set-enabled powertools
elif grep -qP '^PRETTY_NAME="((AlmaLinux|Rocky|CentOS Stream) 9|Red Hat.+(8|9))' /etc/os-release; then
$maysudo dnf config-manager --set-enabled crb
elif grep -qP '^PRETTY_NAME="Oracle Linux Server 8' /etc/os-release; then
$maysudo dnf config-manager --set-enabled ol8_codeready_builder
elif grep -qP '^PRETTY_NAME="Oracle Linux Server 9' /etc/os-release; then
$maysudo dnf config-manager --set-enabled ol9_codeready_builder
else
echo "Unexpected distro" && grep 'PRETTY_NAME' /etc/os-release && exit 1
fi
fi
$maysudo "$pkg_cmd" install -y "${deps[@]}"
finalize
exit 0
fi
# openSUSE
# https://software.opensuse.org/
zyp=$(command -v zypper || true)
if [[ -n $zyp ]]; then
deps=(
protobuf-devel
alsa-devel
clang
cmake
fontconfig-devel
gcc
libva-devel
gcc-c++
glib2-devel
git
gzip
jq
libvulkan1
libx11-devel
libxcb-devel
libxkbcommon-devel
libxkbcommon-x11-devel
libzstd-devel
make
openssl-devel
sqlite3-devel
tar
wayland-devel
xcb-util-devel
pipewire
xdg-desktop-portal
)
$maysudo "$zyp" install -y "${deps[@]}"
finalize
exit 0
fi
# Arch, Manjaro, etc.
# https://archlinux.org/packages
pacman=$(command -v pacman || true)
if [[ -n $pacman ]]; then
deps=(
protobuf
gcc
clang
musl
cmake
alsa-lib
fontconfig
glib2
libva
wayland
libgit2
libxcb
libxkbcommon-x11
openssl
zstd
pkgconf
sqlite
pipewire
xdg-desktop-portal
jq
git
)
$maysudo "$pacman" -Syu --needed --noconfirm "${deps[@]}"
finalize
exit 0
fi
# Void
# https://voidlinux.org/packages/
xbps=$(command -v xbps-install || true)
if [[ -n $xbps ]]; then
deps=(
protobuf
gettext-devel
clang
cmake
jq
elfutils-devel
gcc
alsa-lib-devel
fontconfig-devel
glib-devel
libva-devel
libxcb-devel
libxkbcommon-devel
libzstd-devel
openssl-devel
wayland-devel
vulkan-loader
sqlite-devel
pipewire
xdg-desktop-portal
)
$maysudo "$xbps" -Syu "${deps[@]}"
finalize
exit 0
fi
# Gentoo
# https://packages.gentoo.org/
emerge=$(command -v emerge || true)
if [[ -n $emerge ]]; then
deps=(
app-arch/zstd
app-misc/jq
dev-libs/glib
dev-libs/openssl
dev-libs/wayland
dev-util/cmake
media-libs/alsa-lib
media-libs/fontconfig
media-libs/libva
media-libs/vulkan-loader
x11-libs/libxcb
x11-libs/libxkbcommon
dev-db/sqlite
media-video/pipewire
sys-apps/xdg-desktop-portal
)
$maysudo "$emerge" -u "${deps[@]}"
finalize
exit 0
fi
echo "Unsupported Linux distribution in script/linux"
exit 1