Re: [PATCH 1/2] perf build: Use pkg-config for feature check for libtrace{event,fs}

Arnaldo Carvalho de Melo
2024-06-26T19:20:01Z

Sorry, forgot to CC the mailing lists.

On Wed, Jun 26, 2024 at 04:19:29PM -0300, Arnaldo Carvalho de Melo wrote:
> On Tue, Jun 25, 2024 at 09:36:35PM +0200, Guilherme Amadio wrote:
> > On Mon, Jun 24, 2024 at 10:50:56AM -0700, Namhyung Kim wrote:
> > > On Thu, 06 Jun 2024 17:33:01 +0200, amadio@gentoo.org wrote:
> > >
> > > > Needed to add required include directories for the feature detection
> > > > to succeed. The header tracefs.h is installed either into the include
> > > > directory /usr/include/tracefs/tracefs.h when using the Makefile, or
> > > > into /usr/include/libtracefs/tracefs.h when using meson to build
> > > > libtracefs. The header tracefs.h uses #include <event-parse.h> from
> > > > libtraceevent, so pkg-config needs to pick the correct include directory
> > > > for libtracefs and add the one for libtraceevent to succeed.
> > > >
> > > > [...]
> > >
> > > Applied both to perf-tools-next, thanks!
> >
> > Thank you very much!
>
> So now when we don't libtracefs installed we get (with current
> perf-tools-next):
>
> ⬢[acme@toolbox perf-tools-next]$ m
> make: Entering directory '/home/acme/git/perf-tools-next/tools/perf'
> BUILD: Doing 'make -j28' parallel build
> HOSTCC /tmp/build/perf-tools-next/fixdep.o
> HOSTLD /tmp/build/perf-tools-next/fixdep-in.o
> LINK /tmp/build/perf-tools-next/fixdep
> Warning: Kernel ABI header differences:
> diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
> diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
> diff -u tools/include/uapi/linux/stat.h include/uapi/linux/stat.h
> diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
> diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
> diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
> diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
> diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
> diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl
> diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
> diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
> diff -u tools/perf/trace/beauty/arch/x86/include/asm/irq_vectors.h arch/x86/include/asm/irq_vectors.h
> diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h
> diff -u tools/perf/trace/beauty/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
> diff -u tools/perf/trace/beauty/include/uapi/linux/prctl.h include/uapi/linux/prctl.h
> diff -u tools/perf/trace/beauty/include/uapi/linux/stat.h include/uapi/linux/stat.h
> Package libtracefs was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libtracefs.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'libtracefs', required by 'virtual:world', not found
> Package libtracefs was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libtracefs.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'libtracefs', required by 'virtual:world', not found
>
> Auto-detecting system features:
> ... dwarf: [ on ]
> ... dwarf_getlocations: [ on ]
> ... glibc: [ on ]
> ... libbfd: [ on ]
> ... libbfd-buildid: [ on ]
> ... libcap: [ on ]
> ... libelf: [ on ]
> ... libnuma: [ on ]
> ... numa_num_possible_cpus: [ on ]
> ... libperl: [ on ]
> ... libpython: [ on ]
> ... libcrypto: [ on ]
> ... libunwind: [ on ]
> ... libdw-dwarf-unwind: [ on ]
> ... libcapstone: [ on ]
> ... zlib: [ on ]
> ... lzma: [ on ]
> ... get_cpuid: [ on ]
> ... bpf: [ on ]
> ... libaio: [ on ]
> ... libzstd: [ on ]
>
> GEN /tmp/build/perf-tools-next/common-cmds.h
> GEN /tmp/build/perf-tools-next/arch/arm64/include/generated/asm/sysreg-defs.h
>
> Which is a new behaviour, we never had those kinds of warnings from
> pkg-config, and when something wasn´t available we would reflect that
> somehow in the "Auto-detecting system features", additionally telling
> the users which set of features would not be available due to some
> system component not being available.
>
> Further more we would suggest the name of the package to install.
>
> Now I have this "virtual:world" thing that I never heard about (what is
> that)?
>
> Ditto for PKG_CONFIG_PATH, I probably guess what this is about, but then
> it is a novelty for people with just enough muscle memory to build the
> kernel, build perf and use it.
>
> If I try:
>
> $ sudo dnf install libtracefs
>
> Cool:
>
> Installed:
> libtracefs-1.6.4-3.fc39.x86_64
>
> Complete!
> $
>
> but then when I try to build perf again I get those warnings again, but
> a full build neverthless:
>
> Package libtracefs was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libtracefs.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'libtracefs', required by 'virtual:world', not found
> Package libtracefs was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libtracefs.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'libtracefs', required by 'virtual:world', not found
>
> Its only when I try:
>
> $ sudo dnf install libtracefs-devel
>
> That I get a build without warnings.
>
> So, what is the feature detection that is failing when libtracefs-devel
> isn't installed? What are the features that we lose in such a situation?
>
> - Arnaldo