From nobody Tue Sep 29 06:52:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB35737DABD; Tue, 11 Aug 2026 18:29:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472958; cv=none; b=X+MJklErAC+6xng+N7615Gr5NEs5Te3XOYOFQ7hrl4eCvgHdGd3KVrGHTI5mRzHrrw8x/kEUvAvWa+um0aAr/LinQxWPEy5P4tF05f3ZMS0kd0BsvZDrICxoh5BMvHXci4aTuise/k0KujMSD3Ds/3Zh67nA9UOLHqYzspIu90Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472958; c=relaxed/simple; bh=tpGtwYZ145YqUkXgN1heb52ddn3Lp2WW7a/b2a4GalQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QIKwcrszOcsoVTu0fdLr0YfEMd/1qcySy17Cb2aUS8PGaBQvHd3uzMrj1cxu168WrFNjzcmHvgDzEH1aTBXWz8nVRLLwtNNuVGZeulS1v7OumQCutsBdnJKXtpW0DxLwq2ddZIssFX0Ix0/40ckWLlPcqRu9YwtuVONLIOwuZIY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lJLrsa2S; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lJLrsa2S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1B961F00A3A; Tue, 11 Aug 2026 18:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786472956; bh=UxQMLD9BxGWhyYllynrzfLFDhx4GP1OBZQcL24YtVjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lJLrsa2SorDUsX3+IB97vf/pPyBr0yhxcvIWweC/Y2a+Cg7MFICeNsWTxZNNyTpPj aegzQfyC9HSy/lOe+jUOdhD15dNSQeDDXrzkxiCfy0ObTKEjRT0pc4HSBy+pQ0c/wx n9hXc1Seyw+zOu8iy7fZ0AChwPI9dlQq8oE5tQq7MDhl6luhtxbkpGUDOiqbzLwQMw 1XpKAhrL+i9w8JJOjaGTGzUqEINw5otO/Qd4nhHr6d/4BH0+vzH42CF/iiXXGu8tZQ ldLd8XZeZVAYNajcgXIguq5/5c1u5g5xy+fnZ+VY9M98AVkJjYspS1GC5+VQGYHYur LY9gbrQphU9SQ== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , James Clark , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 1/7] tools build: Only probe the compiler at parse time when it is installed Date: Tue, 11 Aug 2026 15:28:54 -0300 Message-ID: <20260811182900.27063-2-acme@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260811182900.27063-1-acme@kernel.org> References: <20260811182900.27063-1-acme@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnaldo Carvalho de Melo Two parse-time probes still invoke $(CC) unconditionally: - LP64 in tools/scripts/Makefile.arch, probing with $(CC) -E -x c, pulled in twice by tools/perf/Makefile.perf; - CC_NO_CLANG in tools/scripts/Makefile.include, probing with $(CC) -dM -E -x c /dev/null. In the corner case where gcc is not yet installed, the very setup the install-build-deps target, added in the next patch of this series, is meant for, these probes make even targets that never compile parse-time spew errors like: /bin/sh: 1: gcc: not found /bin/sh: 1: gcc: not found /bin/sh: 1: gcc: not found Guard both probes with 'command -v' using the first word of CC so a missing compiler is handled silently with the same result as a failing probe (CC_NO_CLANG and LP64 unset/0), and with no behavior change when the compiler is installed. Only the first word is consulted because CC may carry arguments such as 'ccache gcc', and shell implementations differ in how 'command -v' handles multiple words (dash only checks the first, bash any of them), so validating the whole CC value would silently disable both probes on some make SHELLs. Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Arnaldo Carvalho de Melo --- tools/scripts/Makefile.arch | 8 +++++++- tools/scripts/Makefile.include | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch index eabfe9f411d914b9..ed5f008d400ed238 100644 --- a/tools/scripts/Makefile.arch +++ b/tools/scripts/Makefile.arch @@ -38,7 +38,13 @@ ifeq ($(ARCH),loongarch64) SRCARCH :=3D loongarch endif =20 -LP64 :=3D $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) +# Probe for __LP64__ only when the compiler is installed: this runs at +# parse time for every target, including ones that never compile, e.g. +# install-build-deps, and would otherwise spew "gcc: not found" when the +# compiler is not yet installed. Only the first word of CC is consulted, +# as CC may carry arguments, e.g. 'ccache gcc'. When the guard fails it +# prints nothing, leaving LP64 unset, as if the probe had failed. +LP64 :=3D $(shell if command -v $(firstword ${CC}) >/dev/null 2>&1; then e= cho __LP64__ | ${CC} ${CFLAGS} -E -x c -; fi | tail -n 1) ifeq ($(LP64), 1) IS_64_BIT :=3D 1 else diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index 46a3872b87624a7b..378387f629603e92 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include @@ -98,7 +98,13 @@ else $(call allow-override,LLVM_STRIP,llvm-strip) endif =20 -CC_NO_CLANG :=3D $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__= "; echo $$?) +# The CC_NO_CLANG probe also runs at parse time for targets that never +# compile, so guard it with 'command -v': when the compiler is not yet +# installed, e.g. the first install-build-deps run, it would otherwise +# spew "gcc: not found". Only the first word of CC is consulted, as CC +# may carry arguments, e.g. 'ccache gcc'. A missing compiler leaves +# CC_NO_CLANG at 1, as if the probe had failed. +CC_NO_CLANG :=3D $(shell if command -v $(firstword $(CC)) >/dev/null 2>&1;= then $(CC) -dM -E -x c /dev/null; fi | grep -Fq "__clang__"; echo $$?) =20 # Some tools require bpftool SYSTEM_BPFTOOL ?=3D bpftool --=20 2.55.0 From nobody Tue Sep 29 06:52:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F46637DEA1; Tue, 11 Aug 2026 18:29:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472961; cv=none; b=Ul+Xo0HVQx3gEIfRFJsZbb/ZwOHbG8ffAPnDWZi6CdXj4J9CygNjejfTsU2iK3qXNJvbyVQrvsd1YKVEGX9rKGJJKxCHqFgDrx/4GFLpIgHIl5DDKraEh/A/5KMjCJug1ve85Pjn4LsZ3K0qjM3ukUl7264c+RTdkd7fktPQgHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472961; c=relaxed/simple; bh=cVztOs2uMIratdU9wIDk+3gEJqvY66z10g704Q5TGp0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P0S5V7Gz0WFJJStpE53a+aUVA+tQi+qMVLn49m9yHxiH6+JBCkDb6d9uC9HZRBjegbZRvmQrA1+ULRH0JtmRBybFq/HdB8oP8lrf+i+xAUd6IWHhGaqR2vohIygyEo6DesQa0eV9NcGeMiGY239j83YNW72L7my8dOS/Y2KrgY0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UPN8eHBR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UPN8eHBR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F9E01F000E9; Tue, 11 Aug 2026 18:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786472959; bh=iy4HTc6c4mJ99MFrZeUThnyT7uVU0GQ8QkuNGFhEfGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UPN8eHBRivv7b4OBPXBGp7HKLUGdCRLXJeQPzcm/TG6AlxgCL50nQUdUc9rGOya3l +G6Scij2QfZEqFfdMnR6Xd9Uzojfi9tPcAm0/MEYIoXeOoAxhIKeVKA+m4wFzTtmzY d9qnJZzDRqy9jdIOM95jbhTy9Ux3tSE2N4D66RZfUkd4pfBmn1zQ5Nez1a7l3lduf3 GXLKyK/jLe6NaAB46Y9AVRQLarm+/lY3tRTqlEyGTvTx2vwE8HX4eiPnMpAusfRH8D V7yACWr/izVbF41DyBKCxoO3Fft6QJAft+b59yquKecPa/zJHnDG2y7iAiCrrN0V9O ysxKpTMR+hB0Q== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , James Clark , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 2/7] perf build: Add install-build-deps framework to install devel packages Date: Tue, 11 Aug 2026 15:28:55 -0300 Message-ID: <20260811182900.27063-3-acme@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260811182900.27063-1-acme@kernel.org> References: <20260811182900.27063-1-acme@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnaldo 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 --- tools/perf/Makefile.perf | 20 ++- tools/perf/scripts/install-build-deps.sh | 173 +++++++++++++++++++++++ 2 files changed, 190 insertions(+), 3 deletions(-) create mode 100755 tools/perf/scripts/install-build-deps.sh diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index acc6309a84a1eeb1..49a58d714e42dded 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -177,7 +177,7 @@ LD +=3D $(EXTRA_LDFLAGS) # Some distros provide the command $(CROSS_COMPILE)pkg-config for # searching packges installed with Multiarch. Use it for cross # compilation if it is existed. -ifneq (, $(shell which $(CROSS_COMPILE)pkg-config)) +ifneq (, $(shell command -v $(CROSS_COMPILE)pkg-config 2>/dev/null)) PKG_CONFIG ?=3D $(CROSS_COMPILE)pkg-config else PKG_CONFIG ?=3D pkg-config @@ -214,7 +214,12 @@ AWK =3D awk # non-config cases config :=3D 1 =20 -NON_CONFIG_TARGETS :=3D clean python-clean TAGS tags cscope help +# install-build-deps runs the install-build-deps.sh script, which +# derives the package list from the feature test sources in +# tools/build/feature/, so it needs neither the fixdep build nor a +# config/feature detection pass: in a fresh container without gcc or +# pkg-config those would fail before the script could install them. +NON_CONFIG_TARGETS :=3D clean python-clean TAGS tags cscope help install-b= uild-deps =20 ifdef MAKECMDGOALS ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) @@ -748,6 +753,7 @@ help: @echo ' HINT: use "prefix" or "DESTDIR" to install to a particular' @echo ' path like "make prefix=3D/usr/local install install-doc"' @echo ' install - install compiled binaries' + @echo ' install-build-deps - install the development packages needed to = build' @echo ' install-doc - install *all* documentation' @echo ' install-man - install manpage documentation' @echo ' install-html - install html documentation' @@ -892,6 +898,14 @@ install-bin: install-tools install-tests =20 install: install-bin try-install-man =20 +# Install the development packages needed to build perf, derived from the +# feature tests in tools/build/feature/. This first installs just the +# base toolchain; per-distro package mappings are added by the follow-up +# commits. INSTALL_BUILD_DEPS_ARGS, when set, is passed to the script, so +# extra options like --list, --dry-run or --distro can be given from make. +install-build-deps: + $(Q)$(SHELL) $(srctree)/tools/perf/scripts/install-build-deps.sh $(INSTAL= L_BUILD_DEPS_ARGS) + install-python_ext: $(PYTHON_WORD) util/setup.py $(python_setup_quiet) install --root=3D'/$(D= ESTDIR_SQ)' =20 @@ -960,7 +974,7 @@ endif =20 FORCE: =20 -.PHONY: all install clean config-clean strip install-gtk +.PHONY: all install install-build-deps clean config-clean strip install-gtk .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_sh= ell .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare bpf-skel-p= repare .PHONY: python_perf_target diff --git a/tools/perf/scripts/install-build-deps.sh b/tools/perf/scripts/= install-build-deps.sh new file mode 100755 index 0000000000000000..351fdd581e56dd7c --- /dev/null +++ b/tools/perf/scripts/install-build-deps.sh @@ -0,0 +1,173 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# No 'set -e': the script uses explicit checks for its error paths, and +# is also run via '$(SHELL) .../install-build-deps.sh' from the make +# target in tools/perf/Makefile.perf, where a shebang option would be +# ignored anyway, so direct and make-driven runs behave the same. +# +# Install the development packages needed to build tools/perf. +# +# The package set is derived from the feature tests in tools/build/feature= /: +# each feature test that perf may compile is mapped to the devel package +# that provides the headers/libraries it checks, so that a subsequent +# 'make -C tools/perf' build enables the corresponding perf features. +# +# This initial version installs the base toolchain needed by any build; +# the per-feature package mapping is added, per supported distro, by the +# follow-up patches in this series, which also validate each mapping in a +# fresh container, so the host system is not modified. +# +# Usage: install-build-deps.sh [OPTIONS] +# +# Options: +# --list list the packages that would be installed, then exit +# --dry-run show the install command that would be run, without +# running it +# --distro ID force a distro: fedora, ubuntu (default: auto-detect) +# -h, --help print this help message +# +# Requires root (or passwordless sudo) to actually install packages. + +set -u + +DISTRO=3D"" + +help() { + cat </dev/null && echo "${ID:-}" ) + case "$id" in + fedora) echo "fedora" ;; + ubuntu) echo "ubuntu" ;; + # RHEL and its derivatives share most Fedora package names, but the + # mapping is only validated on Fedora, so don't auto-detect them. + rhel|centos|rocky|alma|ol) echo "" ;; + *) echo "" ;; + esac +} + +# Base packages needed by any perf build, regardless of feature tests: +# compiler, libc headers, flex/bison for the parser, kernel headers +# for UAPI headers with no in-tree copy, e.g. , and +# gcc-c++ (dnf) / g++ (apt) for the C++-based feature tests +# (cxa-demangle, llvm, llvm-perf), compiled with $(CXX), and +# pulls in libstdc++-devel / libstdc++-*-dev. +# python3-setuptools is needed to build the python binding (perf's +# util/setup.py uses it; without it binding is skipped with a warning). +# rust is not a header-based feature test: test-rust.bin just checks +# "$(RUSTC) --version" (tools/build/feature/Makefile), so it is mapped +# here like the other toolchain packages. +fedora_base_pkgs=3D"gcc gcc-c++ make flex bison glibc-devel kernel-headers= python3-setuptools rust" +debian_base_pkgs=3D"gcc g++ make flex bison libc6-dev linux-libc-dev pytho= n3-setuptools rustc" + +# --------------------------------------------------------------------- +# Assemble the unique package list. While the per-feature mapping is +# being added per distro, only the base toolchain above is installed. +# --------------------------------------------------------------------- +package_set() { + local distro=3D"$1" srcdir=3D"$2" + case "$distro" in + fedora) echo "$fedora_base_pkgs" ;; + ubuntu) echo "$debian_base_pkgs" ;; + esac +} + +# --------------------------------------------------------------------- +# The install command proper for each supported package manager, plus +# the command massaged for --dry-run. +# --------------------------------------------------------------------- +install_cmd() { + local distro=3D"$1"; shift + case "$distro" in + fedora) + echo "dnf install -y $*" + ;; + ubuntu) + # a fresh container has no package index, so update first. + echo "apt-get update && apt-get install -y $*" + ;; + esac +} + +main() { + local action=3D"install" + local srcdir distro pkgs cmd + + while [ $# -gt 0 ]; do + case "$1" in + --list) action=3D"list"; shift ;; + --dry-run) action=3D"dry-run"; shift ;; + --distro) + [ $# -ge 2 ] || { + echo "error: --distro requires an argument (fedora, rhel, ubuntu, debi= an)" >&2 + exit 1 + } + DISTRO=3D"$2"; shift 2 ;; + -h|--help) help ;; + *) echo "error: unknown argument: $1" >&2; exit 1 ;; + esac + done + + srcdir=3D$(cd "$(dirname "$0")/../../.." && pwd) + distro=3D$(detect_distro) + case "$distro" in + fedora|ubuntu) ;; + *) + echo "error: unsupported distro (got '$distro'); the package mapping is = not validated on other distros." >&2 + exit 1 + ;; + esac + + pkgs=3D$(package_set "$distro" "$srcdir") + + case "$action" in + list) + echo "$pkgs" | tr ' ' '\n' | grep -v '^$' | sort + exit 0 + ;; + dry-run) + install_cmd "$distro" $pkgs + exit 0 + ;; + esac + + echo "The following packages will be installed to enable perf features:" + echo "$pkgs" | tr ' ' '\n' | grep -v '^$' | sort | sed 's/^/ /' + echo + cmd=3D$(install_cmd "$distro" $pkgs) + if [ "$(id -u)" -eq 0 ]; then + sh -c "$cmd" + else + sudo sh -c "$cmd" + fi || { + echo "error: the install command failed, see the output above" >&2 + exit 1 + } +} + +main "$@" \ No newline at end of file --=20 2.55.0 From nobody Tue Sep 29 06:52:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 492DE3803CF; Tue, 11 Aug 2026 18:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472965; cv=none; b=Hw8rP61uQgCiV6tZsDRJ7lhddmlLHvOBfUueXVWrh2uNRVLWWogXqw+b8GGHUFVfsrJnVDDEH5WXgxJbBF3Azsx/ZpTNUi3gqNmPlkHbZp3gGpc4et7etTkk9OC6w1JiNwtLbshQrKObsi73pSLxZXyJGGnNzwoHHhQsNBJfVCI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472965; c=relaxed/simple; bh=55XaTrcAu1mpsGRtiSf97/xE1HjoREOJnXix49nn7u0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RcfRORiLgpV5aTfk3+1OaovqqQKNK/p6Ypes2R3pqX8JwOUBfrgCxLVUOGFwSk4z8q0Egwy+FKZwJGgW7BGTfD3ttkqy9K8Kq5KnEplMI1rmgg+WB4T5HugTCuwtgyaY8r7D1Hm0MtrFDO0y/87stzdr2n0zVvRanau/Pcqzd8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EJzS2vdp; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EJzS2vdp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 725161F00A3A; Tue, 11 Aug 2026 18:29:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786472963; bh=CNmWVX0bOGHZotLTEe8gHGDsgxCDhUi5b9NHsQhbh44=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EJzS2vdp2QzCHUVNqlWjip7EIeYApsFTage6WMLI07Xl4PBpKw/diF2V8vGEPdjy5 uU2x97WFs0l2qTgCiKLfSQJaBynqhltcSQneoUldPltk7opg7YfUi9cOogF/efFAB0 Nmk+B/S4eZP34g9Q3CZJMDpRr+NEVdwAx7ysvCWiJGg3RzPWRXH397gfGYYufBkkt0 FOlmmmXLwJ0CBprNnHYRlsynhEUf0fZ8CPz5W0RcpEzec2AYnTwstGmv2knObIcHh8 JpcYlJ8Woj7n3QVJq/STkPIdpxwNoinCGX3R1iHIaSn+VuIJ4GCubF7pTWscCxEUof nTiKPhZim40Uw== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , James Clark , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 3/7] perf build: install-build-deps: add Fedora devel package mapping Date: Tue, 11 Aug 2026 15:28:56 -0300 Message-ID: <20260811182900.27063-4-acme@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260811182900.27063-1-acme@kernel.org> References: <20260811182900.27063-1-acme@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnaldo 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 , 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=3D 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=3D"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 --- tools/perf/scripts/install-build-deps.sh | 179 ++++++++++++++++++++--- 1 file changed, 156 insertions(+), 23 deletions(-) diff --git a/tools/perf/scripts/install-build-deps.sh b/tools/perf/scripts/= install-build-deps.sh index 351fdd581e56dd7c..a0ec73cb4fcdffbd 100755 --- a/tools/perf/scripts/install-build-deps.sh +++ b/tools/perf/scripts/install-build-deps.sh @@ -13,10 +13,13 @@ # that provides the headers/libraries it checks, so that a subsequent # 'make -C tools/perf' build enables the corresponding perf features. # -# This initial version installs the base toolchain needed by any build; -# the per-feature package mapping is added, per supported distro, by the -# follow-up patches in this series, which also validate each mapping in a -# fresh container, so the host system is not modified. +# Supported distros, each mapping validated in a fresh container, so the +# host system is not modified: +# +# - Fedora, on dnf, validated on Fedora 44, in a toolbx container: +# +# toolbox create fedora:44 +# toolbox enter fedora:44 # # Usage: install-build-deps.sh [OPTIONS] # @@ -24,7 +27,7 @@ # --list list the packages that would be installed, then exit # --dry-run show the install command that would be run, without # running it -# --distro ID force a distro: fedora, ubuntu (default: auto-detect) +# --distro ID force a distro: fedora (default: auto-detect) # -h, --help print this help message # # Requires root (or passwordless sudo) to actually install packages. @@ -39,20 +42,121 @@ Usage: $(basename "$0") [--list] [--dry-run] [--distro= ID] [-h|--help] =20 Install the development packages needed to build tools/perf. =20 +The package set is derived from the feature tests in tools/build/feature/, +mapping each one with an external dependency to the devel package providing +it, so the corresponding feature gets enabled on a build. + Options: --list list the packages that would be installed, then exit --dry-run show the install command that would be run, without runnin= g it - --distro ID force a distro: fedora, ubuntu + --distro ID force a distro: fedora -h, --help print this help message + +Distro supported: Fedora (dnf), validated on a fresh Fedora 44 toolbx +container. EOF exit 0 } =20 # --------------------------------------------------------------------- -# Distro detection. The install command that follows only differs in -# the package manager, which here is keyed off the distro ID; the -# per-feature package mapping is added per distro by the follow-up -# patches. +# Return the Fedora package(s) providing the devel requirements of a +# feature test in tools/build/feature/. Multiple packages are separated +# by spaces; an empty result means the test has no external devel +# dependency (pure toolchain/glibc, or no equivalent Fedora package). +# +# The mapping was built by checking, for each feature test, which Fedora +# devel package provides the headers the test compiles against. +# --------------------------------------------------------------------- +fedora_pkg_for() { + local feat=3D"$1" + case "$feat" in + libelf|libelf-getphdrnum|libelf-gelf_getnote|libelf-getshdrstrndx) + echo "elfutils-libelf-devel" + ;; + libelf-zstd) + echo "elfutils-libelf-devel libzstd-devel" + ;; + libdw) + echo "elfutils-devel" + ;; + # test-libdebuginfod.c includes , which is + # provided by elfutils-debuginfod-client-devel, not elfutils-devel. + libdebuginfod) + echo "elfutils-debuginfod-client-devel" + ;; + libnuma|numa_num_possible_cpus) + echo "numactl-devel" + ;; + libzstd) + echo "libzstd-devel" + ;; + zlib) + echo "zlib-devel" + ;; + lzma) + echo "xz-devel" + ;; + libslang) + echo "slang-devel" + ;; + libcapstone) + echo "capstone-devel" + ;; + libpython) + echo "python3-devel" + ;; + libtraceevent) + echo "libtraceevent-devel" + ;; + cxa-demangle) + echo "libstdc++-devel" + ;; + libbpf) + echo "libbpf-devel" + ;; + babeltrace2-ctf-writer) + echo "libbabeltrace2-devel" + ;; + libopenssl) + echo "openssl-devel" + ;; + libpfm4) + echo "libpfm-devel" + ;; + sdt) + echo "systemtap-sdt-devel" + ;; + clang-bpf-co-re) + echo "clang-devel" + ;; + llvm|llvm-perf) + echo "llvm-devel" + ;; + jvmti|jvmti-cmlr) + echo "java-latest-openjdk-devel" + ;; + esac + # Pure toolchain/libc features (backtrace, eventfd, fortify-source, + # gettid, glibc, hello, reallocarray, pthread-*, stackprotector-all, + # timerfd, scandirat, sched_getcpu, setns, file-handle, + # bionic...) need no external package: their + # requirements are covered by the base packages below. Features that + # perf's own build does not check (libcap, libcheck, libcpupower, + # libtracefs, whose feature tests exist for rtla/bpftool/rv) and the + # opt-in features, which a default build does not enable: the libbfd + # disassembler family (libbfd, libbfd-threadsafe, libbfd-liberty, + # disassembler-*, cplus-demangle), only linked on BUILD_NONDISTRO + # builds and deprecated in favor of capstone, GTK2, LIBPERL and + # LIBUNWIND support (ifdef GTK2 / ifdef LIBPERL / LIBUNWIND=3D1), + # and CoreSight (ifdef CORESIGHT), are deliberately not mapped. + # libaio is not mapped either: its + # test uses the POSIX AIO API (aio.h, aio_*, -lrt), provided by + # glibc headers (pulled in by the glibc-devel base package), not + # the native libaio.h/io_submit API that libaio-devel provides. +} + +# --------------------------------------------------------------------- +# Distro detection # --------------------------------------------------------------------- detect_distro() { if [ -n "$DISTRO" ]; then @@ -71,30 +175,58 @@ detect_distro() { esac } =20 -# Base packages needed by any perf build, regardless of feature tests: +# --------------------------------------------------------------------- +# Feature test enumeration: mirror of the tests checked during a build, +# from the actual test-*.c / test-*.cpp sources in tools/build/feature/. +# --------------------------------------------------------------------- +feature_tests() { + local srcdir=3D"$1" + local f + for f in "$srcdir"/tools/build/feature/test-*.c "$srcdir"/tools/build/fea= ture/test-*.cpp; do + [ -e "$f" ] || continue + basename "$f" | sed -e 's/^test-//' -e 's/\.c$//' -e 's/\.cpp$//' + done +} + +# Base packages needed by any build, regardless of feature tests: # compiler, libc headers, flex/bison for the parser, kernel headers # for UAPI headers with no in-tree copy, e.g. , and -# gcc-c++ (dnf) / g++ (apt) for the C++-based feature tests -# (cxa-demangle, llvm, llvm-perf), compiled with $(CXX), and -# pulls in libstdc++-devel / libstdc++-*-dev. -# python3-setuptools is needed to build the python binding (perf's -# util/setup.py uses it; without it binding is skipped with a warning). -# rust is not a header-based feature test: test-rust.bin just checks -# "$(RUSTC) --version" (tools/build/feature/Makefile), so it is mapped -# here like the other toolchain packages. +# gcc-c++ is needed by the C++-based feature tests (cxa-demangle, llvm, +# llvm-perf), which are compiled with $(CXX), pulling in +# libstdc++-devel. python3-setuptools is needed to build the python +# (perf's util/setup.py uses it); rust is checked by the rust feature +# test (test-rust.bin just runs "$(RUSTC) --version"). + fedora_base_pkgs=3D"gcc gcc-c++ make flex bison glibc-devel kernel-headers= python3-setuptools rust" debian_base_pkgs=3D"gcc g++ make flex bison libc6-dev linux-libc-dev pytho= n3-setuptools rustc" =20 # --------------------------------------------------------------------- -# Assemble the unique package list. While the per-feature mapping is -# being added per distro, only the base toolchain above is installed. +# Assemble the unique package list: the base toolchain plus, for each +# feature test the distro's package mapping knows about, its package(s). +# Installing an already-present package is a no-op for both dnf and +# apt-get, making this idempotent. # --------------------------------------------------------------------- package_set() { local distro=3D"$1" srcdir=3D"$2" + local feat pkg pkgs + case "$distro" in - fedora) echo "$fedora_base_pkgs" ;; - ubuntu) echo "$debian_base_pkgs" ;; + fedora) pkgs=3D"$fedora_base_pkgs" ;; + ubuntu) pkgs=3D"$debian_base_pkgs" ;; esac + + if [ "$distro" =3D "fedora" ]; then + for feat in $(feature_tests "$srcdir"); do + pkg=3D$(fedora_pkg_for "$feat") + for pkg in $pkg; do + case " $pkgs " in + *" $pkg "*) ;; + *) pkgs=3D"$pkgs $pkg" ;; + esac + done + done + fi + echo "$pkgs" } =20 # --------------------------------------------------------------------- @@ -139,6 +271,7 @@ main() { fedora|ubuntu) ;; *) echo "error: unsupported distro (got '$distro'); the package mapping is = not validated on other distros." >&2 + echo "Supported and validated: Fedora 44 (fresh toolbx container)." >&2 exit 1 ;; esac --=20 2.55.0 From nobody Tue Sep 29 06:52:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C58A36E48C; Tue, 11 Aug 2026 18:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472970; cv=none; b=mYxvFrPHaEGVYkDVInrUm3C4QhU5lyvIB1Yh4EdhxuX+a1KgSeTaAz8qk+khzWK+HcOrM6fnnCPfiBOqaKwxf9akvBsz9N0dWx1xyHRwog/x4LlzCzRBmCHLabijXXLx3443NcONTtvWuCvHcYo7Knw2tx9W93XzBzT/zLxNkcQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472970; c=relaxed/simple; bh=Z/rgjHX760s3BWyFDPO7f0BZDudQCF/Jgd1mp7zREaE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JlWKTCyapCgCmaLWYmsfWH2nR3KnBx07hpKNsDR7RxmF9nQbMevq5NEGwPGzBvQ3evzdCsPGoHkaqPBd9vKU2mVwJNtPhjmA1wfD+a6usWzu0vrfoEChPLaB0if7/tdmxbJuyNUA8m7Phd9FGSrK9g1gH900ofoBf1QSzKS2T9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a2/Oh23g; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a2/Oh23g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8632D1F000E9; Tue, 11 Aug 2026 18:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786472967; bh=ZkGopUKhD8a1onAG01CU+7dlOEBON8rJ7P89kx9zNV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a2/Oh23gmzg/8S8qhR9zro36zIOyiy30ZhQyETQ6bTzB2Rmpi3E/E7LSkIrj+xOUn 1mpkcTkF4G43Zp/4JTzlCZlCsU2ep0IXr8vhs1QpFGZz9qIUICykdRmHnw+AsK68mN lTH2RET7UOoMcO7WG1NEGoKiGqKUA++JyM8ufSGYR9NCTD1UyGEL4hKN83KPwWlXXD TmhayYvVgjqK3zhJl80VrkFz1sm2MWAMWJg/2tp9fH99MQbNamWzSthRbW/oeErX4F JEyUGq3j6mrMSIJ1HC8ZVwLr339BPDIF4C5AB/p+c9BFcqcuH81ITz+g8qmEssTZTH QdcAi+rwiAg2w== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , James Clark , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 4/7] perf build: install-build-deps: add Ubuntu devel package mapping Date: Tue, 11 Aug 2026 15:28:57 -0300 Message-ID: <20260811182900.27063-5-acme@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260811182900.27063-1-acme@kernel.org> References: <20260811182900.27063-1-acme@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnaldo 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=3D 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=3D"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 --- tools/perf/Makefile.perf | 6 +- tools/perf/scripts/install-build-deps.sh | 196 ++++++++++++++++++----- 2 files changed, 161 insertions(+), 41 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 49a58d714e42dded..e1fc75b4621faed5 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -899,9 +899,9 @@ install-bin: install-tools install-tests install: install-bin try-install-man =20 # Install the development packages needed to build perf, derived from the -# feature tests in tools/build/feature/. This first installs just the -# base toolchain; per-distro package mappings are added by the follow-up -# commits. INSTALL_BUILD_DEPS_ARGS, when set, is passed to the script, so +# feature tests in tools/build/feature/. Currently supported: the Fedora +# (dnf) and Ubuntu (apt) package mappings, see the script. +# INSTALL_BUILD_DEPS_ARGS, when set, is passed to the script, so # extra options like --list, --dry-run or --distro can be given from make. install-build-deps: $(Q)$(SHELL) $(srctree)/tools/perf/scripts/install-build-deps.sh $(INSTAL= L_BUILD_DEPS_ARGS) diff --git a/tools/perf/scripts/install-build-deps.sh b/tools/perf/scripts/= install-build-deps.sh index a0ec73cb4fcdffbd..5e30cfd1e091322e 100755 --- a/tools/perf/scripts/install-build-deps.sh +++ b/tools/perf/scripts/install-build-deps.sh @@ -13,21 +13,38 @@ # that provides the headers/libraries it checks, so that a subsequent # 'make -C tools/perf' build enables the corresponding perf features. # -# Supported distros, each mapping validated in a fresh container, so the -# host system is not modified: +# Currently supported distros, each validated in a fresh container: # # - Fedora, on dnf, validated on Fedora 44, in a toolbx container: # # toolbox create fedora:44 # toolbox enter fedora:44 # +# - Ubuntu, on apt-get, validated on Ubuntu 26.04, in a distrobox +# container: +# +# distrobox create --image ubuntu:26.04 +# distrobox enter ubuntu-26-04 +# +# The apt-get install runs with a noninteractive debconf frontend: +# default-jdk, needed by the jvmti feature tests, pulls in tzdata, +# which prompts for the timezone on a terminal and would block the +# install, e.g. in a container shared with an interactive session. +# +# Running inside a container keeps the host system unmodified. +# +# Debian, which shares the Ubuntu package mapping, is the next planned +# distro to be enabled once that mapping is validated on a Debian +# release (trixie), as is RHEL support, once its (largely similar to +# Fedora) package mapping is validated there. +# # Usage: install-build-deps.sh [OPTIONS] # # Options: # --list list the packages that would be installed, then exit # --dry-run show the install command that would be run, without # running it -# --distro ID force a distro: fedora (default: auto-detect) +# --distro ID force a distro: fedora, ubuntu (default: auto-detect) # -h, --help print this help message # # Requires root (or passwordless sudo) to actually install packages. @@ -49,11 +66,12 @@ it, so the corresponding feature gets enabled on a buil= d. Options: --list list the packages that would be installed, then exit --dry-run show the install command that would be run, without runnin= g it - --distro ID force a distro: fedora + --distro ID force a distro: fedora, ubuntu -h, --help print this help message =20 -Distro supported: Fedora (dnf), validated on a fresh Fedora 44 toolbx -container. +Distros supported: Fedora (dnf), validated in a toolbx container on +Fedora 44, and Ubuntu (apt-get), validated in a distrobox container on +Ubuntu 26.04. EOF exit 0 } @@ -151,10 +169,110 @@ fedora_pkg_for() { # and CoreSight (ifdef CORESIGHT), are deliberately not mapped. # libaio is not mapped either: its # test uses the POSIX AIO API (aio.h, aio_*, -lrt), provided by - # glibc headers (pulled in by the glibc-devel base package), not - # the native libaio.h/io_submit API that libaio-devel provides. + # glibc headers (pulled in by the libc headers package) in the + # base set, not the native libaio.h/io_submit API that + # libaio-devel provides. +} + +# --------------------------------------------------------------------- +# Return the Debian/Ubuntu package(s) providing the devel requirements +# of a feature test in tools/build/feature/. This mapping is shared by +# Debian and Ubuntu, whose package names for these devel packages match, +# and is validated on Ubuntu 26.04; Debian (trixie) will be enabled +# once the same mapping is validated on it. +# --------------------------------------------------------------------- +debian_pkg_for() { + local feat=3D"$1" + case "$feat" in + libelf|libelf-getphdrnum|libelf-gelf_getnote|libelf-getshdrstrndx) + echo "libelf-dev" + ;; + libelf-zstd) + echo "libelf-dev libzstd-dev" + ;; + libdw) + echo "libdw-dev" + ;; + libdebuginfod) + echo "libdebuginfod-dev" + ;; + libnuma|numa_num_possible_cpus) + echo "libnuma-dev" + ;; + libzstd) + echo "libzstd-dev" + ;; + zlib) + echo "zlib1g-dev" + ;; + lzma) + echo "liblzma-dev" + ;; + libslang) + echo "libslang2-dev" + ;; + libcapstone) + echo "libcapstone-dev" + ;; + libpython) + echo "python3-dev" + ;; + libtraceevent) + echo "libtraceevent-dev" + ;; + # The cxa-demangle feature test links against libstdc++ builtin + # demangling, so on Debian-derived distros it is covered by the + # g++ base package below, which pulls in libstdc++-*-dev. + cxa-demangle) + ;; + libbpf) + echo "libbpf-dev" + ;; + babeltrace2-ctf-writer) + echo "libbabeltrace2-dev" + ;; + libopenssl) + echo "libssl-dev" + ;; + libpfm4) + echo "libpfm4-dev" + ;; + sdt) + echo "systemtap-sdt-dev" + ;; + # test-clang-bpf-co-re.c invokes the clang binary (not libclang-cpp), + # so clang suffices; llvm-dev brings llvm-config, needed by the + # llvm/llvm-perf tests below. + clang-bpf-co-re) + echo "clang llvm-dev" + ;; + llvm|llvm-perf) + echo "llvm-dev" + ;; + jvmti|jvmti-cmlr) + echo "default-jdk" + ;; + esac + # Same rationale as in fedora_pkg_for() above for unmapped tests. } =20 +# Base packages needed by any perf build, regardless of feature tests: +# compiler, libc headers, flex/bison for the parser, kernel headers +# for UAPI headers with no in-tree copy, e.g. , and +# gcc-c++ (dnf) / g++ (apt) is needed by the C++-based feature tests +# (cxa-demangle, llvm, llvm-perf), compiled with $(CXX), and +# pulls in libstdc++-devel / libstdc++-*-dev. +# python3-setuptools is needed to build the python binding (perf's +# util/setup.py uses it; without it binding is skipped with a warning). +# rust is not a header-based feature test: test-rust.bin just checks +# "$(RUSTC) --version" (tools/build/feature/Makefile), so it is mapped +# here like the other toolchain packages. +fedora_base_pkgs=3D"gcc gcc-c++ make flex bison glibc-devel kernel-headers= python3-setuptools rust" +# pkg-config mirrors the pkgconf-pkg-config package that Fedora +# installs by default, needed by the babeltrace2 feature test and +# libopenssl's pkg-config checks. +debian_base_pkgs=3D"gcc g++ make pkg-config flex bison libc6-dev linux-lib= c-dev python3-setuptools rustc" + # --------------------------------------------------------------------- # Distro detection # --------------------------------------------------------------------- @@ -168,6 +286,9 @@ detect_distro() { case "$id" in fedora) echo "fedora" ;; ubuntu) echo "ubuntu" ;; + # Debian shares the Ubuntu package mapping, but it is only validated + # on Ubuntu so far, so don't auto-detect it yet. + debian) echo "" ;; # RHEL and its derivatives share most Fedora package names, but the # mapping is only validated on Fedora, so don't auto-detect them. rhel|centos|rocky|alma|ol) echo "" ;; @@ -188,44 +309,34 @@ feature_tests() { done } =20 -# Base packages needed by any build, regardless of feature tests: -# compiler, libc headers, flex/bison for the parser, kernel headers -# for UAPI headers with no in-tree copy, e.g. , and -# gcc-c++ is needed by the C++-based feature tests (cxa-demangle, llvm, -# llvm-perf), which are compiled with $(CXX), pulling in -# libstdc++-devel. python3-setuptools is needed to build the python -# (perf's util/setup.py uses it); rust is checked by the rust feature -# test (test-rust.bin just runs "$(RUSTC) --version"). - -fedora_base_pkgs=3D"gcc gcc-c++ make flex bison glibc-devel kernel-headers= python3-setuptools rust" -debian_base_pkgs=3D"gcc g++ make flex bison libc6-dev linux-libc-dev pytho= n3-setuptools rustc" - # --------------------------------------------------------------------- -# Assemble the unique package list: the base toolchain plus, for each -# feature test the distro's package mapping knows about, its package(s). -# Installing an already-present package is a no-op for both dnf and -# apt-get, making this idempotent. +# Assemble the unique package list. Since the full feature set is mapped +# unconditionally, this installs the complete devel environment; installing +# an already-present package is a no-op for both dnf and apt-get, making +# this idempotent. # --------------------------------------------------------------------- package_set() { local distro=3D"$1" srcdir=3D"$2" local feat pkg pkgs - case "$distro" in fedora) pkgs=3D"$fedora_base_pkgs" ;; ubuntu) pkgs=3D"$debian_base_pkgs" ;; esac =20 - if [ "$distro" =3D "fedora" ]; then - for feat in $(feature_tests "$srcdir"); do + for feat in $(feature_tests "$srcdir"); do + if [ "$distro" =3D "fedora" ]; then pkg=3D$(fedora_pkg_for "$feat") - for pkg in $pkg; do - case " $pkgs " in - *" $pkg "*) ;; - *) pkgs=3D"$pkgs $pkg" ;; - esac - done + else + pkg=3D$(debian_pkg_for "$feat") + fi + [ -n "$pkg" ] || continue + for pkg in $pkg; do + case " $pkgs " in + *" $pkg "*) ;; + *) pkgs=3D"$pkgs $pkg" ;; + esac done - fi + done echo "$pkgs" } =20 @@ -240,14 +351,23 @@ install_cmd() { echo "dnf install -y $*" ;; ubuntu) - # a fresh container has no package index, so update first. - echo "apt-get update && apt-get install -y $*" + # a fresh container has no package index, so update first; run + # with a noninteractive debconf frontend: default-jdk, used by + # the jvmti feature tests, pulls in tzdata, which prompts for + # the timezone on a terminal and would block the install. The + # env var prefix works with the 'sh -c' invocation below, and + # shows up in --dry-run. + echo "DEBIAN_FRONTEND=3Dnoninteractive apt-get update && DEBIAN_FRONTEND= =3Dnoninteractive apt-get install -y $*" ;; esac } =20 main() { local action=3D"install" + # Package accumulation happens in package_set(), which, together + # with the *_pkg_for() helpers, declares the per-feature 'pkg' + # locals; main() holds no per-feature package state, just the + # distro-wide list assembled by package_set(). local srcdir distro pkgs cmd =20 while [ $# -gt 0 ]; do @@ -271,7 +391,7 @@ main() { fedora|ubuntu) ;; *) echo "error: unsupported distro (got '$distro'); the package mapping is = not validated on other distros." >&2 - echo "Supported and validated: Fedora 44 (fresh toolbx container)." >&2 + echo "Supported and validated: Fedora 44 (toolbx container), Ubuntu 26.0= 4 (distrobox container)." >&2 exit 1 ;; esac @@ -303,4 +423,4 @@ main() { } } =20 -main "$@" \ No newline at end of file +main "$@" --=20 2.55.0 From nobody Tue Sep 29 06:52:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DE3637DE87; Tue, 11 Aug 2026 18:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472973; cv=none; b=mHhnb+hDJvYYezWadzizkKdSeBGS6nCMZMI139g9LlRKLwWgwlDT/l/gmx5VvuT48B/h22c8yTM+umQ6l/O81KLssTlh0xw0Kvv5HUG5WbpKNO91JIR315EqOffZZ6fVKnC9NeQooOD81kC3TdUoiwQPMONz9sG0WlcpH1l0Hrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472973; c=relaxed/simple; bh=hD+OuhlpzmGPuJIXpTqK+NbMd9+4YMrADBVa1j0AMow=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uA40KZnuI2h9GXm4acjCdi4qMEp2vJXVCoRcFDo1PIXf/FKwZ4dcB6xPrD9uwvlcDhSLYBl88nmaaKvqrBsT5TPE+6IBfpxCM4yIlo5btpK9+aTO5lFhii625JtTY0vR+uOEyiVal8XpnGiBsgDM414gcB29NW3PEyvYaJMS81Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SzmQgdP7; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SzmQgdP7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 773D81F00A3A; Tue, 11 Aug 2026 18:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786472971; bh=9RCyli6kZUq3esA7B9GQXR6YA789WXwWCs/mkWcXSmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SzmQgdP7tZ+x0ZaaAXJm1R1sgrtbt231S/U0uSxkDH7tkHAzwizICmD6KWT5Kn2kg m86E4i853t0eOnrdsQc8P+t7bVbMgHvOR7h4zMDES6fVrWd6LmOHU17CcaLj8QppDm J+wY1+T+5qCO7xD9jFfsegQpuoaknjdixzFM9aU4SkyuUWRYQHeMVcAd6Ux79hHioc SEiGeYzcCjcypT+ki2iVIi8oDccUmLLbWkAFHZOXknIfLr4F9fD+znG6N/1bOVNUze sgVdSX+45Xj6sH2SCfISiPVAlWL3dIIhbeSPeJyWjUK/IZ4t90JpZlmCfmgzO1Zfdv jdC2z329ev4Qg== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , James Clark , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 5/7] perf build: install-build-deps: add Debian devel package mapping Date: Tue, 11 Aug 2026 15:28:58 -0300 Message-ID: <20260811182900.27063-6-acme@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260811182900.27063-1-acme@kernel.org> References: <20260811182900.27063-1-acme@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnaldo 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=3D"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 --- tools/perf/Makefile.perf | 3 +- tools/perf/scripts/install-build-deps.sh | 37 +++++++++++++----------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index e1fc75b4621faed5..29cfd44c427f33ba 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -900,7 +900,8 @@ install: install-bin try-install-man =20 # Install the development packages needed to build perf, derived from the # feature tests in tools/build/feature/. Currently supported: the Fedora -# (dnf) and Ubuntu (apt) package mappings, see the script. +# (dnf), Ubuntu (apt) and Debian (apt, reusing the Ubuntu mapping) +# package mappings, see the script. # INSTALL_BUILD_DEPS_ARGS, when set, is passed to the script, so # extra options like --list, --dry-run or --distro can be given from make. install-build-deps: diff --git a/tools/perf/scripts/install-build-deps.sh b/tools/perf/scripts/= install-build-deps.sh index 5e30cfd1e091322e..aaaf315516f04d4b 100755 --- a/tools/perf/scripts/install-build-deps.sh +++ b/tools/perf/scripts/install-build-deps.sh @@ -31,12 +31,17 @@ # which prompts for the timezone on a terminal and would block the # install, e.g. in a container shared with an interactive session. # +# - Debian, on apt-get, reusing the Ubuntu mapping, validated on +# Debian 13 (trixie), in a distrobox container: +# +# distrobox create --image debian:trixie +# distrobox enter debian-trixie +# # Running inside a container keeps the host system unmodified. # -# Debian, which shares the Ubuntu package mapping, is the next planned -# distro to be enabled once that mapping is validated on a Debian -# release (trixie), as is RHEL support, once its (largely similar to -# Fedora) package mapping is validated there. +# RHEL support, whose package mapping is largely similar to Fedora's, +# is the next planned distro, to be enabled once that mapping is +# validated there. # # Usage: install-build-deps.sh [OPTIONS] # @@ -44,7 +49,7 @@ # --list list the packages that would be installed, then exit # --dry-run show the install command that would be run, without # running it -# --distro ID force a distro: fedora, ubuntu (default: auto-detect) +# --distro ID force a distro: fedora, ubuntu, debian (default: auto-de= tect) # -h, --help print this help message # # Requires root (or passwordless sudo) to actually install packages. @@ -66,12 +71,13 @@ it, so the corresponding feature gets enabled on a buil= d. Options: --list list the packages that would be installed, then exit --dry-run show the install command that would be run, without runnin= g it - --distro ID force a distro: fedora, ubuntu + --distro ID force a distro: fedora, ubuntu, debian -h, --help print this help message =20 Distros supported: Fedora (dnf), validated in a toolbx container on -Fedora 44, and Ubuntu (apt-get), validated in a distrobox container on -Ubuntu 26.04. +Fedora 44, Ubuntu (apt-get), validated in a distrobox container on +Ubuntu 26.04, and Debian (apt-get), reusing the Ubuntu mapping, +validated in a distrobox container on Debian 13 (trixie). EOF exit 0 } @@ -178,8 +184,7 @@ fedora_pkg_for() { # Return the Debian/Ubuntu package(s) providing the devel requirements # of a feature test in tools/build/feature/. This mapping is shared by # Debian and Ubuntu, whose package names for these devel packages match, -# and is validated on Ubuntu 26.04; Debian (trixie) will be enabled -# once the same mapping is validated on it. +# and is validated on Ubuntu 26.04 and Debian 13 (trixie). # --------------------------------------------------------------------- debian_pkg_for() { local feat=3D"$1" @@ -286,9 +291,7 @@ detect_distro() { case "$id" in fedora) echo "fedora" ;; ubuntu) echo "ubuntu" ;; - # Debian shares the Ubuntu package mapping, but it is only validated - # on Ubuntu so far, so don't auto-detect it yet. - debian) echo "" ;; + debian) echo "debian" ;; # RHEL and its derivatives share most Fedora package names, but the # mapping is only validated on Fedora, so don't auto-detect them. rhel|centos|rocky|alma|ol) echo "" ;; @@ -320,7 +323,7 @@ package_set() { local feat pkg pkgs case "$distro" in fedora) pkgs=3D"$fedora_base_pkgs" ;; - ubuntu) pkgs=3D"$debian_base_pkgs" ;; + ubuntu|debian) pkgs=3D"$debian_base_pkgs" ;; esac =20 for feat in $(feature_tests "$srcdir"); do @@ -350,7 +353,7 @@ install_cmd() { fedora) echo "dnf install -y $*" ;; - ubuntu) + ubuntu|debian) # a fresh container has no package index, so update first; run # with a noninteractive debconf frontend: default-jdk, used by # the jvmti feature tests, pulls in tzdata, which prompts for @@ -388,10 +391,10 @@ main() { srcdir=3D$(cd "$(dirname "$0")/../../.." && pwd) distro=3D$(detect_distro) case "$distro" in - fedora|ubuntu) ;; + fedora|ubuntu|debian) ;; *) echo "error: unsupported distro (got '$distro'); the package mapping is = not validated on other distros." >&2 - echo "Supported and validated: Fedora 44 (toolbx container), Ubuntu 26.0= 4 (distrobox container)." >&2 + echo "Supported and validated: Fedora 44 (toolbx container), Ubuntu 26.0= 4 and Debian 13 (distrobox containers)." >&2 exit 1 ;; esac --=20 2.55.0 From nobody Tue Sep 29 06:52:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AB8138552C; Tue, 11 Aug 2026 18:29:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472976; cv=none; b=ilVP52UPiy6BlWZ51bjm49MOTl3w3jQLhp07fHoi+6pH6ArLBpI0ucLs2Y7JW+jO1PrXowesr4Qz7RECSCuURRkjY+g4q+J6itHYgzo9m1ku6QdpBcUhjMY9kPsiwr5zKM/dXMk53goc6Cspv6TTQgCMBB0Iy80X/1yYEIJsWVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472976; c=relaxed/simple; bh=cLrSw0Uqu+iLNBe0d4lfA8dTZeOFNm1dbUQ/bp0FX9s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xck6p7rtFid5u9n8qcgiNATGNxIN6GrKFe5ybwrpGuSxxpMhVmPuMhAkiGSygXLNeumrfi7pDEqdLlTXS49+pewQNOuXtg8FA4lLop54EPi+3hsR/eELggfNE6Ejwc5EezlYTz5TB66Tm/BoQ3SuUNKEa6ktxuO44TVLR5NQAMI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q1Z1IGgV; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q1Z1IGgV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4217B1F000E9; Tue, 11 Aug 2026 18:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786472975; bh=stFdSUc44LqGWKljLA8vNKkppR5KV+uSshexvSqq3WA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Q1Z1IGgVaPJ75Myuuvr6xbk0VQ04OB23CRnlwsOpiOt2LM4IYuhQ2qpmZr2YHt53O SZecRmQg3vgDe1PijH7/40gAfx34dCdYsF5XAXs/3c24Ps7nLly7TsEEPlJYnezuIq 7rPtPUPO2b3HgOK46FZEyL1BV17JEts7MQ1Omcbu7PHNW8CG0YFST5tnKcg78dLzGH dPdQTo3EpTZ/LqLqwiumDW1S4TYur9/ZscW/KwfPHgkn7eVQ4AHVznaIrUPNqS3+sK xDuPW5u7Bn/OQ6HJxK14/Xv1Apmk5jx/fUN6TFML/TwmavZn6rOk1fCW87rONGPYMD Hsv/6uJ1rZpag== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , James Clark , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 6/7] perf build: Remove leftover feature tests for removed cxx and clang support Date: Tue, 11 Aug 2026 15:28:59 -0300 Message-ID: <20260811182900.27063-7-acme@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260811182900.27063-1-acme@kernel.org> References: <20260811182900.27063-1-acme@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnaldo Carvalho de Melo 56b11a2126bf2f42 ("perf bpf: Remove support for embedding clang for compiling BPF events (-e foo.c)") removed the test-cxx.cpp and test-clang.cpp sources, but left behind their entries in the feature test FILES list, the build rules and the cxx and clang entries in FEATURE_TESTS_EXTRA. Since the sources no longer exist, those rules would always fail, making the artificial feature-cxx and feature-clang results to be perpetually disabled/absent, remove the leftover entries, making the feature test scripts list match the available sources. Fixes: 56b11a2126bf2f42 ("perf bpf: Remove support for embedding clang for = compiling BPF events (-e foo.c)") Cc: Ian Rogers Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Arnaldo Carvalho de Melo --- tools/build/Makefile.feature | 2 -- tools/build/feature/Makefile | 14 -------------- 2 files changed, 16 deletions(-) diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index ed1374af31c16838..99eb0ea095375606 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -123,9 +123,7 @@ FEATURE_TESTS_EXTRA :=3D \ libbfd-liberty-z \ libopencsd \ libperl \ - cxx \ llvm \ - clang \ libbpf \ libpfm4 \ libdebuginfod \ diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 62909a9c799d3338..7d165018116a552f 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -55,7 +55,6 @@ FILES=3D \ test-bpf.bin \ test-libbpf.bin \ test-sdt.bin \ - test-cxx.bin \ test-gettid.bin \ test-jvmti.bin \ test-jvmti-cmlr.bin \ @@ -63,7 +62,6 @@ FILES=3D \ test-sched_getcpu.bin \ test-setns.bin \ test-libopencsd.bin \ - test-clang.bin \ test-llvm.bin \ test-llvm-perf.bin \ test-libaio.bin \ @@ -335,9 +333,6 @@ $(OUTPUT)test-libbpf.bin: $(OUTPUT)test-sdt.bin: $(BUILD) =20 -$(OUTPUT)test-cxx.bin: - $(BUILDXX) -std=3Dgnu++11 - $(OUTPUT)test-gettid.bin: $(BUILD) =20 @@ -363,15 +358,6 @@ $(OUTPUT)test-llvm-perf.bin: $(shell $(LLVM_CONFIG) --system-libs) \ > $(@:.bin=3D.make.output) 2>&1 =20 -$(OUTPUT)test-clang.bin: - $(BUILDXX) -std=3Dgnu++17 \ - -I$(shell $(LLVM_CONFIG) --includedir) \ - -L$(shell $(LLVM_CONFIG) --libdir) \ - -Wl,--start-group -lclang-cpp -Wl,--end-group \ - $(shell $(LLVM_CONFIG) --libs Core option) \ - $(shell $(LLVM_CONFIG) --system-libs) \ - > $(@:.bin=3D.make.output) 2>&1 - -include $(OUTPUT)*.d =20 $(OUTPUT)test-libaio.bin: --=20 2.55.0 From nobody Tue Sep 29 06:52:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95DF23876DE; Tue, 11 Aug 2026 18:29:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472981; cv=none; b=HIkcUz3FrvU05EiqBIRabVn0+dQ0aWzcfR3aMMde+w2w1wR8cI0unozU0cpuj0f2N7SeCrVzAAqPe5qGkHSaDObTMX9xncDLcWju2SV2TEvIitdNybQ9PPL8Tgq77hEKUkHy2ytesEzB/Wjl6RWhfIFkqSh00uKxHRitu6Y4yFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786472981; c=relaxed/simple; bh=9FFPob6B/TWOHS5ap/mEUBqiBgNUvw5U4wPSPDKAKZM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HcbYHt+yzpuxYO1loSYzcvIFxMm3p+V84dZQ0qrVLTBu4WanKufB6mZyvJPf1ZLKQcfmVPIx7GBGDLql3ljh0/oSMudPrBOhPBEQFZbpLEHuY2lP4Im54KbAyESUrPe4FZnPxi3ilgPm+sUexpvxD9z8jpwQYXP6DY9Eb7KqRdE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=At9quwVM; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="At9quwVM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15FF21F00A3A; Tue, 11 Aug 2026 18:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786472979; bh=pMJmxAX7LFPtTnv4S/pMtci4u+72XBJaoCLzTQSMC1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=At9quwVMAExlvxgL7UH/gUTKXgyO1nVh1hbMFWkcaAiHy1JiV7fLYa8kZBfm7+Y1T auqjJhPiw5vtLtWjEIlugn3yYpL0hAS1o15UTetnZ3RXXQUnHZf4xVF2Qxu+sRZ4Be DcT3zfUqnKU3veqMz+RbUyOLyq0TbSEUcWpe2ZdA+/YhOWijg+MyFwwvrns99twwYe B7fgqbVxbQPIXZdVb70wPgV1fyb/QmDupVXVyxI260+DMYXH4Fsp9Nx+aP+Njdjh7m 9Vdsdd/wxB6gBTqSc36PEuHCbeBFaIEt9HQXBgRimWoDK+cptrOiyUAQM2S99hM0zL DgIn2x4SQMPuA== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , James Clark , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 7/7] perf build: install-build-deps: add RHEL family devel package mapping Date: Tue, 11 Aug 2026 15:29:00 -0300 Message-ID: <20260811182900.27063-8-acme@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260811182900.27063-1-acme@kernel.org> References: <20260811182900.27063-1-acme@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnaldo 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=3D"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 --- tools/perf/scripts/install-build-deps.sh | 220 ++++++++++++++++++++--- 1 file changed, 197 insertions(+), 23 deletions(-) diff --git a/tools/perf/scripts/install-build-deps.sh b/tools/perf/scripts/= install-build-deps.sh index aaaf315516f04d4b..d003e7fab2be8a5d 100755 --- a/tools/perf/scripts/install-build-deps.sh +++ b/tools/perf/scripts/install-build-deps.sh @@ -37,11 +37,33 @@ # distrobox create --image debian:trixie # distrobox enter debian-trixie # -# Running inside a container keeps the host system unmodified. +# - RHEL and its variants (RHEL, CentOS Stream, Rocky Linux, AlmaLinux, +# Oracle Linux), on dnf (RHEL 8 and later), validated on CentOS +# Stream 10, in a distrobox container: +# +# distrobox create --image quay.io/centos/centos:stream10 +# distrobox enter centos-stream10 +# +# The RHEL family reuses most Fedora package names, with these +# differences, handled by probing the enabled repos: # -# RHEL support, whose package mapping is largely similar to Fedora's, -# is the next planned distro, to be enabled once that mapping is -# validated there. +# - zlib.h comes from zlib-ng-compat-devel on the RHEL 10 family, +# zlib-devel on RHEL 9 and earlier; +# - the JDK devel package is versioned, there is no +# java-latest-openjdk-devel: 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 are in the CRB repo on RHEL +# and CentOS Stream 10 ('dnf config-manager --set-enabled crb') +# and in EPEL on RHEL 9 and earlier; +# - libbabeltrace2-devel is not packaged on the RHEL 10 family. +# +# On the RHEL family, packages not available on the enabled repos +# are skipped and listed at the end of the run, so that a distro +# with CRB/EPEL enabled gets the full set, and a distro without +# them still installs what it can. +# +# Running inside a container keeps the host system unmodified. # # Usage: install-build-deps.sh [OPTIONS] # @@ -49,7 +71,8 @@ # --list list the packages that would be installed, then exit # --dry-run show the install command that would be run, without # running it -# --distro ID force a distro: fedora, ubuntu, debian (default: auto-de= tect) +# --distro ID force a distro: fedora, rhel, ubuntu, debian +# (default: auto-detect) # -h, --help print this help message # # Requires root (or passwordless sudo) to actually install packages. @@ -71,13 +94,19 @@ it, so the corresponding feature gets enabled on a buil= d. Options: --list list the packages that would be installed, then exit --dry-run show the install command that would be run, without runnin= g it - --distro ID force a distro: fedora, ubuntu, debian + --distro ID force a distro: fedora, rhel, ubuntu, debian -h, --help print this help message =20 Distros supported: Fedora (dnf), validated in a toolbx container on Fedora 44, Ubuntu (apt-get), validated in a distrobox container on -Ubuntu 26.04, and Debian (apt-get), reusing the Ubuntu mapping, -validated in a distrobox container on Debian 13 (trixie). +Ubuntu 26.04, Debian (apt-get), reusing the Ubuntu mapping, validated +in a distrobox container on Debian 13 (trixie), and the RHEL family +(dnf, RHEL 8 and later), validated on CentOS Stream 10 in a distrobox +container. On the RHEL family, packages not available on the enabled +repos are skipped and listed at the end; some there, e.g. +libbpf-devel and capstone-devel, come from the CRB repo on RHEL and +CentOS Stream 10 ('dnf config-manager --set-enabled crb') and from +EPEL on RHEL 9 and earlier. EOF exit 0 } @@ -180,6 +209,72 @@ fedora_pkg_for() { # libaio-devel provides. } =20 +# --------------------------------------------------------------------- +# Check whether the first argument is provided by the enabled repos, or +# is already installed, returning 0 if so and printing nothing. +# +# dnf repoquery exits 0 even when the pattern does not match anything, +# so availability is judged by the output being non-empty, not by the +# exit code. +# --------------------------------------------------------------------- +pkg_available() { + local p out + for p in "$@"; do + out=3D$(dnf repoquery --quiet --available "$p" 2>/dev/null) + [ -n "$out" ] || out=3D$(dnf repoquery --quiet --installed "$p" 2>/dev/n= ull) + [ -n "$out" ] && return 0 + done + return 1 +} + +# --------------------------------------------------------------------- +# Return the first of its arguments that pkg_available() accepts. +# --------------------------------------------------------------------- +pick_available() { + local p + for p in "$@"; do + if pkg_available "$p"; then + echo "$p" + return 0 + fi + done + return 1 +} + +# --------------------------------------------------------------------- +# Return the RHEL-family package(s) providing the devel requirements of +# a feature test. This family reuses the Fedora mapping, whose names +# apply to it as well, except for the features whose Fedora package +# does not exist there, kept in the case below. +# +# Whether the resulting package is actually installable is checked in +# package_set(), as some of these names live in the CRB or EPEL repos, +# which may not be enabled: on the RHEL 10 family libbpf-devel and +# capstone-devel come from CRB, and libbabeltrace2-devel is not +# packaged at all. +# --------------------------------------------------------------------- +rhel_pkg_for() { + local feat=3D"$1" + case "$feat" in + zlib) + # zlib-ng-compat-devel on the RHEL 10 family, zlib-devel on + # RHEL 9 and earlier. If neither is on the enabled repos, + # fall back to the first candidate so that package_set() + # reports it as missing instead of silently dropping the + # feature from the end-of-run note. + pick_available zlib-devel zlib-ng-compat-devel || echo "zlib-devel" + ;; + jvmti|jvmti-cmlr) + # No java-latest-openjdk-devel on the RHEL family: the JDK + # devel package is versioned per release. + pick_available java-latest-openjdk-devel java-21-openjdk-devel java-17-o= penjdk-devel java-11-openjdk-devel || echo "java-latest-openjdk-devel" + ;; + *) + fedora_pkg_for "$feat" + ;; + esac +} + # --------------------------------------------------------------------- # Return the Debian/Ubuntu package(s) providing the devel requirements # of a feature test in tools/build/feature/. This mapping is shared by @@ -277,6 +372,11 @@ fedora_base_pkgs=3D"gcc gcc-c++ make flex bison glibc-= devel kernel-headers python3 # installs by default, needed by the babeltrace2 feature test and # libopenssl's pkg-config checks. debian_base_pkgs=3D"gcc g++ make pkg-config flex bison libc6-dev linux-lib= c-dev python3-setuptools rustc" +# pkg-config: like Fedora, on pkgconf since Fedora 26 / RHEL 8, with +# 'pkgconfig' live only as a virtual Provides of the pkgconf-pkg-config +# subpackage. List it explicitly because, unlike Fedora, a minimal +# RHEL-family container may not have it preinstalled. +rhel_base_pkgs=3D"gcc gcc-c++ make flex bison glibc-devel kernel-headers p= kgconf-pkg-config python3-setuptools rust" =20 # --------------------------------------------------------------------- # Distro detection @@ -290,11 +390,12 @@ detect_distro() { id=3D$( . /etc/os-release 2>/dev/null && echo "${ID:-}" ) case "$id" in fedora) echo "fedora" ;; + rhel|centos|rocky|almalinux|ol) + # All share the Fedora package names (with the exceptions + # handled by rhel_pkg_for()) and dnf. + echo "rhel" ;; ubuntu) echo "ubuntu" ;; debian) echo "debian" ;; - # RHEL and its derivatives share most Fedora package names, but the - # mapping is only validated on Fedora, so don't auto-detect them. - rhel|centos|rocky|alma|ol) echo "" ;; *) echo "" ;; esac } @@ -316,33 +417,80 @@ feature_tests() { # Assemble the unique package list. Since the full feature set is mapped # unconditionally, this installs the complete devel environment; installing # an already-present package is a no-op for both dnf and apt-get, making -# this idempotent. +# this idempotent. On the RHEL family, packages not available on the +# enabled repos are skipped and echoed on stderr, reported at the end of +# the run by the caller (package_set() runs in a subshell, so a variable +# would not survive it). # --------------------------------------------------------------------- package_set() { local distro=3D"$1" srcdir=3D"$2" - local feat pkg pkgs + local feat pkg pkgs base_pkgs missing_pkgs=3D"" case "$distro" in fedora) pkgs=3D"$fedora_base_pkgs" ;; + rhel) pkgs=3D"$rhel_base_pkgs" ;; ubuntu|debian) pkgs=3D"$debian_base_pkgs" ;; esac =20 + # The base set must be checked against the enabled repos as well: + # e.g. 'rust' is only shipped as the rust-toolset AppStream module + # on RHEL 8 and 9, where dnf would abort the whole transaction + # with "No match for argument: rust" instead of skipping it, so + # unavailable base packages are skipped and noted like the mapped + # ones below. + if [ "$distro" =3D "rhel" ]; then + base_pkgs=3D"$pkgs" + pkgs=3D"" + for pkg in $base_pkgs; do + if pkg_available "$pkg"; then + pkgs=3D"$pkgs $pkg" + else + missing_pkgs=3D"$missing_pkgs $pkg" + fi + done + fi + for feat in $(feature_tests "$srcdir"); do - if [ "$distro" =3D "fedora" ]; then - pkg=3D$(fedora_pkg_for "$feat") - else - pkg=3D$(debian_pkg_for "$feat") - fi + case "$distro" in + fedora) pkg=3D$(fedora_pkg_for "$feat") ;; + rhel) pkg=3D$(rhel_pkg_for "$feat") ;; + *) pkg=3D$(debian_pkg_for "$feat") ;; + esac + # An empty result means the feature test has no external devel + # dependency (see the unmapped list in fedora_pkg_for()), so + # there is nothing to install and nothing to report as missing: + # packages that are genuinely unavailable on the RHEL family + # surface through rhel_pkg_for() falling back to its first + # candidate, so that the pkg_available() check below catches + # them and adds them to missing_pkgs. [ -n "$pkg" ] || continue for pkg in $pkg; do + if [ "$distro" =3D "rhel" ] && ! pkg_available "$pkg"; then + missing_pkgs=3D"$missing_pkgs $pkg" + continue + fi case " $pkgs " in *" $pkg "*) ;; *) pkgs=3D"$pkgs $pkg" ;; esac done done + [ -n "$missing_pkgs" ] && echo "$missing_pkgs" >&2 echo "$pkgs" } =20 +# --------------------------------------------------------------------- +# Report the RHEL-family packages that were skipped because the enabled +# repos do not provide them. +# --------------------------------------------------------------------- +note_missing() { + [ -n "$1" ] || return 0 + echo "Note: these packages are not available on the enabled repos" >&2 + echo "and were not installed, so the features they enable will stay" >&2 + echo "off in a perf build:" >&2 + echo "$1" | tr ' ' '\n' | grep -v '^$' | sort -u | sed 's/^/ /' >&2 + echo >&2 +} + # --------------------------------------------------------------------- # The install command proper for each supported package manager, plus # the command massaged for --dry-run. @@ -350,7 +498,7 @@ package_set() { install_cmd() { local distro=3D"$1"; shift case "$distro" in - fedora) + fedora|rhel) echo "dnf install -y $*" ;; ubuntu|debian) @@ -371,7 +519,7 @@ main() { # with the *_pkg_for() helpers, declares the per-feature 'pkg' # locals; main() holds no per-feature package state, just the # distro-wide list assembled by package_set(). - local srcdir distro pkgs cmd + local srcdir distro pkgs cmd missing_file missing_pkgs =20 while [ $# -gt 0 ]; do case "$1" in @@ -391,23 +539,48 @@ main() { srcdir=3D$(cd "$(dirname "$0")/../../.." && pwd) distro=3D$(detect_distro) case "$distro" in - fedora|ubuntu|debian) ;; + fedora|rhel|ubuntu|debian) ;; *) echo "error: unsupported distro (got '$distro'); the package mapping is = not validated on other distros." >&2 - echo "Supported and validated: Fedora 44 (toolbx container), Ubuntu 26.0= 4 and Debian 13 (distrobox containers)." >&2 + echo "Supported and validated: Fedora 44 (toolbx container), Ubuntu 26.0= 4 and Debian 13 (distrobox containers), and CentOS Stream 10 (distrobox con= tainer)." >&2 exit 1 ;; esac =20 - pkgs=3D$(package_set "$distro" "$srcdir") + # The RHEL family mapping probes the enabled repos with dnf + # repoquery and installs with dnf, so reject the yum-only members of + # the family (RHEL 7 and earlier, e.g. Oracle Linux 7) with a clear + # error instead of silently judging every package as unavailable. + if [ "$distro" =3D "rhel" ] && ! command -v dnf >/dev/null 2>&1; then + echo "error: dnf not found, the RHEL family package mapping requires dnf= (RHEL 8 and later)." >&2 + exit 1 + fi + + missing_file=3D$(mktemp) || { + echo "error: cannot create a temporary file (mktemp failed)" >&2 + exit 1 + } + # package_set() runs in a subshell, doing dnf repoquery loops that + # may be interrupted: a Ctrl-C during those loops hits these traps, + # turning SIGINT/SIGTERM into an exit that triggers the EXIT trap, + # removing the temp file, so the script terminates instead of + # resuming after the interrupted command, leaving no file behind. + trap 'rm -f "$missing_file"' EXIT + trap 'exit 1' INT TERM + pkgs=3D$(package_set "$distro" "$srcdir" 2>"$missing_file") + missing_pkgs=3D$(cat "$missing_file") + rm -f "$missing_file" + trap - EXIT INT TERM =20 case "$action" in list) echo "$pkgs" | tr ' ' '\n' | grep -v '^$' | sort + note_missing "$missing_pkgs" exit 0 ;; dry-run) install_cmd "$distro" $pkgs + note_missing "$missing_pkgs" exit 0 ;; esac @@ -424,6 +597,7 @@ main() { echo "error: the install command failed, see the output above" >&2 exit 1 } + note_missing "$missing_pkgs" } =20 main "$@" --=20 2.55.0