mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 16:56:48 +00:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
90 lines
2.3 KiB
Bash
Executable File
90 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Install sanitizer runtime libraries required to run binaries compiled with:
|
|
# -fsanitize=address → libasan.so.8
|
|
# -fsanitize=thread → libtsan.so.2
|
|
# -fsanitize=undefined → libubsan.so.1
|
|
#
|
|
# The exact SONAMEs required depend on the compiler toolchain used to build the
|
|
# test binaries (see nix/ci-env.nix). If the toolchain is bumped and SONAMEs
|
|
# change, update the list below (or detect them from the binaries).
|
|
#
|
|
# Supported base images:
|
|
# debian:bookworm
|
|
# ubuntu:20.04
|
|
# rhel:9
|
|
# nixos/nix — tests are skipped; this script is not called
|
|
|
|
set -euo pipefail
|
|
|
|
if [ ! -f /etc/os-release ]; then
|
|
echo "ERROR: /etc/os-release not found; cannot detect OS" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# shellcheck source=/dev/null
|
|
. /etc/os-release
|
|
|
|
echo "Detected OS: ${ID} ${VERSION_ID:-}"
|
|
|
|
case "${ID}" in
|
|
debian)
|
|
apt-get update -y
|
|
apt-get install -y --no-install-recommends \
|
|
libasan8 \
|
|
libtsan2 \
|
|
libubsan1
|
|
|
|
apt-get clean
|
|
rm -rf /var/lib/apt/lists/*
|
|
;;
|
|
|
|
ubuntu)
|
|
apt-get update -y
|
|
apt-get install -y --no-install-recommends \
|
|
gnupg \
|
|
software-properties-common
|
|
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
apt-get update -y
|
|
apt-get install -y --no-install-recommends \
|
|
libasan8 \
|
|
libtsan2 \
|
|
libubsan1
|
|
|
|
apt-get clean
|
|
rm -rf /var/lib/apt/lists/*
|
|
;;
|
|
|
|
rhel | centos | rocky | almalinux)
|
|
dnf install -y \
|
|
libasan8 \
|
|
libtsan2 \
|
|
libubsan
|
|
|
|
dnf clean -y all
|
|
rm -rf /var/cache/dnf/*
|
|
;;
|
|
|
|
*)
|
|
echo "ERROR: unsupported OS '${ID}'. Supported: debian, ubuntu, rhel-family" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# Verify that every expected library is now resolvable by the dynamic linker.
|
|
missing=0
|
|
for lib in libasan.so.8 libtsan.so.2 libubsan.so.1; do
|
|
if ldconfig -p | grep -q "${lib}"; then
|
|
echo "OK: ${lib} found"
|
|
else
|
|
echo "ERROR: ${lib} not found after installation" >&2
|
|
missing=$((missing + 1))
|
|
fi
|
|
done
|
|
|
|
if [ "${missing}" -ne 0 ]; then
|
|
echo "ERROR: ${missing} library/libraries missing" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "All sanitizer runtime libraries installed successfully."
|