From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
netdev@vger.kernel.org, bpf@vger.kernel.org,
Song Liu <songliubraving@fb.com>, Jiri Olsa <jolsa@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] perf build: Install libbpf headers locally when building
Date: Sun, 7 Nov 2021 12:30:07 -0300 [thread overview]
Message-ID: <YYfw/y2KmjvjOax2@kernel.org> (raw)
In-Reply-To: <20211107002445.4790-1-quentin@isovalent.com>
Em Sun, Nov 07, 2021 at 12:24:45AM +0000, Quentin Monnet escreveu:
> API headers from libbpf should not be accessed directly from the
> library's source directory. Instead, they should be exported with "make
> install_headers". Let's adjust perf's Makefile to install those headers
> locally when building libbpf.
>
> v2:
> - Fix $(LIBBPF_OUTPUT) when $(OUTPUT) is null.
> - Make sure the recipe for $(LIBBPF_OUTPUT) is not under a "ifdef".
Thanks for the prompt reply, now the cases where it was failing are
passing!
Best regards,
- Arnaldo
> Signed-off-by: Quentin Monnet <quentin@isovalent.com>
> ---
> tools/perf/Makefile.perf | 32 +++++++++++++++++++-------------
> 1 file changed, 19 insertions(+), 13 deletions(-)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index b856afa6eb52..e01ada5c9876 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -241,7 +241,7 @@ else # force_fixdep
>
> LIB_DIR = $(srctree)/tools/lib/api/
> TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
> -BPF_DIR = $(srctree)/tools/lib/bpf/
> +LIBBPF_DIR = $(srctree)/tools/lib/bpf/
> SUBCMD_DIR = $(srctree)/tools/lib/subcmd/
> LIBPERF_DIR = $(srctree)/tools/lib/perf/
> DOC_DIR = $(srctree)/tools/perf/Documentation/
> @@ -293,7 +293,6 @@ strip-libs = $(filter-out -l%,$(1))
> ifneq ($(OUTPUT),)
> TE_PATH=$(OUTPUT)
> PLUGINS_PATH=$(OUTPUT)
> - BPF_PATH=$(OUTPUT)
> SUBCMD_PATH=$(OUTPUT)
> LIBPERF_PATH=$(OUTPUT)
> ifneq ($(subdir),)
> @@ -305,7 +304,6 @@ else
> TE_PATH=$(TRACE_EVENT_DIR)
> PLUGINS_PATH=$(TRACE_EVENT_DIR)plugins/
> API_PATH=$(LIB_DIR)
> - BPF_PATH=$(BPF_DIR)
> SUBCMD_PATH=$(SUBCMD_DIR)
> LIBPERF_PATH=$(LIBPERF_DIR)
> endif
> @@ -324,7 +322,14 @@ LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = $(if $(findstring -static,$(LDFLAGS)),,$(DY
> LIBAPI = $(API_PATH)libapi.a
> export LIBAPI
>
> -LIBBPF = $(BPF_PATH)libbpf.a
> +ifneq ($(OUTPUT),)
> + LIBBPF_OUTPUT = $(abspath $(OUTPUT))/libbpf
> +else
> + LIBBPF_OUTPUT = $(CURDIR)/libbpf
> +endif
> +LIBBPF_DESTDIR = $(LIBBPF_OUTPUT)
> +LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include
> +LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a
>
> LIBSUBCMD = $(SUBCMD_PATH)libsubcmd.a
>
> @@ -829,12 +834,14 @@ $(LIBAPI)-clean:
> $(call QUIET_CLEAN, libapi)
> $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
>
> -$(LIBBPF): FORCE
> - $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
> +$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
> + $(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
> + O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= \
> + $@ install_headers
>
> $(LIBBPF)-clean:
> $(call QUIET_CLEAN, libbpf)
> - $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) clean >/dev/null
> + $(Q)$(RM) -r -- $(LIBBPF_OUTPUT)
>
> $(LIBPERF): FORCE
> $(Q)$(MAKE) -C $(LIBPERF_DIR) EXTRA_CFLAGS="$(LIBPERF_CFLAGS)" O=$(OUTPUT) $(OUTPUT)libperf.a
> @@ -1034,16 +1041,15 @@ SKELETONS := $(SKEL_OUT)/bpf_prog_profiler.skel.h
> SKELETONS += $(SKEL_OUT)/bperf_leader.skel.h $(SKEL_OUT)/bperf_follower.skel.h
> SKELETONS += $(SKEL_OUT)/bperf_cgroup.skel.h
>
> +$(SKEL_TMP_OUT) $(LIBBPF_OUTPUT):
> + $(Q)$(MKDIR) -p $@
> +
> ifdef BUILD_BPF_SKEL
> BPFTOOL := $(SKEL_TMP_OUT)/bootstrap/bpftool
> -LIBBPF_SRC := $(abspath ../lib/bpf)
> -BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(BPF_PATH) -I$(LIBBPF_SRC)/..
> -
> -$(SKEL_TMP_OUT):
> - $(Q)$(MKDIR) -p $@
> +BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE)
>
> $(BPFTOOL): | $(SKEL_TMP_OUT)
> - CFLAGS= $(MAKE) -C ../bpf/bpftool \
> + $(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
> OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
>
> VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \
> --
> 2.32.0
--
- Arnaldo
prev parent reply other threads:[~2021-11-07 15:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 2:02 [PATCH bpf-next] perf build: Install libbpf headers locally when building Quentin Monnet
2021-11-05 18:38 ` Andrii Nakryiko
2021-11-05 18:57 ` Arnaldo Carvalho de Melo
2021-11-06 19:29 ` Arnaldo Carvalho de Melo
2021-11-06 20:12 ` Arnaldo Carvalho de Melo
2021-11-06 21:05 ` [BUG] " Arnaldo Carvalho de Melo
2021-11-06 21:20 ` Arnaldo Carvalho de Melo
2021-11-07 0:21 ` Quentin Monnet
2021-11-07 0:24 ` [PATCH v2] " Quentin Monnet
2021-11-07 15:30 ` Arnaldo Carvalho de Melo [this message]
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=YYfw/y2KmjvjOax2@kernel.org \
--to=acme@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=quentin@isovalent.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).