From: Leo Yan <leo.yan@arm.com>
To: Yang Jihong <yangjihong@bytedance.com>,
peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
namhyung@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] perf: build: Fix static compilation error when libdw is not installed
Date: Tue, 6 Aug 2024 22:00:55 +0100 [thread overview]
Message-ID: <ecf3460a-7f31-4dce-9a8b-fde8f146bfd8@arm.com> (raw)
In-Reply-To: <20240806114801.1652417-2-yangjihong@bytedance.com>
On 8/6/2024 12:47 PM, Yang Jihong wrote:
> If libdw is not installed in build environment, the output of
> 'pkg-config --modversion libdw' is empty, causing LIBDW_VERSION_2
> to be empty and the shell test will have the following error:
>
> /bin/sh: 1: test: -lt: unexpected operator
>
> Before:
>
> $ pkg-config --modversion libdw
> Package libdw was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libdw.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libdw' found
> $ make LDFLAGS=-static -j16
> BUILD: Doing 'make -j20' parallel build
> <SNIP>
> Package libdw was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libdw.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libdw' found
> /bin/sh: 1: test: -lt: unexpected operator
>
> After:
>
> 1. libdw is not installed:
>
> $ pkg-config --modversion libdw
> Package libdw was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libdw.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libdw' found
> $ make LDFLAGS=-static -j16
> BUILD: Doing 'make -j20' parallel build
> <SNIP>
> Package libdw was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libdw.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libdw' found
> Makefile.config:473: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR
>
> 2. libdw version is lower than 0.177
>
> $ pkg-config --modversion libdw
> 0.176
> $ make LDFLAGS=-static -j16
> BUILD: Doing 'make -j20' parallel build
> <SNIP>
>
> Auto-detecting system features:
> ... dwarf: [ on ]
> <SNIP>
> INSTALL libsubcmd_headers
> INSTALL libapi_headers
> INSTALL libperf_headers
> INSTALL libsymbol_headers
> INSTALL libbpf_headers
> LINK perf
>
> 3. libdw version is higher than 0.177
>
> $ pkg-config --modversion libdw
> 0.186
> $ make LDFLAGS=-static -j16
> BUILD: Doing 'make -j20' parallel build
> <SNIP>
>
> Auto-detecting system features:
> ... dwarf: [ on ]
> <SNIP>
> CC util/bpf-utils.o
> CC util/pfm.o
> LD util/perf-util-in.o
> LD perf-util-in.o
> AR libperf-util.a
> LINK perf
>
> Fixes: 536661da6ea1 ("perf: build: Only link libebl.a for old libdw")
> Signed-off-by: Yang Jihong <yangjihong@bytedance.com>
> ---
> tools/build/feature/Makefile | 2 +-
> tools/perf/Makefile.config | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 12796808f07a..b18513ec4da6 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -178,7 +178,7 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
>
> # Elfutils merged libebl.a into libdw.a starting from version 0.177,
> # Link libebl.a only if libdw is older than this version.
> - ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
> + ifeq ($(shell test $(LIBDW_VERSION_2)0 -lt 1770; echo $$?),0)
I would like to follow up the style of LIBTRACEEVENT_VERSION and
LIBTRACEFS_VERSION, so change LIBDW_VERSION as below:
LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0
Does this work for you?
Thanks,
Leo
next prev parent reply other threads:[~2024-08-06 21:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 11:47 [PATCH v2 0/3] perf: build: Minor fixes for build failures Yang Jihong
2024-08-06 11:47 ` [PATCH v2 1/3] perf: build: Fix static compilation error when libdw is not installed Yang Jihong
2024-08-06 21:00 ` Leo Yan [this message]
2024-08-07 3:16 ` Yang Jihong
2024-08-06 11:48 ` [PATCH v2 2/3] perf: build: Fix build feature-dwarf_getlocations fail for old libdw Yang Jihong
2024-08-06 21:28 ` Leo Yan
2024-08-07 3:18 ` Yang Jihong
2024-08-06 11:48 ` [PATCH v2 3/3] perf dwarf-aux: Fix build fail when HAVE_DWARF_GETLOCATIONS_SUPPORT undefined Yang Jihong
2024-08-06 21:34 ` Leo Yan
2024-08-07 3:19 ` Yang Jihong
2024-08-06 17:58 ` [PATCH v2 0/3] perf: build: Minor fixes for build failures Namhyung Kim
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=ecf3460a-7f31-4dce-9a8b-fde8f146bfd8@arm.com \
--to=leo.yan@arm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--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=yangjihong@bytedance.com \
/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
all inboxes | Powered by JetHome®