All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Song Liu <songliubraving@fb.com>, Jiri Olsa <jolsa@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>, bpf <bpf@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Quentin Monnet <quentin@isovalent.com>
Subject: Re: perf build broken seemingly due to libbpf changes, checking...
Date: Thu, 6 Jan 2022 14:04:25 -0800	[thread overview]
Message-ID: <CAP-5=fUN+XqrSmwqab9DyGtvpZ7iZkfnUNwBfK1CDA_iX+aF0Q@mail.gmail.com> (raw)
In-Reply-To: <CAEf4BzbbOHQZUAe6iWaehKCPQAf3VC=hq657buqe2_yRKxaK-A@mail.gmail.com>

On Thu, Jan 6, 2022 at 1:44 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Thu, Jan 6, 2022 at 1:42 PM Ian Rogers <irogers@google.com> wrote:
> >
> > On Thu, Jan 6, 2022 at 11:48 AM Arnaldo Carvalho de Melo
> > <acme@kernel.org> wrote:
> > >
> > > Em Thu, Jan 06, 2022 at 04:44:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Em Thu, Jan 06, 2022 at 04:34:46PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > > After merging torvalds/master to perf/urgent I'm getting this:
> > > > >
> > > > > util/bpf-event.c:25:21: error: no previous prototype for ‘btf__load_from_kernel_by_id’ [-Werror=missing-prototypes]
> > > > >    25 | struct btf * __weak btf__load_from_kernel_by_id(__u32 id)
> > > > >       |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > util/bpf-event.c:37:1: error: no previous prototype for ‘bpf_object__next_program’ [-Werror=missing-prototypes]
> > > > >    37 | bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prev)
> > > > >       | ^~~~~~~~~~~~~~~~~~~~~~~~
> > > > > util/bpf-event.c:46:1: error: no previous prototype for ‘bpf_object__next_map’ [-Werror=missing-prototypes]
> > > > >    46 | bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *prev)
> > > > >       | ^~~~~~~~~~~~~~~~~~~~
> > > > > util/bpf-event.c:55:1: error: no previous prototype for ‘btf__raw_data’ [-Werror=missing-prototypes]
> > > > >    55 | btf__raw_data(const struct btf *btf_ro, __u32 *size)
> > > > >       | ^~~~~~~~~~~~~
> > > > > cc1: all warnings being treated as errors
> > > > > make[4]: *** [/var/home/acme/git/perf/tools/build/Makefile.build:96: /tmp/build/perf/util/bpf-event.o] Error 1
> > > > > make[4]: *** Waiting for unfinished jobs....
> > > > > util/bpf_counter.c: In function ‘bpf_target_prog_name’:
> > > > > util/bpf_counter.c:82:15: error: implicit declaration of function ‘btf__load_from_kernel_by_id’ [-Werror=implicit-function-declaration]
> > > > >    82 |         btf = btf__load_from_kernel_by_id(info_linear->info.btf_id);
> > > > >       |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > util/bpf_counter.c:82:13: error: assignment to ‘struct btf *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
> > > > >    82 |         btf = btf__load_from_kernel_by_id(info_linear->info.btf_id);
> > > > >       |             ^
> > > > > cc1: all warnings being treated as errors
> > > > > make[4]: *** [/var/home/acme/git/perf/tools/build/Makefile.build:96: /tmp/build/perf/util/bpf_counter.o] Error 1
> > > > >
> > > > > I'm checking now...
> > > > >
> > > > > BTW I test perf builds with:
> > > > >
> > > > > make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin && git status && perf test python
> > > >
> > > > Nevermind, this was due to a patch by Ian Rogers I was testing,
> > > > bisecting get up to the last patch, since I had merged torvalds/master
> > > > today it got me to a wrong correlation, sorry for the disturbance.
> > > >
> > > > For reference, this is the patch:
> > > >
> > > > http://lore.kernel.org/lkml/20220106072627.476524-1-irogers@google.com
> > >
> > > Ian, I have libbpf-devel installed:
> > >
> > > ⬢[acme@toolbox perf]$ rpm -qa | grep libbpf
> > > libbpf-0.4.0-1.fc34.x86_64
> > > libbpf-devel-0.4.0-1.fc34.x86_64
> > > ⬢[acme@toolbox perf]$
> > >
> > > But I'm not using LIBBPF_DYNAMIC=1, so you can't just give precedence to
> > > system headers for all of the homies in tools/lib/.
> > >
> > > I bet that if I remove the libbpf-devel package it works, yeah, just
> > > tested. So we need to make those overrides dependent on using
> > > LIBBPF_DYNAMIC=1, LIBTRACEEVENT_DYNAMIC=1, etc and avoid the big hammer
> > > that is -Itools/lib/, using a more finegrained approach, right?
> >
> > Ugh, this is messy. The -I for tools/lib is overloaded and being used
> > in tools/perf/util/bpf-event.c so that bpf/bpf.h, bpf/btf.h and
>
> can you do `make install` for libbpf instead and have it install
> headers into a dedicated target directory which can be added into -I
> search path. Quentin did this for all the other libbpf users in kernel
> tree (bpftool, resolve_btfids, etc) and it works great.

This sounds good to me, and being able to borrow code from bpftool
should make writing it is straightforward. I'll try to find time to do
a patch, but I don't mind someone getting there before me :-)

Thanks,
Ian

> > bpf/libbpf.h can be found. Likewise, for tools/perf/util/debug.c it is
> > used to pick up traceevent/event-parse.h.
> >
> > Assuming  LIBBPF_DYNAMIC=1 and LIBTRACEEVENT_DYNAMIC=1 then we get
> > different combinations of:
> > libtraceevent >= 1.3 && libbpf >= 0.6 - -I is broken for debug.c,
> > -idirafter okay
> > libtraceevent >= 1.3 && libbpf < 0.6 - -I is broken for debug.c,
> > -idirafter broken for bpf-event.c
> > libtraceevent < 1.3 && libbpf >= 0.6 - -I should build okay but
> > headers mismatched, -idirafter okay
> > libtraceevent < 1.3 && libbpf < 0.6 - -I will fail to link
> > bpf-event.c, -idirafter broken for bpf-event.c
> >
> > As the choice of -I and -idirafter are binary then there will always
> > be a way to break the build. We could modify the build so that the
> > -I/-idirafter only applies to the affected C files. This postpones the
> > problem to when libbpf and libtracevent are in the same file, which
> > doesn't happen currently. I think if you want the dynamic behavior
> > then you need to use idirafter.
> >
> > Thanks,
> > Ian

  reply	other threads:[~2022-01-06 22:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06 19:34 perf build broken seemingly due to libbpf changes, checking Arnaldo Carvalho de Melo
2022-01-06 19:44 ` Arnaldo Carvalho de Melo
2022-01-06 19:48   ` Arnaldo Carvalho de Melo
2022-01-06 21:41     ` Ian Rogers
2022-01-06 21:44       ` Andrii Nakryiko
2022-01-06 22:04         ` Ian Rogers [this message]
2022-01-07  3:30           ` Ian Rogers
2022-01-07 18:32             ` Arnaldo Carvalho de Melo
2022-01-07 19:26               ` Ian Rogers
2022-01-07 20:18                 ` Arnaldo Carvalho de Melo
2022-01-08 22:38                   ` Ian Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAP-5=fUN+XqrSmwqab9DyGtvpZ7iZkfnUNwBfK1CDA_iX+aF0Q@mail.gmail.com' \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=jirislaby@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=quentin@isovalent.com \
    --cc=rostedt@goodmis.org \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.