Re: [ALMOST ready] Re: [PATCH 2/3] perf build: Use libtraceevent from the system

From: Arnaldo Carvalho de Melo
Date: Wed Dec 07 2022 - 09:37:46 EST


Em Wed, Dec 07, 2022 at 11:21:18AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Dec 06, 2022 at 02:22:15PM -0800, Ian Rogers escreveu:
> > On Tue, Dec 6, 2022 at 9:31 AM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > > Em Tue, Dec 06, 2022 at 02:13:48PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > I'm missing some detail, this isn't working, util/trace-event.c is still
> > > being built and linked.
>
> > > The python binding should be usable without tracepoints, in fact its
> > > first usage was just to have access to the perf metaevents, see
> > > tools/perf/python/twatch.py.
>
> > You're right. I'd assumed that if you were disabling libtraceevent
> > then you'd also disable python. To fix the issue above you can do:
>
> > --- a/tools/perf/util/python-ext-sources
> > +++ b/tools/perf/util/python-ext-sources
> > @@ -30,7 +30,6 @@ util/rblist.c
> > util/counts.c
> > util/print_binary.c
> > util/strlist.c
> > -util/trace-event.c
> > ../lib/rbtree.c
> > util/string.c
> > util/symbol_fprintf.c
>
> > but this needs making conditional (possibly in setup.py) on whether
> > libtraceevent is present or not.
>
> Ok, I fixed this by removing the util/trace-event.c file at setup.py
> time, and removing it from the list of dependencies for python.so build,
> etc.
>
> With what I have at tmp.perf/core I'm being able to build with
> combinations of:
>
> - Having or not libtraceevent-devel installed
>
> - Using NO_LIBTRACEEVENT=1
>
> - The default build

cross building reveals some more:

22 11.70 debian:experimental-x-arm64 : FAIL gcc version 12.2.0 (Debian 12.2.0-9)
arch/arm64/util/kvm-stat.c: In function 'event_get_key':
arch/arm64/util/kvm-stat.c:30:20: error: implicit declaration of function 'evsel__intval'; did you mean 'evsel__env'? [-Werror=implicit-function-declaration]
30 | key->key = evsel__intval(evsel, sample, kvm_exit_reason);
| ^~~~~~~~~~~~~
| evsel__env
cc1: all warnings being treated as errors
make[5]: *** [/git/perf-6.1.0-rc6/tools/build/Makefile.build:139: util] Error 2
make[4]: *** [/git/perf-6.1.0-rc6/tools/build/Makefile.build:139: arm64] Error 2
make[3]: *** [/git/perf-6.1.0-rc6/tools/build/Makefile.build:139: arch] Error 2

I'll conditionalise tha one as well...

- Arnaldo