[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFxkdArafHXFtw-MQzJ+bpFUqne7u3++amqL0h-pdBj4_UK0dA@mail.gmail.com>
Date: Mon, 10 May 2021 16:34:48 -0500
From: Justin Forbes <jmforbes@...uxtx.org>
To: Jiri Olsa <jolsa@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ian Rogers <irogers@...gle.com>,
"Justin M . Forbes" <jforbes@...hat.com>,
lkml <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Michael Petlan <mpetlan@...hat.com>
Subject: Re: [PATCH] perf tools: Fix dynamic libbpf link
On Sat, May 8, 2021 at 3:50 PM Jiri Olsa <jolsa@...nel.org> wrote:
>
> Justin reported broken build with LIBBPF_DYNAMIC=1.
>
> When linking libbpf dynamically we need to use perf's
> hashmap object, because it's not exported in libbpf.so
> (only in libbpf.a).
>
> Following build is now passing:
>
> $ make LIBBPF_DYNAMIC=1
> BUILD: Doing 'make -j8' parallel build
> ...
> $ ldd perf | grep libbpf
> libbpf.so.0 => /lib64/libbpf.so.0 (0x00007fa7630db000)
>
> Fixes: eee19501926d ("perf tools: Grab a copy of libbpf's hashmap")
> Cc: Ian Rogers <irogers@...gle.com>
> Reported-by: Justin M. Forbes <jforbes@...hat.com>
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
This patch fixes it for me.
Tested-by: Justin M. Forbes <jforbes@...hat.com>
> tools/perf/Makefile.config | 1 +
> tools/perf/util/Build | 7 +++++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 7b195e16040e..dacd16874d3d 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -546,6 +546,7 @@ ifndef NO_LIBELF
> ifdef LIBBPF_DYNAMIC
> ifeq ($(feature-libbpf), 1)
> EXTLIBS += -lbpf
> + $(call detected,CONFIG_LIBBPF_DYNAMIC)
> else
> dummy := $(error Error: No libbpf devel library found, please install libbpf-devel);
> endif
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index e27a551acd3a..95e15d1035ab 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -145,7 +145,14 @@ perf-$(CONFIG_LIBELF) += symbol-elf.o
> perf-$(CONFIG_LIBELF) += probe-file.o
> perf-$(CONFIG_LIBELF) += probe-event.o
>
> +ifdef CONFIG_LIBBPF_DYNAMIC
> + hashmap := 1
> +endif
> ifndef CONFIG_LIBBPF
> + hashmap := 1
> +endif
> +
> +ifdef hashmap
> perf-y += hashmap.o
> endif
>
> --
> 2.31.1
>
Powered by blists - more mailing lists