summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/install-build-deps.sh
AgeCommit message (Collapse)Author
2026-08-12perf build: install-build-deps: add RHEL family devel package mappingArnaldo Carvalho de Melo
With the Fedora mapping in place, this patch extends it to the RHEL family (RHEL, CentOS Stream, Rocky Linux, AlmaLinux, Oracle Linux), which shares most Fedora package names and runs dnf (RHEL 8 and later). The names that differ are handled by probing the enabled repos: - zlib.h comes from zlib-ng-compat-devel on the RHEL 10 family, zlib-devel on RHEL 9 and earlier; - there is no java-latest-openjdk-devel: the JDK devel package is versioned per release, java-21-openjdk-devel on the RHEL 10 family, java-17-openjdk-devel on RHEL 9, java-11-openjdk-devel on RHEL 8; - libbpf-devel and capstone-devel live in the CRB repo on RHEL and CentOS Stream 10, in EPEL on RHEL 9 and earlier; - libbabeltrace2-devel is not packaged on the RHEL 10 family. Packages not available on the enabled repos are skipped instead of aborting the dnf transaction, and are listed at the end of the run, with the repo that provides them pointed out in the header comment and help text: a distro with CRB/EPEL enabled gets the full set, one without them still installs what it can. This also holds for the base set: e.g. 'rust' exists only as the rust-toolset AppStream module on RHEL 8 and 9, where it is not installable as a plain package, so it is skipped and noted there instead of failing the whole dnf transaction. The base set lists pkgconf-pkg-config instead of pkgconfig: both families have been on pkgconf since Fedora 26 / RHEL 8, where 'pkgconfig' lives only as a virtual Provides of that subpackage, and a minimal RHEL-family container may not have it preinstalled. Validated on a fresh CentOS Stream 10 distrobox container, with the CRB repo enabled, so the host system is not modified: distrobox create --image quay.io/centos/centos:stream10 distrobox enter centos-stream10 dnf config-manager --set-enabled crb make -C tools/perf install-build-deps which installed the 28 available mapped packages; libbabeltrace2-devel, the only mapped package with no RHEL 10 package, is reported at the end of the run. A subsequent 'make -C tools/perf feature-dump' enabled every feature with an external dependency the RHEL 10 family provides, including libbpf and libcapstone from the CRB repo, with only babeltrace2-ctf-writer left out along with the deliberately unmapped opt-in features. Re-running the target is a no-op (dnf reports "Nothing to do"); with the CRB repo disabled, the skipped packages are instead listed in the end-of-run note, whose header comment and help text point out which repo provides them. Members of the family without dnf (RHEL 7 and earlier, e.g. Oracle Linux 7, a yum-only distro) are rejected with an explicit error while the dnf-based members get the full mapping. Example of its --list: $ grep PRETTY_NAME /etc/os-release PRETTY_NAME="Fedora Linux 44 (Toolbx Container Image)" $ tools/perf/scripts/install-build-deps.sh --list --distro rhel bison capstone-devel clang-devel elfutils-debuginfod-client-devel elfutils-devel elfutils-libelf-devel flex gcc gcc-c++ glibc-devel java-latest-openjdk-devel kernel-headers libbabeltrace2-devel libbpf-devel libpfm-devel libstdc++-devel libtraceevent-devel libzstd-devel llvm-devel make numactl-devel openssl-devel pkgconf-pkg-config python3-devel python3-setuptools rust slang-devel systemtap-sdt-devel xz-devel zlib-ng-compat-devel $ Assisted-by: opencode:deepseek-v4-flash-free Assisted-by: claude:claude-opus-4-7 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-08-12perf build: install-build-deps: add Debian devel package mappingArnaldo Carvalho de Melo
With the Fedora and Ubuntu mappings in place, this patch adds Debian support: Debian installs the same devel packages, under the same names, as the Ubuntu mapping, so it reuses debian_pkg_for() and debian_base_pkgs as-is, with only auto-detection in detect_distro() (and the shared apt-get install path) added, keeping the script's per-distro dispatch ready for distros with their own package names. Validated on a fresh Debian 13 (trixie) container so the host system is not modified: distrobox create --image debian:trixie distrobox enter debian-trixie make -C tools/perf install-build-deps which installed the 29 mapped packages; re-running the target is a no-op (apt-get reports "0 newly installed"). A subsequent clean build enabled the same feature set as Ubuntu: 'perf version --build-options' shows every feature with an external dependency Debian has a package for [on], including the BPF skeletons compiled with clang/llvm (libLLVM), the python binding and the C++-based features, with only the deliberately unmapped libbfd family, libperl, libunwind and the CoreSight (libopencsd) packages [OFF]. RHEL, whose package mapping is largely similar to Fedora's, is the remaining planned distro, to be enabled once that mapping is validated on it. Example of its --list: $ grep PRETTY_NAME /etc/os-release PRETTY_NAME="Fedora Linux 44 (Toolbx Container Image)" $ tools/perf/scripts/install-build-deps.sh --list --distro debian bison clang default-jdk flex g++ gcc libbabeltrace2-dev libbpf-dev libc6-dev libcapstone-dev libdebuginfod-dev libdw-dev libelf-dev liblzma-dev libnuma-dev libpfm4-dev libslang2-dev libssl-dev libtraceevent-dev libzstd-dev linux-libc-dev llvm-dev make pkg-config python3-dev python3-setuptools rustc systemtap-sdt-dev zlib1g-dev $ Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-08-12perf build: install-build-deps: add Ubuntu devel package mappingArnaldo Carvalho de Melo
With the framework and Fedora mapping in place, this patch adds the Ubuntu (apt) mapping: same feature-to-package correspondence as the Fedora one, adapted to Debian packaging conventions (libfoo-dev), on a per-distro dispatch so future distros can pick their own mapping or reuse one of these (Debian shares the Ubuntu mapping). Notable differences from Fedora: - base set: g++ (ships libstdc++-*-dev, covering cxa-demangle), pkg-config (installed implicitly by Fedora's default toolchain metapackage, but not by Ubuntu's), linux-libc-dev and libc6-dev instead of kernel-headers and glibc-devel, and rustc for rust; - cxa-demangle maps to nothing, covered by g++'s libstdc++; - the clang-bpf-co-re test needs the clang compiler binary (Fedora's clang-devel provides it transitively), and llvm-dev, which also brings llvm-config (deps on the llvm package), used by the llvm/llvm-perf tests; - libslang maps to libslang2-dev and jvmti to default-jdk; - the install command runs 'apt-get update' first since a fresh container has no package indexes, unlike dnf. Validated on a fresh Ubuntu 26.04 distrobox container so the host system is not modified: distrobox create --image ubuntu:26.04 distrobox enter ubuntu-26-04 make -C tools/perf install-build-deps which installed the 29 mapped packages; a subsequent clean O= build enabled every feature with an external dependency Ubuntu has a package for: perf's build-options then showed all of them [on], including the BPF skeletons requiring clang/llvm, the python binding and the C++-based features, with only the deliberately unmapped (deprecated) libbfd family, libperl and libunwind [OFF], and the build linked libpfm, libbabeltrace2-ctf-writer, libcapstone, libtraceevent, libslang, libnuma, libdw and libssl. Re-running the target is a no-op (apt-get reports "0 newly installed"). Debian (trixie) is the next planned distro: it shares this Ubuntu mapping, so enabling it reuses it as-is, once it gets validated on a Debian release. Example of its --list: $ grep PRETTY_NAME /etc/os-release PRETTY_NAME="Fedora Linux 44 (Toolbx Container Image)" $ tools/perf/scripts/install-build-deps.sh --list --distro ubuntu bison clang default-jdk flex g++ gcc libbabeltrace2-dev libbpf-dev libc6-dev libcapstone-dev libdebuginfod-dev libdw-dev libelf-dev liblzma-dev libnuma-dev libpfm4-dev libslang2-dev libssl-dev libtraceevent-dev libzstd-dev linux-libc-dev llvm-dev make pkg-config python3-dev python3-setuptools rustc systemtap-sdt-dev zlib1g-dev $ Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-08-12perf build: install-build-deps: add Fedora devel package mappingArnaldo Carvalho de Melo
With the framework from the previous commit in place, this patch adds the per-feature mapping for Fedora/dnf: for each feature test in tools/build/feature/, the Fedora devel package providing the headers or library the test compiles against, kept explicit in the script next to the test that requires it. Special cases: - test-libdebuginfod.c includes <elfutils/debuginfod.h>, provided by elfutils-debuginfod-client-devel, not elfutils-devel; - the cxa-demangle test links against libstdc++'s builtin demangler, pulling in libstdc++-devel; - the BPF-oriented features (bpf, clang-bpf-co-re) get their headers from the base packages and clang-devel. Tests with no Fedora equivalent (bionic, compile-32, compile-x32) and the opt-in/deprecated ones (libbfd disassembler family, GTK2, LIBPERL, LIBUNWIND, CoreSight, and the tests perf itself doesn't check, like libcpupower) are deliberately not mapped. Validated on a fresh Fedora 44 toolbx container, so the host OS is not modified: toolbox create fedora:44 toolbox enter fedora:44 make -C tools/perf install-build-deps which installed the 29 mapped packages; a subsequent clean O= build enabled every feature with an external dependency Fedora provides (feature tests went to 1, except bionic/compile-32/compile-x32, which have no Fedora equivalent, and the libunwind-debug-frame tests, whose symbols Fedora's libunwind does not export), linking libpfm, libbabeltrace2-ctf-writer, libcapstone, libtraceevent, libslang and libnuma, as well as building the BPF skeletons requiring clang/llvm. Re-running the target is a no-op (dnf reports "Nothing to do"). RHEL and its derivatives share most Fedora package names but are refused by the script until this mapping is validated on them. Example of its --list option: $ grep PRETTY_NAME /etc/os-release PRETTY_NAME="Fedora Linux 44 (Toolbx Container Image)" $ tools/perf/scripts/install-build-deps.sh --list bison capstone-devel clang-devel elfutils-debuginfod-client-devel elfutils-devel elfutils-libelf-devel flex gcc gcc-c++ glibc-devel java-latest-openjdk-devel kernel-headers libbabeltrace2-devel libbpf-devel libpfm-devel libstdc++-devel libtraceevent-devel libzstd-devel llvm-devel make numactl-devel openssl-devel python3-devel python3-setuptools rust slang-devel systemtap-sdt-devel xz-devel zlib-devel $ Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-08-12perf build: Add install-build-deps framework to install devel packagesArnaldo Carvalho de Melo
Installing the development packages needed to build perf is error-prone on a fresh distro install: the packages are scattered across the feature tests in tools/build/feature/, each checking for a specific header/library, and the build only tells you what's missing after failing a check. This series adds a 'make -C tools/perf install-build-deps' target to install them in one go, deriving the package list from the feature tests themselves. This commit adds the framework, on top of the parse-time compiler probe guard from the previous commit: - the install-build-deps target in tools/perf/Makefile.perf, exempted from the config/feature detection pass, since it must run in a fresh container, before gcc or pkg-config exist, to install them; - the install-build-deps.sh script, with --list, --dry-run and --distro options, distro detection (Fedora and Ubuntu), dnf and apt-get drivers, root/passwordless-sudo handling, and the base packages common to any build: compiler, C++ compiler, make, flex, bison, libc and kernel headers, python3-setuptools (needed by the python binding) and rust (checked by the rust feature test); - the parse-time probes for optional tools, like pkg-config, use 'command -v' with stderr discarded, so a fresh container without them gets no 'which: no pkg-config in (...)' spew from make; - the script does not rely on 'set -e': its error paths are explicit, since the make target runs it via $(SHELL), where a shebang option would be ignored anyway, so direct and make-driven runs behave the same. The per-feature mappings, from each feature test to the devel package providing its headers on a given distro, are added by the follow-up patches, one per distro, together with the validation of each mapping in a fresh container: until then the target installs just the base toolchain. Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>