* [PATCH v3 0/3] perf: build: Minor fixes for build failures
@ 2024-08-07 3:20 Yang Jihong
2024-08-07 3:20 ` [PATCH v3 1/3] perf: build: Fix static compilation error when libdw is not installed Yang Jihong
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Yang Jihong @ 2024-08-07 3:20 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, kan.liang, leo.yan,
linux-perf-users, linux-kernel
Cc: yangjihong
Changes since v2:
- patch1: change LIBDW_VERSION to follow up the style of
LIBTRACEEVENT_VERSION. (by Leo's suggestion)
- patch2: Use a new line for the -ldl dependency and with comment,
synchronize tools/perf/Makefile.config. (by Leo's suggestion)
- patch3: include header files in alphabetical order,
add reviewed-by tag from Leo. (by Leo's suggestion)
Changes since v1:
- patch3: Remove UTF-8 characters from build failure logs
Yang Jihong (3):
perf: build: Fix static compilation error when libdw is not installed
perf: build: Fix build feature-dwarf_getlocations fail for old libdw
perf dwarf-aux: Fix build fail when HAVE_DWARF_GETLOCATIONS_SUPPORT
undefined
tools/build/feature/Makefile | 5 ++++-
tools/perf/Makefile.config | 7 +++++--
tools/perf/util/dwarf-aux.h | 1 +
3 files changed, 10 insertions(+), 3 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/3] perf: build: Fix static compilation error when libdw is not installed
2024-08-07 3:20 [PATCH v3 0/3] perf: build: Minor fixes for build failures Yang Jihong
@ 2024-08-07 3:20 ` Yang Jihong
2024-08-07 3:20 ` [PATCH v3 2/3] perf: build: Fix build feature-dwarf_getlocations fail for old libdw Yang Jihong
2024-08-07 7:49 ` [PATCH v3 0/3] perf: build: Minor fixes for build failures Leo Yan
2 siblings, 0 replies; 5+ messages in thread
From: Yang Jihong @ 2024-08-07 3:20 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, kan.liang, leo.yan,
linux-perf-users, linux-kernel
Cc: yangjihong
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..a0167244b2f7 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -172,7 +172,7 @@ DWARFLIBS := -ldw
ifeq ($(findstring -static,${LDFLAGS}),-static)
DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
- LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)
+ LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0
LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
LIBDW_VERSION_2 := $(word 2, $(subst ., ,$(LIBDW_VERSION)))
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index fa679db61f62..b452794c763a 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -154,7 +154,7 @@ DWARFLIBS := -ldw
ifeq ($(findstring -static,${LDFLAGS}),-static)
DWARFLIBS += -lelf -ldl -lz -llzma -lbz2 -lzstd
- LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)
+ LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0
LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
LIBDW_VERSION_2 := $(word 2, $(subst ., ,$(LIBDW_VERSION)))
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/3] perf: build: Fix build feature-dwarf_getlocations fail for old libdw
2024-08-07 3:20 [PATCH v3 0/3] perf: build: Minor fixes for build failures Yang Jihong
2024-08-07 3:20 ` [PATCH v3 1/3] perf: build: Fix static compilation error when libdw is not installed Yang Jihong
@ 2024-08-07 3:20 ` Yang Jihong
2024-08-07 7:49 ` [PATCH v3 0/3] perf: build: Minor fixes for build failures Leo Yan
2 siblings, 0 replies; 5+ messages in thread
From: Yang Jihong @ 2024-08-07 3:20 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, kan.liang, leo.yan,
linux-perf-users, linux-kernel
Cc: yangjihong
For libdw versions below 0.177, need to link libdl.a in addition to
libbebl.a during static compilation, otherwise feature-dwarf_getlocations
compilation will fail.
Before:
$ make LDFLAGS=-static
BUILD: Doing 'make -j20' parallel build
<SNIP>
Makefile.config:483: Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157
<SNIP>
$ cat ../build/feature/test-dwarf_getlocations.make.output
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libebl.a(eblclosebackend.o): in function `ebl_closebackend':
(.text+0x20): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
After:
$ make LDFLAGS=-static
<SNIP>
Auto-detecting system features:
... dwarf: [ on ]
<SNIP>
$ ./perf probe
Usage: perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]
or: perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
or: perf probe [<options>] --del '[GROUP:]EVENT' ...
or: perf probe --list [GROUP:]EVENT ...
<SNIP>
Fixes: 536661da6ea1 ("perf: build: Only link libebl.a for old libdw")
Signed-off-by: Yang Jihong <yangjihong@bytedance.com>
---
tools/build/feature/Makefile | 3 +++
tools/perf/Makefile.config | 5 ++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index a0167244b2f7..ead476b373f6 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -181,6 +181,9 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
DWARFLIBS += -lebl
endif
+
+ # Must put -ldl after -lebl for dependency
+ DWARFLIBS += -ldl
endif
$(OUTPUT)test-dwarf.bin:
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index b452794c763a..9fccdff682af 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -152,7 +152,7 @@ ifdef LIBDW_DIR
endif
DWARFLIBS := -ldw
ifeq ($(findstring -static,${LDFLAGS}),-static)
- DWARFLIBS += -lelf -ldl -lz -llzma -lbz2 -lzstd
+ DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0
LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
@@ -163,6 +163,9 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
DWARFLIBS += -lebl
endif
+
+ # Must put -ldl after -lebl for dependency
+ DWARFLIBS += -ldl
endif
FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/3] perf: build: Minor fixes for build failures
2024-08-07 3:20 [PATCH v3 0/3] perf: build: Minor fixes for build failures Yang Jihong
2024-08-07 3:20 ` [PATCH v3 1/3] perf: build: Fix static compilation error when libdw is not installed Yang Jihong
2024-08-07 3:20 ` [PATCH v3 2/3] perf: build: Fix build feature-dwarf_getlocations fail for old libdw Yang Jihong
@ 2024-08-07 7:49 ` Leo Yan
2024-09-09 2:15 ` [External] " Yang Jihong
2 siblings, 1 reply; 5+ messages in thread
From: Leo Yan @ 2024-08-07 7:49 UTC (permalink / raw)
To: Yang Jihong, peterz, mingo, acme, namhyung, mark.rutland,
alexander.shishkin, jolsa, irogers, adrian.hunter, kan.liang,
linux-perf-users, linux-kernel
On 8/7/2024 4:20 AM, Yang Jihong wrote:
> Changes since v2:
> - patch1: change LIBDW_VERSION to follow up the style of
> LIBTRACEEVENT_VERSION. (by Leo's suggestion)
> - patch2: Use a new line for the -ldl dependency and with comment,
> synchronize tools/perf/Makefile.config. (by Leo's suggestion)
> - patch3: include header files in alphabetical order,
> add reviewed-by tag from Leo. (by Leo's suggestion)
For this series:
Reviewed-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [External] Re: [PATCH v3 0/3] perf: build: Minor fixes for build failures
2024-08-07 7:49 ` [PATCH v3 0/3] perf: build: Minor fixes for build failures Leo Yan
@ 2024-09-09 2:15 ` Yang Jihong
0 siblings, 0 replies; 5+ messages in thread
From: Yang Jihong @ 2024-09-09 2:15 UTC (permalink / raw)
To: Leo Yan, peterz, mingo, acme, namhyung, mark.rutland,
alexander.shishkin, jolsa, irogers, adrian.hunter, kan.liang,
linux-perf-users, linux-kernel
Hello,
PING.
Are there any other issues with this patchset?
Thanks,
Yang.
On 8/7/24 15:49, Leo Yan wrote:
> On 8/7/2024 4:20 AM, Yang Jihong wrote:
>> Changes since v2:
>> - patch1: change LIBDW_VERSION to follow up the style of
>> LIBTRACEEVENT_VERSION. (by Leo's suggestion)
>> - patch2: Use a new line for the -ldl dependency and with comment,
>> synchronize tools/perf/Makefile.config. (by Leo's suggestion)
>> - patch3: include header files in alphabetical order,
>> add reviewed-by tag from Leo. (by Leo's suggestion)
>
> For this series:
>
> Reviewed-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-09 2:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07 3:20 [PATCH v3 0/3] perf: build: Minor fixes for build failures Yang Jihong
2024-08-07 3:20 ` [PATCH v3 1/3] perf: build: Fix static compilation error when libdw is not installed Yang Jihong
2024-08-07 3:20 ` [PATCH v3 2/3] perf: build: Fix build feature-dwarf_getlocations fail for old libdw Yang Jihong
2024-08-07 7:49 ` [PATCH v3 0/3] perf: build: Minor fixes for build failures Leo Yan
2024-09-09 2:15 ` [External] " Yang Jihong
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).