linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs}
       [not found] <20240628202608.3273329-1-amadio@gentoo.org>
@ 2024-06-28 20:34 ` Guilherme Amadio
  2024-06-28 20:34   ` [PATCH v2 2/6] perf build: Warn if libtracefs is not found Guilherme Amadio
                     ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Guilherme Amadio @ 2024-06-28 20:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List, Guilherme Amadio

This avoids reported warnings when the packages are not installed.

Fixes: 0f0e1f44569061e3dc590cd0b8cb74d8fd53706b
Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
---
 tools/perf/Makefile.config | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 5271a4c1d2b3..5387babb8f04 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -182,13 +182,21 @@ 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
-FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent)
-FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
-
-FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
-FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
+ifneq ($(NO_LIBTRACEEVENT),1)
+  ifeq ($(call get-executable,$(PKG_CONFIG)),)
+  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
+  endif
+endif
+ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
+  # 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)
+  FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
+endif
+ifeq ($(shell $(PKG_CONFIG) --exists libtracefs 2>&1 1>/dev/null; echo $$?),0)
+  FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
+  FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
+endif
 
 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
@@ -208,12 +216,6 @@ ifeq ($(call get-executable,$(BISON)),)
   $(error Error: $(BISON) is missing on this system, please install it)
 endif
 
-ifneq ($(NO_LIBTRACEEVENT),1)
-  ifeq ($(call get-executable,$(PKG_CONFIG)),)
-  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
-  endif
-endif
-
 ifneq ($(OUTPUT),)
   ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1)
     BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)=
-- 
2.45.2


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

* [PATCH v2 2/6] perf build: Warn if libtracefs is not found
  2024-06-28 20:34 ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Guilherme Amadio
@ 2024-06-28 20:34   ` Guilherme Amadio
  2024-06-28 20:34   ` [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools Guilherme Amadio
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Guilherme Amadio @ 2024-06-28 20:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List, Guilherme Amadio

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 5387babb8f04..ba51ecfca02b 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -1208,6 +1208,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.45.2


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

* [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools
  2024-06-28 20:34 ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Guilherme Amadio
  2024-06-28 20:34   ` [PATCH v2 2/6] perf build: Warn if libtracefs is not found Guilherme Amadio
@ 2024-06-28 20:34   ` Guilherme Amadio
  2024-07-02 23:40     ` Namhyung Kim
  2024-06-28 20:34   ` [PATCH v2 4/6] tools/verification: Use pkg-config in lib_setup of Makefile.config Guilherme Amadio
                     ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Guilherme Amadio @ 2024-06-28 20:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List, Guilherme Amadio

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 | 20 ++++++++++++++++++++
 tools/perf/Makefile.config   | 10 ----------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 1e2ab148d5db..79a03e034073 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -149,6 +149,26 @@ 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
+  ifeq ($(shell $(PKG_CONFIG) --exists $(1) 2>&1 1>/dev/null; echo $$?),0)
+    FEATURE_CHECK_CFLAGS-$(1) := $(shell $(PKG_CONFIG) --cflags $(1))
+    FEATURE_CHECK_LDFLAGS-$(1) := $(shell $(PKG_CONFIG) --libs $(1))
+  endif
+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 ba51ecfca02b..23f2b54d8ee6 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -187,16 +187,6 @@ ifneq ($(NO_LIBTRACEEVENT),1)
   dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
   endif
 endif
-ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
-  # 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)
-  FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
-endif
-ifeq ($(shell $(PKG_CONFIG) --exists libtracefs 2>&1 1>/dev/null; echo $$?),0)
-  FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
-  FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
-endif
 
 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
-- 
2.45.2


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

* [PATCH v2 4/6] tools/verification: Use pkg-config in lib_setup of Makefile.config
  2024-06-28 20:34 ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Guilherme Amadio
  2024-06-28 20:34   ` [PATCH v2 2/6] perf build: Warn if libtracefs is not found Guilherme Amadio
  2024-06-28 20:34   ` [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools Guilherme Amadio
@ 2024-06-28 20:34   ` Guilherme Amadio
  2024-06-28 20:34   ` [PATCH v2 5/6] tools/rtla: " Guilherme Amadio
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Guilherme Amadio @ 2024-06-28 20:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List, Guilherme Amadio

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


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

* [PATCH v2 5/6] tools/rtla: Use pkg-config in lib_setup of Makefile.config
  2024-06-28 20:34 ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Guilherme Amadio
                     ` (2 preceding siblings ...)
  2024-06-28 20:34   ` [PATCH v2 4/6] tools/verification: Use pkg-config in lib_setup of Makefile.config Guilherme Amadio
@ 2024-06-28 20:34   ` Guilherme Amadio
  2024-06-28 20:34   ` [PATCH v2 6/6] tools/latency: " Guilherme Amadio
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Guilherme Amadio @ 2024-06-28 20:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List, Guilherme Amadio

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


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

* [PATCH v2 6/6] tools/latency: Use pkg-config in lib_setup of Makefile.config
  2024-06-28 20:34 ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Guilherme Amadio
                     ` (3 preceding siblings ...)
  2024-06-28 20:34   ` [PATCH v2 5/6] tools/rtla: " Guilherme Amadio
@ 2024-06-28 20:34   ` Guilherme Amadio
  2024-07-02 23:33   ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Namhyung Kim
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Guilherme Amadio @ 2024-06-28 20:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List, Guilherme Amadio

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


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

* Re: [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs}
  2024-06-28 20:34 ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Guilherme Amadio
                     ` (4 preceding siblings ...)
  2024-06-28 20:34   ` [PATCH v2 6/6] tools/latency: " Guilherme Amadio
@ 2024-07-02 23:33   ` Namhyung Kim
  2024-07-03 12:35     ` Guilherme Amadio
  2024-07-08 12:32   ` Leo Yan
  2024-07-16 10:19   ` Thorsten Leemhuis
  7 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2024-07-02 23:33 UTC (permalink / raw)
  To: Guilherme Amadio
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List

Hello,

On Fri, Jun 28, 2024 at 10:34:27PM +0200, Guilherme Amadio wrote:
> This avoids reported warnings when the packages are not installed.
> 
> Fixes: 0f0e1f44569061e3dc590cd0b8cb74d8fd53706b
> Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

Thanks for working on this.

> ---
>  tools/perf/Makefile.config | 28 +++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 5271a4c1d2b3..5387babb8f04 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -182,13 +182,21 @@ 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
> -FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent)
> -FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> -
> -FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> -FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> +ifneq ($(NO_LIBTRACEEVENT),1)
> +  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> +  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)

I know you just copied the code, but IIRC we wanted to remove this dummy
assignment before.

> +  endif
> +endif
> +ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
> +  # 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)
> +  FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> +endif
> +ifeq ($(shell $(PKG_CONFIG) --exists libtracefs 2>&1 1>/dev/null; echo $$?),0)
> +  FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> +  FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)

I'm curious if we can redirect stderr to /dev/null to surpress the
output when pkg-config is not installed.  Then we don't need to check
the `ifeq`.

Thanks,
Namhyung


> +endif
>  
>  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
> @@ -208,12 +216,6 @@ ifeq ($(call get-executable,$(BISON)),)
>    $(error Error: $(BISON) is missing on this system, please install it)
>  endif
>  
> -ifneq ($(NO_LIBTRACEEVENT),1)
> -  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> -  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
> -  endif
> -endif
> -
>  ifneq ($(OUTPUT),)
>    ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1)
>      BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)=
> -- 
> 2.45.2
> 

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

* Re: [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools
  2024-06-28 20:34   ` [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools Guilherme Amadio
@ 2024-07-02 23:40     ` Namhyung Kim
  2024-07-03 19:36       ` Steven Rostedt
  0 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2024-07-02 23:40 UTC (permalink / raw)
  To: Guilherme Amadio
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List, Steven Rostedt,
	linux-trace-kernel

+CC Steve and linux-trace-kernel list.

Thanks,
Namhyung

On Fri, Jun 28, 2024 at 10:34:29PM +0200, Guilherme Amadio wrote:
> 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 | 20 ++++++++++++++++++++
>  tools/perf/Makefile.config   | 10 ----------
>  2 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index 1e2ab148d5db..79a03e034073 100644
> --- a/tools/build/Makefile.feature
> +++ b/tools/build/Makefile.feature
> @@ -149,6 +149,26 @@ 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
> +  ifeq ($(shell $(PKG_CONFIG) --exists $(1) 2>&1 1>/dev/null; echo $$?),0)
> +    FEATURE_CHECK_CFLAGS-$(1) := $(shell $(PKG_CONFIG) --cflags $(1))
> +    FEATURE_CHECK_LDFLAGS-$(1) := $(shell $(PKG_CONFIG) --libs $(1))
> +  endif
> +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 ba51ecfca02b..23f2b54d8ee6 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -187,16 +187,6 @@ ifneq ($(NO_LIBTRACEEVENT),1)
>    dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
>    endif
>  endif
> -ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
> -  # 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)
> -  FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> -endif
> -ifeq ($(shell $(PKG_CONFIG) --exists libtracefs 2>&1 1>/dev/null; echo $$?),0)
> -  FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> -  FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> -endif
>  
>  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
> -- 
> 2.45.2
> 

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

* Re: [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs}
  2024-07-02 23:33   ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Namhyung Kim
@ 2024-07-03 12:35     ` Guilherme Amadio
  2024-07-03 21:29       ` Namhyung Kim
  2024-07-11 22:08       ` Namhyung Kim
  0 siblings, 2 replies; 17+ messages in thread
From: Guilherme Amadio @ 2024-07-03 12:35 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List

Hello,

On Tue, Jul 02, 2024 at 04:33:27PM -0700, Namhyung Kim wrote:
> Hello,
> 
> On Fri, Jun 28, 2024 at 10:34:27PM +0200, Guilherme Amadio wrote:
> > This avoids reported warnings when the packages are not installed.
> > 
> > Fixes: 0f0e1f44569061e3dc590cd0b8cb74d8fd53706b
> > Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
> 
> Thanks for working on this.
> 
> > ---
> >  tools/perf/Makefile.config | 28 +++++++++++++++-------------
> >  1 file changed, 15 insertions(+), 13 deletions(-)
> > 
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 5271a4c1d2b3..5387babb8f04 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -182,13 +182,21 @@ 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
> > -FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent)
> > -FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> > -
> > -FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> > -FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> > +ifneq ($(NO_LIBTRACEEVENT),1)
> > +  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> > +  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
> 
> I know you just copied the code, but IIRC we wanted to remove this dummy
> assignment before.

Sure, I will change this. I think we can also remove the "dummy :=" part and
just do $(error Error: ...), like it's done in other places.

> > +  endif
> > +endif
> > +ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
> > +  # 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)
> > +  FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> > +endif
> > +ifeq ($(shell $(PKG_CONFIG) --exists libtracefs 2>&1 1>/dev/null; echo $$?),0)
> > +  FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> > +  FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> 
> I'm curious if we can redirect stderr to /dev/null to surpress the
> output when pkg-config is not installed.  Then we don't need to check
> the `ifeq`.

I was wondering that myself when I added the check, if you prefer to redirect
stderr to /dev/null, I will do it that way then when I submit v3.

Thanks for the review.

Best regards,
-Guilherme

> 
> Thanks,
> Namhyung
> 
> 
> > +endif
> >  
> >  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
> > @@ -208,12 +216,6 @@ ifeq ($(call get-executable,$(BISON)),)
> >    $(error Error: $(BISON) is missing on this system, please install it)
> >  endif
> >  
> > -ifneq ($(NO_LIBTRACEEVENT),1)
> > -  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> > -  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
> > -  endif
> > -endif
> > -
> >  ifneq ($(OUTPUT),)
> >    ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1)
> >      BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)=
> > -- 
> > 2.45.2
> > 

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

* Re: [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools
  2024-07-02 23:40     ` Namhyung Kim
@ 2024-07-03 19:36       ` Steven Rostedt
  2024-07-03 21:33         ` Namhyung Kim
  0 siblings, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2024-07-03 19:36 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Guilherme Amadio, Arnaldo Carvalho de Melo, Ian Rogers,
	Thorsten Leemhuis, Leo Yan, linux-perf-users,
	Linux Kernel Mailing List, linux-trace-kernel

On Tue, 2 Jul 2024 16:40:46 -0700
Namhyung Kim <namhyung@kernel.org> wrote:

> +CC Steve and linux-trace-kernel list.

There doesn't seem to be a cover page, and it doesn't apply on
v6.10-rc6 nor on tip.

-- Steve

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

* Re: [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs}
  2024-07-03 12:35     ` Guilherme Amadio
@ 2024-07-03 21:29       ` Namhyung Kim
  2024-07-11 22:08       ` Namhyung Kim
  1 sibling, 0 replies; 17+ messages in thread
From: Namhyung Kim @ 2024-07-03 21:29 UTC (permalink / raw)
  To: Guilherme Amadio
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List

On Wed, Jul 03, 2024 at 02:35:54PM +0200, Guilherme Amadio wrote:
> Hello,
> 
> On Tue, Jul 02, 2024 at 04:33:27PM -0700, Namhyung Kim wrote:
> > Hello,
> > 
> > On Fri, Jun 28, 2024 at 10:34:27PM +0200, Guilherme Amadio wrote:
> > > This avoids reported warnings when the packages are not installed.
> > > 
> > > Fixes: 0f0e1f44569061e3dc590cd0b8cb74d8fd53706b
> > > Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
> > 
> > Thanks for working on this.
> > 
> > > ---
> > >  tools/perf/Makefile.config | 28 +++++++++++++++-------------
> > >  1 file changed, 15 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > index 5271a4c1d2b3..5387babb8f04 100644
> > > --- a/tools/perf/Makefile.config
> > > +++ b/tools/perf/Makefile.config
> > > @@ -182,13 +182,21 @@ 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
> > > -FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent)
> > > -FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> > > -
> > > -FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> > > -FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> > > +ifneq ($(NO_LIBTRACEEVENT),1)
> > > +  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> > > +  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
> > 
> > I know you just copied the code, but IIRC we wanted to remove this dummy
> > assignment before.
> 
> Sure, I will change this. I think we can also remove the "dummy :=" part and
> just do $(error Error: ...), like it's done in other places.

Exactly.

> 
> > > +  endif
> > > +endif
> > > +ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
> > > +  # 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)
> > > +  FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> > > +endif
> > > +ifeq ($(shell $(PKG_CONFIG) --exists libtracefs 2>&1 1>/dev/null; echo $$?),0)
> > > +  FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> > > +  FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> > 
> > I'm curious if we can redirect stderr to /dev/null to surpress the
> > output when pkg-config is not installed.  Then we don't need to check
> > the `ifeq`.
> 
> I was wondering that myself when I added the check, if you prefer to redirect
> stderr to /dev/null, I will do it that way then when I submit v3.

Yep, let's have a fewer lines of changes.

> 
> Thanks for the review.

No problem and thanks for your contribution!

Thanks,
Namhyung

> > 
> > > +endif
> > >  
> > >  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
> > > @@ -208,12 +216,6 @@ ifeq ($(call get-executable,$(BISON)),)
> > >    $(error Error: $(BISON) is missing on this system, please install it)
> > >  endif
> > >  
> > > -ifneq ($(NO_LIBTRACEEVENT),1)
> > > -  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> > > -  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
> > > -  endif
> > > -endif
> > > -
> > >  ifneq ($(OUTPUT),)
> > >    ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1)
> > >      BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)=
> > > -- 
> > > 2.45.2
> > > 

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

* Re: [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools
  2024-07-03 19:36       ` Steven Rostedt
@ 2024-07-03 21:33         ` Namhyung Kim
  2024-07-03 23:05           ` Steven Rostedt
  0 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2024-07-03 21:33 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Guilherme Amadio, Arnaldo Carvalho de Melo, Ian Rogers,
	Thorsten Leemhuis, Leo Yan, linux-perf-users,
	Linux Kernel Mailing List, linux-trace-kernel

On Wed, Jul 03, 2024 at 03:36:17PM -0400, Steven Rostedt wrote:
> On Tue, 2 Jul 2024 16:40:46 -0700
> Namhyung Kim <namhyung@kernel.org> wrote:
> 
> > +CC Steve and linux-trace-kernel list.
> 
> There doesn't seem to be a cover page, and it doesn't apply on
> v6.10-rc6 nor on tip.

Oh, sorry.  You can find the whole series here.

https://lore.kernel.org/linux-perf-users/20240628203432.3273625-1-amadio@gentoo.org/#r

I think this is based on the perf-tools-next tree and depends on perf
changes.  If you're ok with the change, I can carry it in the perf tree.

Thanks,
Namhyung


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

* Re: [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools
  2024-07-03 21:33         ` Namhyung Kim
@ 2024-07-03 23:05           ` Steven Rostedt
  2024-07-04  1:45             ` Namhyung Kim
  0 siblings, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2024-07-03 23:05 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Guilherme Amadio, Arnaldo Carvalho de Melo, Ian Rogers,
	Thorsten Leemhuis, Leo Yan, linux-perf-users,
	Linux Kernel Mailing List, linux-trace-kernel

On Wed, 3 Jul 2024 14:33:21 -0700
Namhyung Kim <namhyung@kernel.org> wrote:

> On Wed, Jul 03, 2024 at 03:36:17PM -0400, Steven Rostedt wrote:
> > On Tue, 2 Jul 2024 16:40:46 -0700
> > Namhyung Kim <namhyung@kernel.org> wrote:
> >   
> > > +CC Steve and linux-trace-kernel list.  
> > 
> > There doesn't seem to be a cover page, and it doesn't apply on
> > v6.10-rc6 nor on tip.  
> 
> Oh, sorry.  You can find the whole series here.
> 
> https://lore.kernel.org/linux-perf-users/20240628203432.3273625-1-amadio@gentoo.org/#r
> 
> I think this is based on the perf-tools-next tree and depends on perf
> changes.  If you're ok with the change, I can carry it in the perf tree.
> 

Hmm, I checked out git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git
master branch, and it looks to contain just Linus's changes. Is there a specific branch?

-- Steve

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

* Re: [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools
  2024-07-03 23:05           ` Steven Rostedt
@ 2024-07-04  1:45             ` Namhyung Kim
  0 siblings, 0 replies; 17+ messages in thread
From: Namhyung Kim @ 2024-07-04  1:45 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Guilherme Amadio, Arnaldo Carvalho de Melo, Ian Rogers,
	Thorsten Leemhuis, Leo Yan, linux-perf-users,
	Linux Kernel Mailing List, linux-trace-kernel

On Wed, Jul 3, 2024 at 4:05 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 3 Jul 2024 14:33:21 -0700
> Namhyung Kim <namhyung@kernel.org> wrote:
>
> > On Wed, Jul 03, 2024 at 03:36:17PM -0400, Steven Rostedt wrote:
> > > On Tue, 2 Jul 2024 16:40:46 -0700
> > > Namhyung Kim <namhyung@kernel.org> wrote:
> > >
> > > > +CC Steve and linux-trace-kernel list.
> > >
> > > There doesn't seem to be a cover page, and it doesn't apply on
> > > v6.10-rc6 nor on tip.
> >
> > Oh, sorry.  You can find the whole series here.
> >
> > https://lore.kernel.org/linux-perf-users/20240628203432.3273625-1-amadio@gentoo.org/#r
> >
> > I think this is based on the perf-tools-next tree and depends on perf
> > changes.  If you're ok with the change, I can carry it in the perf tree.
> >
>
> Hmm, I checked out git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git
> master branch, and it looks to contain just Linus's changes. Is there a specific branch?

Yep, it's the same as tree: 'perf-tools-next'

Thanks,
Namhyung

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

* Re: [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs}
  2024-06-28 20:34 ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Guilherme Amadio
                     ` (5 preceding siblings ...)
  2024-07-02 23:33   ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Namhyung Kim
@ 2024-07-08 12:32   ` Leo Yan
  2024-07-16 10:19   ` Thorsten Leemhuis
  7 siblings, 0 replies; 17+ messages in thread
From: Leo Yan @ 2024-07-08 12:32 UTC (permalink / raw)
  To: Guilherme Amadio, Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ian Rogers, Thorsten Leemhuis, linux-perf-users,
	Linux Kernel Mailing List

Hi Guilherme,

On 6/28/24 21:34, Guilherme Amadio wrote:
> 
> This avoids reported warnings when the packages are not installed.
> 
> Fixes: 0f0e1f44569061e3dc590cd0b8cb74d8fd53706b
> Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
> ---
>   tools/perf/Makefile.config | 28 +++++++++++++++-------------
>   1 file changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 5271a4c1d2b3..5387babb8f04 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -182,13 +182,21 @@ 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
> -FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent)
> -FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> -
> -FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> -FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> +ifneq ($(NO_LIBTRACEEVENT),1)
> +  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> +  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
> +  endif
> +endif
> +ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
> +  # 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)
> +  FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> +endif
> +ifeq ($(shell $(PKG_CONFIG) --exists libtracefs 2>&1 1>/dev/null; echo $$?),0)
> +  FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> +  FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> +endif

Seems to me, the patch 03 uses a more neat way for appending CFLAGS and
LDFLAGS of libtraceevent and libtracefs, should not use the same code
in patch 01?

Thanks,
Leo

>   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
> @@ -208,12 +216,6 @@ ifeq ($(call get-executable,$(BISON)),)
>     $(error Error: $(BISON) is missing on this system, please install it)
>   endif
> 
> -ifneq ($(NO_LIBTRACEEVENT),1)
> -  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> -  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
> -  endif
> -endif
> -
>   ifneq ($(OUTPUT),)
>     ifeq ($(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 371), 1)
>       BISON_FILE_PREFIX_MAP := --file-prefix-map=$(OUTPUT)=
> --
> 2.45.2
> 

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

* Re: [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs}
  2024-07-03 12:35     ` Guilherme Amadio
  2024-07-03 21:29       ` Namhyung Kim
@ 2024-07-11 22:08       ` Namhyung Kim
  1 sibling, 0 replies; 17+ messages in thread
From: Namhyung Kim @ 2024-07-11 22:08 UTC (permalink / raw)
  To: Guilherme Amadio
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Thorsten Leemhuis, Leo Yan,
	linux-perf-users, Linux Kernel Mailing List

Hello,

On Wed, Jul 03, 2024 at 02:35:54PM +0200, Guilherme Amadio wrote:
> Hello,
> 
> On Tue, Jul 02, 2024 at 04:33:27PM -0700, Namhyung Kim wrote:
> > Hello,
> > 
> > On Fri, Jun 28, 2024 at 10:34:27PM +0200, Guilherme Amadio wrote:
> > > This avoids reported warnings when the packages are not installed.
> > > 
> > > Fixes: 0f0e1f44569061e3dc590cd0b8cb74d8fd53706b
> > > Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
> > 
> > Thanks for working on this.
> > 
> > > ---
> > >  tools/perf/Makefile.config | 28 +++++++++++++++-------------
> > >  1 file changed, 15 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > index 5271a4c1d2b3..5387babb8f04 100644
> > > --- a/tools/perf/Makefile.config
> > > +++ b/tools/perf/Makefile.config
> > > @@ -182,13 +182,21 @@ 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
> > > -FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent)
> > > -FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> > > -
> > > -FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> > > -FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> > > +ifneq ($(NO_LIBTRACEEVENT),1)
> > > +  ifeq ($(call get-executable,$(PKG_CONFIG)),)
> > > +  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
> > 
> > I know you just copied the code, but IIRC we wanted to remove this dummy
> > assignment before.
> 
> Sure, I will change this. I think we can also remove the "dummy :=" part and
> just do $(error Error: ...), like it's done in other places.
> 
> > > +  endif
> > > +endif
> > > +ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
> > > +  # 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)
> > > +  FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
> > > +endif
> > > +ifeq ($(shell $(PKG_CONFIG) --exists libtracefs 2>&1 1>/dev/null; echo $$?),0)
> > > +  FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> > > +  FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> > 
> > I'm curious if we can redirect stderr to /dev/null to surpress the
> > output when pkg-config is not installed.  Then we don't need to check
> > the `ifeq`.
> 
> I was wondering that myself when I added the check, if you prefer to redirect
> stderr to /dev/null, I will do it that way then when I submit v3.

Due to the timing of the merge window, I'll apply this patch (1/6 only)
with the following modification.  Please take a look and update v3.

Thanks,
Namhyung

---
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 5387babb8f04..a4829b6532d8 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -184,19 +184,17 @@ FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS)
 
 ifneq ($(NO_LIBTRACEEVENT),1)
   ifeq ($(call get-executable,$(PKG_CONFIG)),)
-  dummy := $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
+    $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it)
   endif
 endif
-ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
-  # 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)
-  FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent)
-endif
-ifeq ($(shell $(PKG_CONFIG) --exists libtracefs 2>&1 1>/dev/null; echo $$?),0)
-  FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
-  FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
-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


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

* Re: [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs}
  2024-06-28 20:34 ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Guilherme Amadio
                     ` (6 preceding siblings ...)
  2024-07-08 12:32   ` Leo Yan
@ 2024-07-16 10:19   ` Thorsten Leemhuis
  7 siblings, 0 replies; 17+ messages in thread
From: Thorsten Leemhuis @ 2024-07-16 10:19 UTC (permalink / raw)
  To: Guilherme Amadio, Namhyung Kim
  Cc: Ian Rogers, Leo Yan, linux-perf-users, Linux Kernel Mailing List,
	Arnaldo Carvalho de Melo

On 28.06.24 22:34, Guilherme Amadio wrote:
> This avoids reported warnings when the packages are not installed.
> 
> Fixes: 0f0e1f44569061e3dc590cd0b8cb74d8fd53706b
> Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
> ---
>  tools/perf/Makefile.config | 28 +++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
> [...]

So, Namhyung applied this. But TWIMC: by -next vanilla builds based on
the Fedora rawhide srpm still fails because libtracefs is not found,
when it fact it is installed. That afaics was what triggered this series
in the first place.

Here is the report:
https://lore.kernel.org/all/072d3965-7140-4f0b-bf9a-9d7edabbfde9@leemhuis.info/

Here is a failed build log from yesterday's -next:
https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-rawhide-x86_64/07732721-next-next-all/builder-live.log.gz

Ciao, Thorsten

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

end of thread, other threads:[~2024-07-16 10:19 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240628202608.3273329-1-amadio@gentoo.org>
2024-06-28 20:34 ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Guilherme Amadio
2024-06-28 20:34   ` [PATCH v2 2/6] perf build: Warn if libtracefs is not found Guilherme Amadio
2024-06-28 20:34   ` [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools Guilherme Amadio
2024-07-02 23:40     ` Namhyung Kim
2024-07-03 19:36       ` Steven Rostedt
2024-07-03 21:33         ` Namhyung Kim
2024-07-03 23:05           ` Steven Rostedt
2024-07-04  1:45             ` Namhyung Kim
2024-06-28 20:34   ` [PATCH v2 4/6] tools/verification: Use pkg-config in lib_setup of Makefile.config Guilherme Amadio
2024-06-28 20:34   ` [PATCH v2 5/6] tools/rtla: " Guilherme Amadio
2024-06-28 20:34   ` [PATCH v2 6/6] tools/latency: " Guilherme Amadio
2024-07-02 23:33   ` [PATCH v2 1/6] perf build: Conditionally add feature check flags for libtrace{event,fs} Namhyung Kim
2024-07-03 12:35     ` Guilherme Amadio
2024-07-03 21:29       ` Namhyung Kim
2024-07-11 22:08       ` Namhyung Kim
2024-07-08 12:32   ` Leo Yan
2024-07-16 10:19   ` Thorsten Leemhuis

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