From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: "Pandey, Radhey Shyam" <radhey.shyam.pandey@amd.com>
Cc: "James Clark" <james.clark@arm.com>,
"linux-perf-users@vger.kernel.org"
<linux-perf-users@vger.kernel.org>,
"coresight@lists.linaro.org" <coresight@lists.linaro.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Ian Rogers" <irogers@google.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Uwe Kleine-König" <uwe@kleine-koenig.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Sarangi, Anirudha" <anirudha.sarangi@amd.com>
Subject: Re: [PATCH] perf build: Fix library not found error when using CSLIBS
Date: Tue, 11 Jul 2023 11:46:28 -0300 [thread overview]
Message-ID: <ZK1rRFO3VagSybPT@kernel.org> (raw)
In-Reply-To: <MN0PR12MB5953B9D303746370D9E3AB98B731A@MN0PR12MB5953.namprd12.prod.outlook.com>
Em Tue, Jul 11, 2023 at 08:28:31AM +0000, Pandey, Radhey Shyam escreveu:
> > -----Original Message-----
> > From: James Clark <james.clark@arm.com>
> > Sent: Friday, July 7, 2023 9:16 PM
> > To: linux-perf-users@vger.kernel.org; Pandey, Radhey Shyam
> > <radhey.shyam.pandey@amd.com>
> > Cc: coresight@lists.linaro.org; James Clark <james.clark@arm.com>; Peter
> > Zijlstra <peterz@infradead.org>; Ingo Molnar <mingo@redhat.com>;
> > Arnaldo Carvalho de Melo <acme@kernel.org>; Mark Rutland
> > <mark.rutland@arm.com>; Alexander Shishkin
> > <alexander.shishkin@linux.intel.com>; Jiri Olsa <jolsa@kernel.org>;
> > Namhyung Kim <namhyung@kernel.org>; Ian Rogers <irogers@google.com>;
> > Adrian Hunter <adrian.hunter@intel.com>; Uwe Kleine-König <uwe@kleine-
> > koenig.org>; linux-kernel@vger.kernel.org
> > Subject: [PATCH] perf build: Fix library not found error when using CSLIBS
> >
> > -L only specifies the search path for libraries directly provided in the link line
> > with -l. Because -lopencsd isn't specified, it's only linked because it's a
> > dependency of -lopencsd_c_api. Dependencies like this are resolved using
> > the default system search paths or -rpath-link=... rather than -L. This means
> > that compilation only works if OpenCSD is installed to the system rather than
> > provided with the CSLIBS (-L) option.
> >
> > This could be fixed by adding -Wl,-rpath-link=$(CSLIBS) but that is less
> > conventional than just adding -lopencsd to the link line so that it uses -L. -
> > lopencsd seems to have been removed in commit ed17b1914978 ("perf
> > tools: Drop requirement for libstdc++.so for libopencsd check") because it
> > was thought that there was a chance compilation would work even if it didn't
> > exist, but I think that only applies to libstdc++ so there is no harm to add it
> > back. libopencsd.so and libopencsd_c_api.so would always exist together.
> >
> > Testing
> > =======
> >
> > The following scenarios now all work:
> >
> > * Cross build with OpenCSD installed
> > * Cross build using CSLIBS=...
> > * Native build with OpenCSD installed
> > * Native build using CSLIBS=...
> > * Static cross build with OpenCSD installed
> > * Static cross build with CSLIBS=...
> >
> > Reported-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> > Closes: https://lore.kernel.org/linux-arm-kernel/56905d7a-a91e-883a-b707-
> > 9d5f686ba5f1@arm.com/
> > Link: https://lore.kernel.org/all/36cc4dc6-bf4b-1093-1c0a-
> > 876e368af183@kleine-koenig.org/
> > Fixes: ed17b1914978 ("perf tools: Drop requirement for libstdc++.so for
> > libopencsd check")
> > Signed-off-by: James Clark <james.clark@arm.com>
> > ---
> > tools/perf/Makefile.config | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index
> > 0609c19caabd..c5db0de49868 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -155,9 +155,9 @@ FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto ifdef
> > CSINCLUDES
> > LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
> > endif
> > -OPENCSDLIBS := -lopencsd_c_api
> > +OPENCSDLIBS := -lopencsd_c_api -lopencsd
> > ifeq ($(findstring -static,${LDFLAGS}),-static)
> > - OPENCSDLIBS += -lopencsd -lstdc++
> > + OPENCSDLIBS += -lstdc++
> > endif
> > ifdef CSLIBS
> > LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
> > --
> > 2.34.1
>
> Tested-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> Cross compiled for aarch64 on x86_64.
>
> make ARCH=arm64 NO_LIBELF=1 NO_JVMTI=1 VF=1 CORESIGHT=1 -C tools/perf
>
> file <snip>/linux-xlnx/tools/perf/perf
> perf: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV),
> dynamically linked, interpreter /lib/ld-linux-aarch64.so.1,
> BuildID[sha1]=ef7c524338577b14e7c0f914d882dec4d26e93a2,
> for GNU/Linux 3.14.0, with debug_info, not stripped
Thanks for reporting and testing, applied to perf-tools. I see no
problems in my common case which is:
⬢[acme@toolbox perf-tools]$ alias m='make -k BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools -C tools/perf install-bin && git status && perf test python ; perf record -o /dev/null sleep 0.01 ; perf stat --null sleep 0.01'
⬢[acme@toolbox perf-tools]$
⬢[acme@toolbox perf-tools]$ ldd ~/bin/perf | grep csd
libopencsd_c_api.so.1 => /lib64/libopencsd_c_api.so.1 (0x00007f9c012ea000)
libopencsd.so.1 => /lib64/libopencsd.so.1 (0x00007f9c00556000)
⬢[acme@toolbox perf-tools]$
- Arnaldo
prev parent reply other threads:[~2023-07-11 14:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 15:45 [PATCH] perf build: Fix library not found error when using CSLIBS James Clark
2023-07-11 8:28 ` Pandey, Radhey Shyam
2023-07-11 14:46 ` Arnaldo Carvalho de Melo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZK1rRFO3VagSybPT@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=anirudha.sarangi@amd.com \
--cc=coresight@lists.linaro.org \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=radhey.shyam.pandey@amd.com \
--cc=uwe@kleine-koenig.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox