[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zn8G9gyvo98AT8ni@google.com>
Date: Fri, 28 Jun 2024 11:54:46 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Guilherme Amadio <amadio@...too.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 1/2] perf build: conditionally add feature check flags
for libtrace{event,fs}
Hello,
On Fri, Jun 28, 2024 at 03:06:32PM +0200, Guilherme Amadio wrote:
> Hi Arnaldo,
>
> On Thu, Jun 27, 2024 at 05:06:05PM +0200, Guilherme Amadio wrote:
> > This avoids reported warnings when the packages are not installed.
> >
> > Fixes: 0f0e1f44569061e3dc590cd0b8cb74d8fd53706b
> > Signed-off-by: Guilherme Amadio <amadio@...too.org>
> > ---
> > tools/perf/Makefile.config | 19 +++++++++++--------
> > 1 file changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 81f73f68d256..987b48f242d3 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -182,14 +182,6 @@ 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)
> > -
> > 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
> > @@ -211,6 +203,17 @@ 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)
> > + else
> > + ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent),0)
>
> There is a problem here which I noticed while working on the fix for
> the problem reported by Thorsten (in tools/verification/rv). We need
>
> - ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent),0)
> + ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
>
> to produce a 0 in the output, otherwise it doesn't work. I will send a v2 fixing this.
Yeah, I've noticed this too.
>
> For the feature checks that depend on using FEATURE_CHECK_* like the ones below,
> it looks like the best would be to find a good common place to do it instead of
> redeclaring these required flags on various subdirectories. I thought about
> doing that in tools/build/Makefile.feature, but since these flags depend on
> using $(PKG_CONFIG), and that is also set in various places, I thought I'd ask
> first before going ahead. The idea I have is to gather somewhere the packages
> that are used via their .pc files, and set the appropriate FEATURE_CHECK_* flags
> such that all subdirectories could get them automatically. That may require setting
> PKG_CONFIG in a common place as well, and then dropping it from places such as
> tools/perf/Makefile.perf. Maybe something like this is Makefile.feature:
>
> PKG_CONFIG = $(CROSS_COMPILE)pkg-config
>
> ifneq ($(call get-executable,$(PKG_CONFIG)),)
> # libtraceevent
> ifeq ($(shell $(PKG_CONFIG) --exists libtraceevent 2>&1 1>/dev/null; echo $$?),0)
> FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent 2>/dev/null)
> FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent 2>/dev/null)
> endif
>
> # libtracefs
> 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
>
> # ... other packages
> endif
>
> and this shows that we could also define a function for this, and call it for
> each package, which would simplify things a bit more. These are the Makefiles
> that need to be adjusted:
>
> tools/perf/Makefile.config
> tools/tracing/latency/Makefile.config
> tools/tracing/rtla/Makefile.config
> tools/verification/rv/Makefile.config
Sounds like a good idea. It'd be great if we could remove the
duplication and share the common code for this.
Thanks,
Namhyung
>
> > + # 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),0)
> > + FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
> > + FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
> > + endif
> > endif
> > endif
> >
> > --
> > 2.45.2
> >
Powered by blists - more mailing lists