linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] perf: Drop requirement for libstdc++.so for libopencsd check
@ 2021-12-03 21:05 Uwe Kleine-König
  2021-12-06 10:14 ` James Clark
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2021-12-03 21:05 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, Diederik de Haas, James Clark, Branislav Rankov,
	Adrian Bunk

It's possible to link against libopencsd_c_api without having
libstdc++.so available, only libstdc++.so.6.0.28 (or whatever version is
in use) needs to be available. The same holds true for libopencsd.so.
When -lstdc++ (or -lopencsd) is explicitly passed to the linker however
the .so file must be available.

So wrap adding the dependencies into a check for static linking that
actually requires adding them all. The same construct is already used
for some other tests in the same file to reduce dependencies in the
dynamic linking case.

Fixes: 573cf5c9a152 ("perf build: Add missing -lstdc++ when linking with libopencsd")
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
 tools/perf/Makefile.config | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index afd144725a0b..3311fa321754 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -143,7 +143,10 @@ FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto
 ifdef CSINCLUDES
   LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
 endif
-OPENCSDLIBS := -lopencsd_c_api -lopencsd -lstdc++
+OPENCSDLIBS := -lopencsd_c_api
+ifeq ($(findstring -static,${LDFLAGS}),-static)
+  OPENCSDLIBS += -lopencsd -lstdc++
+endif
 ifdef CSLIBS
   LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
 endif
-- 
2.30.2


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

* Re: [PATCH v2] perf: Drop requirement for libstdc++.so for libopencsd check
  2021-12-03 21:05 [PATCH v2] perf: Drop requirement for libstdc++.so for libopencsd check Uwe Kleine-König
@ 2021-12-06 10:14 ` James Clark
  2021-12-06 20:10   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: James Clark @ 2021-12-06 10:14 UTC (permalink / raw)
  To: Uwe Kleine-König, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, Diederik de Haas, Branislav Rankov, Adrian Bunk



On 03/12/2021 21:05, Uwe Kleine-König wrote:
> It's possible to link against libopencsd_c_api without having
> libstdc++.so available, only libstdc++.so.6.0.28 (or whatever version is
> in use) needs to be available. The same holds true for libopencsd.so.
> When -lstdc++ (or -lopencsd) is explicitly passed to the linker however
> the .so file must be available.
> 
> So wrap adding the dependencies into a check for static linking that
> actually requires adding them all. The same construct is already used
> for some other tests in the same file to reduce dependencies in the
> dynamic linking case.
> 
> Fixes: 573cf5c9a152 ("perf build: Add missing -lstdc++ when linking with libopencsd")
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>

Reviewed-by: James Clark <james.clark@arm.com>

Thanks!
> ---
>  tools/perf/Makefile.config | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index afd144725a0b..3311fa321754 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -143,7 +143,10 @@ FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto
>  ifdef CSINCLUDES
>    LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
>  endif
> -OPENCSDLIBS := -lopencsd_c_api -lopencsd -lstdc++
> +OPENCSDLIBS := -lopencsd_c_api
> +ifeq ($(findstring -static,${LDFLAGS}),-static)
> +  OPENCSDLIBS += -lopencsd -lstdc++
> +endif
>  ifdef CSLIBS
>    LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
>  endif
> 

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

* Re: [PATCH v2] perf: Drop requirement for libstdc++.so for libopencsd check
  2021-12-06 10:14 ` James Clark
@ 2021-12-06 20:10   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-12-06 20:10 UTC (permalink / raw)
  To: James Clark
  Cc: Uwe Kleine-König, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, linux-perf-users,
	Diederik de Haas, Branislav Rankov, Adrian Bunk

Em Mon, Dec 06, 2021 at 10:14:57AM +0000, James Clark escreveu:
> 
> 
> On 03/12/2021 21:05, Uwe Kleine-König wrote:
> > It's possible to link against libopencsd_c_api without having
> > libstdc++.so available, only libstdc++.so.6.0.28 (or whatever version is
> > in use) needs to be available. The same holds true for libopencsd.so.
> > When -lstdc++ (or -lopencsd) is explicitly passed to the linker however
> > the .so file must be available.
> > 
> > So wrap adding the dependencies into a check for static linking that
> > actually requires adding them all. The same construct is already used
> > for some other tests in the same file to reduce dependencies in the
> > dynamic linking case.
> > 
> > Fixes: 573cf5c9a152 ("perf build: Add missing -lstdc++ when linking with libopencsd")
> > Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> 
> Reviewed-by: James Clark <james.clark@arm.com>

Thanks, applied.

- Arnaldo


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

end of thread, other threads:[~2021-12-06 20:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-03 21:05 [PATCH v2] perf: Drop requirement for libstdc++.so for libopencsd check Uwe Kleine-König
2021-12-06 10:14 ` James Clark
2021-12-06 20:10   ` 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).