linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] tools build: Remove leftover libcap tests that prevents fast path feature detection from working
@ 2024-08-28 22:11 Arnaldo Carvalho de Melo
  2024-08-29  6:32 ` Ian Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-08-28 22:11 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Adrian Hunter, Jiri Olsa, Kan Liang, Namhyung Kim,
	Linux Kernel Mailing List, linux-perf-users

I noticed that the fast path feature detection was failing:

  $ cat /tmp/build/perf-tools-next/feature/test-all.make.output
  /usr/bin/ld: cannot find -lcap: No such file or directory
  collect2: error: ld returned 1 exit status
  $

The patch removing the dependency (Fixes tag below) didn't remove the
detection of libcap, and as the fast path feature detection (test-all.c)
had -lcap in its Makefile link list of libraries to link, it was failing
when libcap-devel is not available, fix it by removing those leftover
files.

Fixes: e25ebda78e230283 ("perf cap: Tidy up and improve capability testing")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/build/feature/Makefile      |  6 +-----
 tools/build/feature/test-libcap.c | 20 --------------------
 2 files changed, 1 insertion(+), 25 deletions(-)
 delete mode 100644 tools/build/feature/test-libcap.c

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 12796808f07a8c0d..b873fc58804e2f38 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -25,7 +25,6 @@ FILES=                                          \
          test-libbfd-liberty-z.bin              \
          test-cplus-demangle.bin                \
          test-cxa-demangle.bin                  \
-         test-libcap.bin			\
          test-libelf.bin                        \
          test-libelf-getphdrnum.bin             \
          test-libelf-gelf_getnote.bin           \
@@ -112,7 +111,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
@@ -140,9 +139,6 @@ $(OUTPUT)test-fortify-source.bin:
 $(OUTPUT)test-bionic.bin:
 	$(BUILD)
 
-$(OUTPUT)test-libcap.bin:
-	$(BUILD) -lcap
-
 $(OUTPUT)test-libelf.bin:
 	$(BUILD) -lelf
 
diff --git a/tools/build/feature/test-libcap.c b/tools/build/feature/test-libcap.c
deleted file mode 100644
index d2a2e152195f976b..0000000000000000
--- a/tools/build/feature/test-libcap.c
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <sys/capability.h>
-#include <linux/capability.h>
-
-int main(void)
-{
-	cap_flag_value_t val;
-	cap_t caps = cap_get_proc();
-
-	if (!caps)
-		return 1;
-
-	if (cap_get_flag(caps, CAP_SYS_ADMIN, CAP_EFFECTIVE, &val) != 0)
-		return 1;
-
-	if (cap_free(caps) != 0)
-		return 1;
-
-	return 0;
-}
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] tools build: Remove leftover libcap tests that prevents fast path feature detection from working
  2024-08-28 22:11 [PATCH 1/1] tools build: Remove leftover libcap tests that prevents fast path feature detection from working Arnaldo Carvalho de Melo
@ 2024-08-29  6:32 ` Ian Rogers
  2024-08-29 14:54   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2024-08-29  6:32 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Adrian Hunter, Jiri Olsa, Kan Liang, Namhyung Kim,
	Linux Kernel Mailing List, linux-perf-users

On Wed, Aug 28, 2024 at 3:11 PM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> I noticed that the fast path feature detection was failing:
>
>   $ cat /tmp/build/perf-tools-next/feature/test-all.make.output
>   /usr/bin/ld: cannot find -lcap: No such file or directory
>   collect2: error: ld returned 1 exit status
>   $
>
> The patch removing the dependency (Fixes tag below) didn't remove the
> detection of libcap, and as the fast path feature detection (test-all.c)
> had -lcap in its Makefile link list of libraries to link, it was failing
> when libcap-devel is not available, fix it by removing those leftover
> files.

Isn't the feature test still in use by bpftool:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/bpf/bpftool/Makefile?h=perf-tools-next#n103
I'd deliberately not followed up in removing it because of this.

Thanks,
Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] tools build: Remove leftover libcap tests that prevents fast path feature detection from working
  2024-08-29  6:32 ` Ian Rogers
@ 2024-08-29 14:54   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-08-29 14:54 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Adrian Hunter, Jiri Olsa, Kan Liang, Namhyung Kim,
	Linux Kernel Mailing List, linux-perf-users

On Wed, Aug 28, 2024 at 11:32:06PM -0700, Ian Rogers wrote:
> On Wed, Aug 28, 2024 at 3:11 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > I noticed that the fast path feature detection was failing:

> >   $ cat /tmp/build/perf-tools-next/feature/test-all.make.output
> >   /usr/bin/ld: cannot find -lcap: No such file or directory
> >   collect2: error: ld returned 1 exit status
> >   $

> > The patch removing the dependency (Fixes tag below) didn't remove the
> > detection of libcap, and as the fast path feature detection (test-all.c)
> > had -lcap in its Makefile link list of libraries to link, it was failing
> > when libcap-devel is not available, fix it by removing those leftover
> > files.

> Isn't the feature test still in use by bpftool:
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/bpf/bpftool/Makefile?h=perf-tools-next#n103
> I'd deliberately not followed up in removing it because of this.

Right, I just reverted that patch, documenting in the revert text that
bpftool uses it, etc.

Thanks a lot!

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-29 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28 22:11 [PATCH 1/1] tools build: Remove leftover libcap tests that prevents fast path feature detection from working Arnaldo Carvalho de Melo
2024-08-29  6:32 ` Ian Rogers
2024-08-29 14:54   ` Arnaldo Carvalho de Melo

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).