[next,1/1] perf build: Warn about missing libelf before warning about missing libbpf

Message ID ZUEehyDk0FkPnvMR@kernel.org
State New
Headers
Series [next,1/1] perf build: Warn about missing libelf before warning about missing libbpf |

Commit Message

Arnaldo Carvalho de Melo Oct. 31, 2023, 3:34 p.m. UTC
  As libelf is a requirement for libbpf if it is not available, as in some
container build tests where NO_LIBELF=1 is used, then better warn about
the most basic library first.

Ditto for libz, check its availability before libbpf too.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.config | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Namhyung Kim Nov. 2, 2023, 6:04 a.m. UTC | #1
On Tue, Oct 31, 2023 at 8:34 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> As libelf is a requirement for libbpf if it is not available, as in some
> container build tests where NO_LIBELF=1 is used, then better warn about
> the most basic library first.
>
> Ditto for libz, check its availability before libbpf too.
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

> ---
>  tools/perf/Makefile.config | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index b3e6ed10f40c6f6c..8b6cffbc485834c8 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -680,15 +680,15 @@ ifndef BUILD_BPF_SKEL
>  endif
>
>  ifeq ($(BUILD_BPF_SKEL),1)
> -  ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
> -    dummy := $(warning Warning: Disabled BPF skeletons as libbpf is required)
> -    BUILD_BPF_SKEL := 0
> -  else ifeq ($(filter -DHAVE_LIBELF_SUPPORT, $(CFLAGS)),)
> +  ifeq ($(filter -DHAVE_LIBELF_SUPPORT, $(CFLAGS)),)
>      dummy := $(warning Warning: Disabled BPF skeletons as libelf is required by bpftool)
>      BUILD_BPF_SKEL := 0
>    else ifeq ($(filter -DHAVE_ZLIB_SUPPORT, $(CFLAGS)),)
>      dummy := $(warning Warning: Disabled BPF skeletons as zlib is required by bpftool)
>      BUILD_BPF_SKEL := 0
> +  else ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
> +    dummy := $(warning Warning: Disabled BPF skeletons as libbpf is required)
> +    BUILD_BPF_SKEL := 0
>    else ifeq ($(call get-executable,$(CLANG)),)
>      dummy := $(warning Warning: Disabled BPF skeletons as clang ($(CLANG)) is missing)
>      BUILD_BPF_SKEL := 0
> --
> 2.41.0
>
  

Patch

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index b3e6ed10f40c6f6c..8b6cffbc485834c8 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -680,15 +680,15 @@  ifndef BUILD_BPF_SKEL
 endif
 
 ifeq ($(BUILD_BPF_SKEL),1)
-  ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
-    dummy := $(warning Warning: Disabled BPF skeletons as libbpf is required)
-    BUILD_BPF_SKEL := 0
-  else ifeq ($(filter -DHAVE_LIBELF_SUPPORT, $(CFLAGS)),)
+  ifeq ($(filter -DHAVE_LIBELF_SUPPORT, $(CFLAGS)),)
     dummy := $(warning Warning: Disabled BPF skeletons as libelf is required by bpftool)
     BUILD_BPF_SKEL := 0
   else ifeq ($(filter -DHAVE_ZLIB_SUPPORT, $(CFLAGS)),)
     dummy := $(warning Warning: Disabled BPF skeletons as zlib is required by bpftool)
     BUILD_BPF_SKEL := 0
+  else ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
+    dummy := $(warning Warning: Disabled BPF skeletons as libbpf is required)
+    BUILD_BPF_SKEL := 0
   else ifeq ($(call get-executable,$(CLANG)),)
     dummy := $(warning Warning: Disabled BPF skeletons as clang ($(CLANG)) is missing)
     BUILD_BPF_SKEL := 0