* [PATCH v3 1/5] perf build: Warn if libtracefs is not found
2024-07-17 17:47 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Guilherme Amadio
@ 2024-07-17 17:47 ` Guilherme Amadio
2024-07-17 17:47 ` [PATCH v3 2/5] tools: Make pkg-config dependency checks usable by other tools Guilherme Amadio
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2024-07-17 17:47 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Steven Rostedt, Ian Rogers,
Thorsten Leemhuis, Leo Yan, linux-perf-users, linux-trace-devel,
linux-kernel
Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
---
tools/perf/Makefile.config | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index a4829b6532d8..44f010b9f562 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -1206,6 +1206,8 @@ ifneq ($(NO_LIBTRACEEVENT),1)
LIBTRACEFS_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEFS_VERSION)))
LIBTRACEFS_VERSION_CPP := $(shell expr $(LIBTRACEFS_VERSION_1) \* 255 \* 255 + $(LIBTRACEFS_VERSION_2) \* 255 + $(LIBTRACEFS_VERSION_3))
CFLAGS += -DLIBTRACEFS_VERSION=$(LIBTRACEFS_VERSION_CPP)
+ else
+ $(warning libtracefs is missing. Please install libtracefs-dev/libtracefs-devel)
endif
endif
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 2/5] tools: Make pkg-config dependency checks usable by other tools
2024-07-17 17:47 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Guilherme Amadio
2024-07-17 17:47 ` [PATCH v3 1/5] perf build: Warn if libtracefs is not found Guilherme Amadio
@ 2024-07-17 17:47 ` Guilherme Amadio
2024-07-17 17:47 ` [PATCH v3 3/5] tools/verification: Use pkg-config in lib_setup of Makefile.config Guilherme Amadio
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2024-07-17 17:47 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Steven Rostedt, Ian Rogers,
Thorsten Leemhuis, Leo Yan, linux-perf-users, linux-trace-devel,
linux-kernel
Other tools, in tools/verification and tools/tracing, make use of
libtraceevent and libtracefs as dependencies. This allows setting
up the feature check flags for them as well.
Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
---
tools/build/Makefile.feature | 18 ++++++++++++++++++
tools/perf/Makefile.config | 11 +++--------
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 1e2ab148d5db..e1900abd44f6 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -149,6 +149,24 @@ FEATURE_DISPLAY ?= \
#
FEATURE_GROUP_MEMBERS-libbfd = libbfd-liberty libbfd-liberty-z
+#
+# Declare list of feature dependency packages that provide pkg-config files.
+#
+FEATURE_PKG_CONFIG ?= \
+ libtraceevent \
+ libtracefs
+
+feature_pkg_config = $(eval $(feature_pkg_config_code))
+define feature_pkg_config_code
+ FEATURE_CHECK_CFLAGS-$(1) := $(shell $(PKG_CONFIG) --cflags $(1) 2>/dev/null)
+ FEATURE_CHECK_LDFLAGS-$(1) := $(shell $(PKG_CONFIG) --libs $(1) 2>/dev/null)
+endef
+
+# Set FEATURE_CHECK_(C|LD)FLAGS-$(package) for packages using pkg-config.
+ifneq ($(PKG_CONFIG),)
+ $(foreach package,$(FEATURE_PKG_CONFIG),$(call feature_pkg_config,$(package)))
+endif
+
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
# If in the future we need per-feature checks/flags for features not
# mentioned in this list we need to refactor this ;-).
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 44f010b9f562..c896babf7a74 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -182,20 +182,15 @@ endif
FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS)
FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS)
+# for linking with debug library, run like:
+# make DEBUG=1 PKG_CONFIG_PATH=/opt/libtraceevent/(lib|lib64)/pkgconfig
+
ifneq ($(NO_LIBTRACEEVENT),1)
ifeq ($(call get-executable,$(PKG_CONFIG)),)
$(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
endif
endif
-# for linking with debug library, run like:
-# make DEBUG=1 PKG_CONFIG_PATH=/opt/libtraceevent/(lib|lib64)/pkgconfig
-FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent 2>/dev/null)
-FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent 2>/dev/null)
-
-FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs 2>/dev/null)
-FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs 2>/dev/null)
-
FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi
# include ARCH specific config
-include $(src-perf)/arch/$(SRCARCH)/Makefile
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 3/5] tools/verification: Use pkg-config in lib_setup of Makefile.config
2024-07-17 17:47 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Guilherme Amadio
2024-07-17 17:47 ` [PATCH v3 1/5] perf build: Warn if libtracefs is not found Guilherme Amadio
2024-07-17 17:47 ` [PATCH v3 2/5] tools: Make pkg-config dependency checks usable by other tools Guilherme Amadio
@ 2024-07-17 17:47 ` Guilherme Amadio
2024-07-17 17:47 ` [PATCH v3 4/5] tools/rtla: " Guilherme Amadio
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2024-07-17 17:47 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Steven Rostedt, Ian Rogers,
Thorsten Leemhuis, Leo Yan, linux-perf-users, linux-trace-devel,
linux-kernel
This allows to build against libtraceevent and libtracefs installed
in non-standard locations.
Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
---
tools/verification/rv/Makefile.config | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/verification/rv/Makefile.config b/tools/verification/rv/Makefile.config
index 6d4ba77847b6..066302230eb2 100644
--- a/tools/verification/rv/Makefile.config
+++ b/tools/verification/rv/Makefile.config
@@ -7,7 +7,8 @@ LIBTRACEFS_MIN_VERSION = 1.3
define lib_setup
$(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)"))
- $(eval EXTLIBS += -l$(1))
+ $(eval LDFLAGS += $(shell sh -c "$(PKG_CONFIG) --libs-only-L lib$(1)"))
+ $(eval EXTLIBS += $(shell sh -c "$(PKG_CONFIG) --libs-only-l lib$(1)"))
endef
$(call feature_check,libtraceevent)
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 4/5] tools/rtla: Use pkg-config in lib_setup of Makefile.config
2024-07-17 17:47 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Guilherme Amadio
` (2 preceding siblings ...)
2024-07-17 17:47 ` [PATCH v3 3/5] tools/verification: Use pkg-config in lib_setup of Makefile.config Guilherme Amadio
@ 2024-07-17 17:47 ` Guilherme Amadio
2024-07-17 17:47 ` [PATCH v3 5/5] tools/latency: " Guilherme Amadio
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2024-07-17 17:47 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Steven Rostedt, Ian Rogers,
Thorsten Leemhuis, Leo Yan, linux-perf-users, linux-trace-devel,
linux-kernel
This allows to build against libtraceevent and libtracefs installed
in non-standard locations.
Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
---
tools/tracing/rtla/Makefile.config | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/tracing/rtla/Makefile.config b/tools/tracing/rtla/Makefile.config
index 0b7ecfb30d19..5f8c286712d4 100644
--- a/tools/tracing/rtla/Makefile.config
+++ b/tools/tracing/rtla/Makefile.config
@@ -7,7 +7,8 @@ LIBTRACEFS_MIN_VERSION = 1.6
define lib_setup
$(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)"))
- $(eval EXTLIBS += -l$(1))
+ $(eval LDFLAGS += $(shell sh -c "$(PKG_CONFIG) --libs-only-L lib$(1)"))
+ $(eval EXTLIBS += $(shell sh -c "$(PKG_CONFIG) --libs-only-l lib$(1)"))
endef
$(call feature_check,libtraceevent)
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 5/5] tools/latency: Use pkg-config in lib_setup of Makefile.config
2024-07-17 17:47 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Guilherme Amadio
` (3 preceding siblings ...)
2024-07-17 17:47 ` [PATCH v3 4/5] tools/rtla: " Guilherme Amadio
@ 2024-07-17 17:47 ` Guilherme Amadio
2024-07-17 17:57 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Steven Rostedt
2024-07-17 19:47 ` Leo Yan
6 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2024-07-17 17:47 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Steven Rostedt, Ian Rogers,
Thorsten Leemhuis, Leo Yan, linux-perf-users, linux-trace-devel,
linux-kernel
This allows to build against libtraceevent and libtracefs installed
in non-standard locations.
Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
---
tools/tracing/latency/Makefile.config | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/tracing/latency/Makefile.config b/tools/tracing/latency/Makefile.config
index b25e531a1f95..0fe6b50f029b 100644
--- a/tools/tracing/latency/Makefile.config
+++ b/tools/tracing/latency/Makefile.config
@@ -3,8 +3,9 @@
STOP_ERROR :=
define lib_setup
- $(eval EXTLIBS += -l$(1))
$(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)"))
+ $(eval LDFLAGS += $(shell sh -c "$(PKG_CONFIG) --libs-only-L lib$(1)"))
+ $(eval EXTLIBS += $(shell sh -c "$(PKG_CONFIG) --libs-only-l lib$(1)"))
endef
$(call feature_check,libtraceevent)
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config
2024-07-17 17:47 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Guilherme Amadio
` (4 preceding siblings ...)
2024-07-17 17:47 ` [PATCH v3 5/5] tools/latency: " Guilherme Amadio
@ 2024-07-17 17:57 ` Steven Rostedt
2024-07-17 20:17 ` Namhyung Kim
2024-07-17 19:47 ` Leo Yan
6 siblings, 1 reply; 9+ messages in thread
From: Steven Rostedt @ 2024-07-17 17:57 UTC (permalink / raw)
To: Guilherme Amadio
Cc: Namhyung Kim, Arnaldo Carvalho de Melo, Ian Rogers,
Thorsten Leemhuis, Leo Yan, linux-perf-users, linux-trace-devel,
linux-kernel
On Wed, 17 Jul 2024 19:47:34 +0200
Guilherme Amadio <amadio@gentoo.org> wrote:
> There is no change in this new submission relative to the last (which has been
> tested by Thorsten to fix the build issue in Fedora). The only change has been
> to add in CC Steven Rostedt and the list linux-trace-devel@vger.kernel.org.
Thanks,
For the whole series:
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Feel free to take it through the perf tree.
-- Steve
>
> Best regards,
> -Guilherme
>
> Guilherme Amadio (5):
> perf build: Warn if libtracefs is not found
> tools: Make pkg-config dependency checks usable by other tools
> tools/verification: Use pkg-config in lib_setup of Makefile.config
> tools/rtla: Use pkg-config in lib_setup of Makefile.config
> tools/latency: Use pkg-config in lib_setup of Makefile.config
>
> tools/build/Makefile.feature | 18 ++++++++++++++++++
> tools/perf/Makefile.config | 13 +++++--------
> tools/tracing/latency/Makefile.config | 3 ++-
> tools/tracing/rtla/Makefile.config | 3 ++-
> tools/verification/rv/Makefile.config | 3 ++-
> 5 files changed, 29 insertions(+), 11 deletions(-)
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config
2024-07-17 17:57 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Steven Rostedt
@ 2024-07-17 20:17 ` Namhyung Kim
0 siblings, 0 replies; 9+ messages in thread
From: Namhyung Kim @ 2024-07-17 20:17 UTC (permalink / raw)
To: Steven Rostedt
Cc: Guilherme Amadio, Arnaldo Carvalho de Melo, Ian Rogers,
Thorsten Leemhuis, Leo Yan, linux-perf-users, linux-trace-devel,
linux-kernel
On Wed, Jul 17, 2024 at 10:58 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 17 Jul 2024 19:47:34 +0200
> Guilherme Amadio <amadio@gentoo.org> wrote:
>
> > There is no change in this new submission relative to the last (which has been
> > tested by Thorsten to fix the build issue in Fedora). The only change has been
> > to add in CC Steven Rostedt and the list linux-trace-devel@vger.kernel.org.
>
> Thanks,
>
> For the whole series:
>
> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>
> Feel free to take it through the perf tree.
Thanks, I'll add it to perf-tools and send out to v6.11 later.
Namhyung
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config
2024-07-17 17:47 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Guilherme Amadio
` (5 preceding siblings ...)
2024-07-17 17:57 ` [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config Steven Rostedt
@ 2024-07-17 19:47 ` Leo Yan
6 siblings, 0 replies; 9+ messages in thread
From: Leo Yan @ 2024-07-17 19:47 UTC (permalink / raw)
To: Guilherme Amadio, Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Steven Rostedt, Ian Rogers,
Thorsten Leemhuis, linux-perf-users, linux-trace-devel,
linux-kernel
On 7/17/2024 6:47 PM, Guilherme Amadio wrote:
>
> This patch series is a continuation of recent work to use pkg-config for feature
> checks for libtraceevent and libtracefs.
Tested this series for building x86_64 target and cross building aarch64 target:
Tested-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread