[PATCH 2/2] tools build feature: Don't set feature-libcap=1 if libcap-devel isn't available

Arnaldo Carvalho de Melo posted 2 patches 1 year ago
[PATCH 2/2] tools build feature: Don't set feature-libcap=1 if libcap-devel isn't available
Posted by Arnaldo Carvalho de Melo 1 year ago
From: Arnaldo Carvalho de Melo <acme@redhat.com>

libcap isn't tested in the tools/build/feature/test-all.c fast path
feature detection process, so don't set it as available if test-all
manages to build.

There are other users of this feature detection mechanism, and they
explicitely ask for libcap to be tested, so are not affected by this
patch, for instance, with this patch in place:

  $ make -C tools/bpf/bpftool/ clean
  <SNIP>
  make: Leaving directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
  ⬢ [acme@toolbox perf-tools-next]$ make -C tools/bpf/bpftool/
  make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'

  Auto-detecting system features:
  ...                         clang-bpf-co-re: [ on  ]
  ...                                    llvm: [ on  ]
  ...                                  libcap: [ on  ]
  ...                                  libbfd: [ on  ]
  ...                             libelf-zstd: [ on  ]
  <SNIP>
    LINK    bpftool
  make: Leaving directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
  $
  $ sudo rpm -e libcap-devel
  $ make -C tools/bpf/bpftool/
  <SNIP>
  make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'

  Auto-detecting system features:
  ...                         clang-bpf-co-re: [ on  ]
  ...                                    llvm: [ on  ]
  ...                                  libcap: [ OFF ]
  ...                                  libbfd: [ on  ]
  ...                             libelf-zstd: [ on  ]

  $

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Quentin Monnet <qmo@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/build/Makefile.feature | 2 --
 tools/build/feature/Makefile | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 52600e4d33af8712..e25cdb7db40e3f3d 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -73,7 +73,6 @@ FEATURE_TESTS_BASIC :=                  \
         glibc                           \
         libbfd                          \
         libbfd-buildid			\
-        libcap                          \
         libelf                          \
         libelf-getphdrnum               \
         libelf-gelf_getnote             \
@@ -150,7 +149,6 @@ FEATURE_DISPLAY ?=              \
          glibc                  \
          libbfd                 \
          libbfd-buildid		\
-         libcap                 \
          libelf                 \
          libnuma                \
          numa_num_possible_cpus \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 043dfd00fce72d8f..cbf751b6f0f76225 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -110,7 +110,7 @@ all: $(FILES)
 __BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
   BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
   BUILD_BFD = $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
-  BUILD_ALL = $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd -lcap
+  BUILD_ALL = $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd
 
 __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
   BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
-- 
2.47.0

Re: [PATCH 2/2] tools build feature: Don't set feature-libcap=1 if libcap-devel isn't available
Posted by Ian Rogers 1 year ago
On Wed, Dec 11, 2024 at 2:45 PM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> libcap isn't tested in the tools/build/feature/test-all.c fast path
> feature detection process, so don't set it as available if test-all
> manages to build.
>
> There are other users of this feature detection mechanism, and they
> explicitely ask for libcap to be tested, so are not affected by this
> patch, for instance, with this patch in place:
>
>   $ make -C tools/bpf/bpftool/ clean
>   <SNIP>
>   make: Leaving directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
>   ⬢ [acme@toolbox perf-tools-next]$ make -C tools/bpf/bpftool/
>   make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
>
>   Auto-detecting system features:
>   ...                         clang-bpf-co-re: [ on  ]
>   ...                                    llvm: [ on  ]
>   ...                                  libcap: [ on  ]
>   ...                                  libbfd: [ on  ]
>   ...                             libelf-zstd: [ on  ]
>   <SNIP>
>     LINK    bpftool
>   make: Leaving directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
>   $
>   $ sudo rpm -e libcap-devel
>   $ make -C tools/bpf/bpftool/
>   <SNIP>
>   make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
>
>   Auto-detecting system features:
>   ...                         clang-bpf-co-re: [ on  ]
>   ...                                    llvm: [ on  ]
>   ...                                  libcap: [ OFF ]
>   ...                                  libbfd: [ on  ]
>   ...                             libelf-zstd: [ on  ]
>
>   $
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: James Clark <james.clark@linaro.org>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kan Liang <kan.liang@linux.intel.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Quentin Monnet <qmo@kernel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian
Re: [PATCH 2/2] tools build feature: Don't set feature-libcap=1 if libcap-devel isn't available
Posted by Quentin Monnet 1 year ago
2024-12-11 20:25 UTC-0800 ~ Ian Rogers <irogers@google.com>
> On Wed, Dec 11, 2024 at 2:45 PM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
>>
>> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>>
>> libcap isn't tested in the tools/build/feature/test-all.c fast path
>> feature detection process, so don't set it as available if test-all
>> manages to build.
>>
>> There are other users of this feature detection mechanism, and they
>> explicitely ask for libcap to be tested, so are not affected by this
>> patch, for instance, with this patch in place:
>>
>>   $ make -C tools/bpf/bpftool/ clean
>>   <SNIP>
>>   make: Leaving directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
>>   ⬢ [acme@toolbox perf-tools-next]$ make -C tools/bpf/bpftool/
>>   make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
>>
>>   Auto-detecting system features:
>>   ...                         clang-bpf-co-re: [ on  ]
>>   ...                                    llvm: [ on  ]
>>   ...                                  libcap: [ on  ]
>>   ...                                  libbfd: [ on  ]
>>   ...                             libelf-zstd: [ on  ]
>>   <SNIP>
>>     LINK    bpftool
>>   make: Leaving directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
>>   $
>>   $ sudo rpm -e libcap-devel
>>   $ make -C tools/bpf/bpftool/
>>   <SNIP>
>>   make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
>>
>>   Auto-detecting system features:
>>   ...                         clang-bpf-co-re: [ on  ]
>>   ...                                    llvm: [ on  ]
>>   ...                                  libcap: [ OFF ]
>>   ...                                  libbfd: [ on  ]
>>   ...                             libelf-zstd: [ on  ]
>>
>>   $
>>
>> Cc: Adrian Hunter <adrian.hunter@intel.com>
>> Cc: Ian Rogers <irogers@google.com>
>> Cc: James Clark <james.clark@linaro.org>
>> Cc: Jiri Olsa <jolsa@kernel.org>
>> Cc: Kan Liang <kan.liang@linux.intel.com>
>> Cc: Namhyung Kim <namhyung@kernel.org>
>> Cc: Quentin Monnet <qmo@kernel.org>
>> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>


Acked-by: Quentin Monnet <qmo@kernel.org>

Thanks Arnaldo for checking the bpftool build :)
Quentin
Re: [PATCH 2/2] tools build feature: Don't set feature-libcap=1 if libcap-devel isn't available
Posted by Arnaldo Carvalho de Melo 1 year ago
On Thu, Dec 12, 2024 at 10:16:38AM +0000, Quentin Monnet wrote:
> 2024-12-11 20:25 UTC-0800 ~ Ian Rogers <irogers@google.com>
> > On Wed, Dec 11, 2024 at 2:45 PM Arnaldo Carvalho de Melo
> > <acme@kernel.org> wrote:
> >>
> >> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> >>
> >> libcap isn't tested in the tools/build/feature/test-all.c fast path
> >> feature detection process, so don't set it as available if test-all
> >> manages to build.
> >>
> >> There are other users of this feature detection mechanism, and they
> >> explicitely ask for libcap to be tested, so are not affected by this
> >> patch, for instance, with this patch in place:
> >>
> >>   $ make -C tools/bpf/bpftool/ clean
> >>   <SNIP>
> >>   make: Leaving directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
> >>   ⬢ [acme@toolbox perf-tools-next]$ make -C tools/bpf/bpftool/
> >>   make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
> >>
> >>   Auto-detecting system features:
> >>   ...                         clang-bpf-co-re: [ on  ]
> >>   ...                                    llvm: [ on  ]
> >>   ...                                  libcap: [ on  ]
> >>   ...                                  libbfd: [ on  ]
> >>   ...                             libelf-zstd: [ on  ]
> >>   <SNIP>
> >>     LINK    bpftool
> >>   make: Leaving directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
> >>   $
> >>   $ sudo rpm -e libcap-devel
> >>   $ make -C tools/bpf/bpftool/
> >>   <SNIP>
> >>   make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool'
> >>
> >>   Auto-detecting system features:
> >>   ...                         clang-bpf-co-re: [ on  ]
> >>   ...                                    llvm: [ on  ]
> >>   ...                                  libcap: [ OFF ]
> >>   ...                                  libbfd: [ on  ]
> >>   ...                             libelf-zstd: [ on  ]
> >>
> >>   $
> >>
> >> Cc: Adrian Hunter <adrian.hunter@intel.com>
> >> Cc: Ian Rogers <irogers@google.com>
> >> Cc: James Clark <james.clark@linaro.org>
> >> Cc: Jiri Olsa <jolsa@kernel.org>
> >> Cc: Kan Liang <kan.liang@linux.intel.com>
> >> Cc: Namhyung Kim <namhyung@kernel.org>
> >> Cc: Quentin Monnet <qmo@kernel.org>
> >> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > 
> > Reviewed-by: Ian Rogers <irogers@google.com>
> 
> 
> Acked-by: Quentin Monnet <qmo@kernel.org>
> 
> Thanks Arnaldo for checking the bpftool build :)

Thanks! Added to the cset.

- Arnaldo