[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYsj7vV2Lh8wV-ZR@x1>
Date: Tue, 10 Feb 2026 09:26:22 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Dmitry Dolgov <9erthalion6@...il.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>,
Ian Rogers <irogers@...gle.com>,
James Clark <james.clark@...aro.org>, Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 1/1] tools build: Fix rust feature detection
On Tue, Feb 10, 2026 at 11:02:56AM +0100, Dmitry Dolgov wrote:
> > On Mon, Feb 09, 2026 at 02:27:43PM -0300, Arnaldo Carvalho de Melo wrote:
> > Features in FEATURE_TESTS_BASIC will be set as being available if
> > test-all.c builds, so since the rust test isn't included in test-all.c,
> > we can't have 'rust' in there, remove it from FEATURE_TESTS_BASIC and
> > use feature-check so that it tries to build test-rust.bin, doing the
> > actual feature detection.
>
> My bad, thanks for fixing it.
>
> > And after installing it:
> >
> > ... rust: [ on ]
> >
> > $ cat /tmp/build/perf-tools-next/feature/test-rust.make.output
> > $ file /tmp/build/perf-tools-next/feature/test-rust.bin
> > /tmp/build/perf-tools-next/feature/test-rust.bin: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=9c416edf673ee3705b97bae893a99a6fcf1ee258, for GNU/Linux 3.2.0, with debug_info, not stripped
> > $
> > $ perf -vv | grep RUST
> > rust: [ on ] # HAVE_RUST_SUPPORT
>
> I've noticed few more problem, maybe worth fixing it here as well:
>
> * test-rust.bin is missing from the list of FILES, and thus is not removed by
> the clean target. This could lead to a false feature detection, since the
> binary stays there.
>
> * Target to build test-rust.bin does not emit a dependencies file.
>
> I've tested the following diff after first having rust installed, then removing
> it and building again.
I tried here building it with rust installed, it detected, ok, then I
removed and tried to rebuild, it still thinks rust is there:
⬢ [acme@...lbx perf-tools-next]$ rpm -qa | grep rust
p11-kit-trust-0.25.8-1.fc43.x86_64
rust-srpm-macros-28.4-1.fc43.noarch
⬢ [acme@...lbx perf-tools-next]$ m
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j32' parallel build
Warning: Kernel ABI header differences:
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
Auto-detecting system features:
... libdw: [ on ]
... glibc: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libpython: [ on ]
... libcapstone: [ on ]
... llvm-perf: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... bpf: [ on ]
... libaio: [ on ]
... libzstd: [ on ]
... libopenssl: [ on ]
... rust: [ on ]
INSTALL libsubcmd_headers
INSTALL libapi_headers
INSTALL libperf_headers
INSTALL libsymbol_headers
INSTALL libbpf_headers
INSTALL binaries
INSTALL tests
INSTALL libperf-jvmti.so
INSTALL libexec
INSTALL perf-archive
INSTALL perf-iostat
INSTALL python-scripts
install: omitting directory 'scripts/python/Perf-Trace-Util/lib/Perf/Trace/__pycache__'
INSTALL dlfilters
INSTALL perf_completion-script
INSTALL perf-tip
make: Leaving directory '/home/acme/git/linux/tools/perf'
⬢ [acme@...lbx perf-tools-next]$
⬢ [acme@...lbx perf-tools-next]$ perf -vv | grep rust
rust: [ on ] # HAVE_RUST_SUPPORT
⬢ [acme@...lbx perf-tools-next]$
I.e. it doesn't rebuild perf and thus doesn't notice that it doesn't
have what is needed, if I touch some other file and thus it triggers a
rebuild, it still manages to build it...
⬢ [acme@...lbx perf-tools-next]$ perf -vv | grep rust
rust: [ on ] # HAVE_RUST_SUPPORT
⬢ [acme@...lbx perf-tools-next]$
Trying:
⬢ [acme@...lbx perf-tools-next]$ readelf -wi /tmp/build/perf-tools-next/tests/workloads/code_with_type.a | grep -m1 producer
<c> DW_AT_producer : (indirect string, offset: 0): clang LLVM (rustc version 1.93.0 (254b59607 2026-01-19) (Fedora 1.93.0-1.fc43))
⬢ [acme@...lbx perf-tools-next]$ rm -f /tmp/build/perf-tools-next/tests/workloads/code_with_type.a
⬢ [acme@...lbx perf-tools-next]$
rustc /tmp/build/perf-tools-next/tests/workloads/code_with_type.a
/bin/sh: line 1: rustc: command not found
make[5]: *** [/home/acme/git/linux/tools/build/Makefile.build:120: /tmp/build/perf-tools-next/tests/workloads/code_with_type.a] Error 127
make[4]: *** [/home/acme/git/linux/tools/build/Makefile.build:156: workloads] Error 2
make[3]: *** [/home/acme/git/linux/tools/build/Makefile.build:156: tests] Error 2
make[2]: *** [Makefile.perf:782: /tmp/build/perf-tools-next/perf-test-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.perf:286: sub-make] Error 2
make: *** [Makefile:119: install-bin] Error 2
make: Leaving directory '/home/acme/git/linux/tools/perf'
⬢ [acme@...lbx perf-tools-next]$
So there is still some dep missing...
- Arnaldo
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 9ae69d85716..28d4ff0841a 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -73,7 +73,8 @@ FILES= \
> test-clang-bpf-co-re.bin \
> test-file-handle.bin \
> test-libpfm4.bin \
> - test-libopenssl.bin
> + test-libopenssl.bin \
> + test-rust.bin
>
> FILES := $(addprefix $(OUTPUT),$(FILES))
>
> @@ -112,7 +113,7 @@ __BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(
> __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
> BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
>
> -__BUILDRS = $(RUSTC) $(RUSTC_FLAGS) -o $@ $(patsubst %.bin,%.rs,$(@F))
> +__BUILDRS = $(RUSTC) $(RUSTC_FLAGS) --emit=dep-info=$(patsubst %.bin,%.d,$(@F)),link -o $@ $(patsubst %.bin,%.rs,$(@F))
> BUILDRS = $(__BUILDRS) > $(@:.bin=.make.output) 2>&1
>
> Reviewed-by: Dmitrii Dolgov <9erthalion6@...il.com>
Powered by blists - more mailing lists