linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/build: fix broken dependency check for libtracefs
@ 2023-07-11 12:40 Thomas Richter
  2023-07-11 13:06 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2023-07-11 12:40 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, jolsa, rostedt
  Cc: svens, gor, sumanthk, hca, Thomas Richter

Perf build auto-detects features and packages already installed
for its build. This is done in directory tools/build/feature. This
directory contains small sample programs. When they successfully
compile the necessary prereqs in form of libraries and header
files are present.

Such a check is also done for libtracefs. And this check fails:

Output before:
 # rm -f test-libtracefs.bin; make test-libtracefs.bin
 gcc  -MD -Wall -Werror -o test-libtracefs.bin test-libtracefs.c \
	 > test-libtracefs.make.output 2>&1 -ltracefs
 make: *** [Makefile:211: test-libtracefs.bin] Error 1
 # cat test-libtracefs.make.output
 In file included from test-libtracefs.c:2:
 /usr/include/tracefs/tracefs.h:11:10: fatal error: \
	 event-parse.h: No such file or directory
   11 | #include <event-parse.h>
      |          ^~~~~~~~~~~~~~~
 compilation terminated.
 #

The root cause of this compile error is
commit 880885d9c22e ("libtracefs: Remove "traceevent/" from referencing libtraceevent headers")
in the libtracefs project hosted here:
 https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/

That mentioned patch removes the traceevent/ directory name from
the include statement, causing the file not to be included even
when the libtraceevent-devel package is installed. This package contains
the file referred to in tracefs/tracefs.h:
 # rpm -ql libtraceevent-devel
 /usr/include/traceevent
 /usr/include/traceevent/event-parse.h  <----- here
 /usr/include/traceevent/event-utils.h
 /usr/include/traceevent/kbuffer.h
 /usr/include/traceevent/trace-seq.h
 /usr/lib64/libtraceevent.so
 /usr/lib64/pkgconfig/libtraceevent.pc
 #

With this patch the compile succeeds.

Output after:
 # rm -f test-libtracefs.bin; make test-libtracefs.bin
 gcc  -MD -Wall -Werror -o test-libtracefs.bin test-libtracefs.c \
	 > test-libtracefs.make.output 2>&1 -I/usr/include/traceevent -ltracefs
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: jolsa@kernel.org
Cc: rostedt@goodmis.org
---
 tools/build/feature/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 0f0aa9b7d7b5..764b0234161f 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -208,7 +208,7 @@ $(OUTPUT)test-libtraceevent.bin:
 	$(BUILD) -ltraceevent
 
 $(OUTPUT)test-libtracefs.bin:
-	$(BUILD) -ltracefs
+	 $(BUILD) -I/usr/include/traceevent -ltracefs
 
 $(OUTPUT)test-libcrypto.bin:
 	$(BUILD) -lcrypto
-- 
2.41.0


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

* Re: [PATCH] perf/build: fix broken dependency check for libtracefs
  2023-07-11 12:40 [PATCH] perf/build: fix broken dependency check for libtracefs Thomas Richter
@ 2023-07-11 13:06 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-07-11 13:06 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-perf-users, jolsa, rostedt, svens, gor,
	sumanthk, hca

Em Tue, Jul 11, 2023 at 02:40:19PM +0200, Thomas Richter escreveu:
> Perf build auto-detects features and packages already installed
> for its build. This is done in directory tools/build/feature. This
> directory contains small sample programs. When they successfully
> compile the necessary prereqs in form of libraries and header
> files are present.
> 
> Such a check is also done for libtracefs. And this check fails:
> 
> Output before:
>  # rm -f test-libtracefs.bin; make test-libtracefs.bin
>  gcc  -MD -Wall -Werror -o test-libtracefs.bin test-libtracefs.c \
> 	 > test-libtracefs.make.output 2>&1 -ltracefs
>  make: *** [Makefile:211: test-libtracefs.bin] Error 1
>  # cat test-libtracefs.make.output
>  In file included from test-libtracefs.c:2:
>  /usr/include/tracefs/tracefs.h:11:10: fatal error: \
> 	 event-parse.h: No such file or directory
>    11 | #include <event-parse.h>
>       |          ^~~~~~~~~~~~~~~
>  compilation terminated.
>  #
> 
> The root cause of this compile error is
> commit 880885d9c22e ("libtracefs: Remove "traceevent/" from referencing libtraceevent headers")
> in the libtracefs project hosted here:
>  https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/
> 
> That mentioned patch removes the traceevent/ directory name from
> the include statement, causing the file not to be included even
> when the libtraceevent-devel package is installed. This package contains
> the file referred to in tracefs/tracefs.h:
>  # rpm -ql libtraceevent-devel
>  /usr/include/traceevent
>  /usr/include/traceevent/event-parse.h  <----- here
>  /usr/include/traceevent/event-utils.h
>  /usr/include/traceevent/kbuffer.h
>  /usr/include/traceevent/trace-seq.h
>  /usr/lib64/libtraceevent.so
>  /usr/lib64/pkgconfig/libtraceevent.pc

Ok, but since libtraceevent comes with a pkgconfig file, shouldn't we
use it instead?

Something like:

⬢[acme@toolbox perf-tools]$ pkgconf --cflags libtraceevent
-I/usr/include/traceevent

look for PKG_CONFIG in the perf makefiles, I see things like:

  FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)

etc.

- Arnaldo

>  #
> 
> With this patch the compile succeeds.
> 
> Output after:
>  # rm -f test-libtracefs.bin; make test-libtracefs.bin
>  gcc  -MD -Wall -Werror -o test-libtracefs.bin test-libtracefs.c \
> 	 > test-libtracefs.make.output 2>&1 -I/usr/include/traceevent -ltracefs
>  #
> 
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> Cc: jolsa@kernel.org
> Cc: rostedt@goodmis.org
> ---
>  tools/build/feature/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 0f0aa9b7d7b5..764b0234161f 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -208,7 +208,7 @@ $(OUTPUT)test-libtraceevent.bin:
>  	$(BUILD) -ltraceevent
>  
>  $(OUTPUT)test-libtracefs.bin:
> -	$(BUILD) -ltracefs
> +	 $(BUILD) -I/usr/include/traceevent -ltracefs
>  
>  $(OUTPUT)test-libcrypto.bin:
>  	$(BUILD) -lcrypto
> -- 
> 2.41.0
> 

-- 

- Arnaldo

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

end of thread, other threads:[~2023-07-11 13:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-11 12:40 [PATCH] perf/build: fix broken dependency check for libtracefs Thomas Richter
2023-07-11 13:06 ` 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).