From nobody Fri Feb 13 01:40:22 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D548414431B; Tue, 4 Jun 2024 09:32:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493563; cv=none; b=hz4R85a3AIjUfVFCF/mOEMXqhGyww8HLVCyCluhPD6Rc13vjo6ZZPgUH6GxDYBLz3cyQVa+WayghnZqllCdwaiLq+EktglfYc84nAeWZjGNtJE51J0P0w4ayYyteosANzptlNbZZqtx4od8R4wVBc43MIf9jMvr4m1uvxpr1ocA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493563; c=relaxed/simple; bh=AYIsr6BHCMO5M5g+WYj0gNdRpucero0xaGIOB77Fy78=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Z9oDbRTbHkBF1vHW183/JGc0CCEvkX0mgTwY92gVSRS1S1y50XuuvntVEkmhW6RhfivYg4aNKZZVUkrbOkJ3xfqYR0Z+ULF8Yi2yT3Q9x8toeYxU1vRKORpt5izeHVcvifDC3b/fZTT2d6IvS1vRl8cKAPfBBXfO9/kDIskoWdE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AABD11063; Tue, 4 Jun 2024 02:33:05 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9DBD53F762; Tue, 4 Jun 2024 02:32:39 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , James Clark , Ian Rogers , "Liang, Kan" , Nick Terrell , Thomas Richter , Changbin Du , Fangrui Song , "Mateusz Kowalczyk" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 1/6] perf: build: Setup PKG_CONFIG_LIBDIR for cross compilation Date: Tue, 4 Jun 2024 10:32:18 +0100 Message-Id: <20240604093223.1934236-2-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604093223.1934236-1-leo.yan@arm.com> References: <20240604093223.1934236-1-leo.yan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On recent Linux distros like Ubuntu Noble and Debian Bookworm, the 'pkg-config-aarch64-linux-gnu' package is missing. As a result, the aarch64-linux-gnu-pkg-config command is not available, which causes build failures. Alternatively, this commit sets the PKG_CONFIG_LIBDIR environment variable dynamically based on the cross compiler to ensure the correct package configurations. Signed-off-by: Leo Yan --- tools/build/feature/Makefile | 14 +++++++++++++- tools/perf/Makefile.perf | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index ed54cef450f5..6f52f892f9a3 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -82,7 +82,19 @@ FILES=3D \ =20 FILES :=3D $(addprefix $(OUTPUT),$(FILES)) =20 -PKG_CONFIG ?=3D $(CROSS_COMPILE)pkg-config +PKG_CONFIG ?=3D pkg-config + +ifdef CROSS_COMPILE + ifndef PKG_CONFIG_LIBDIR + CROSS_ARCH =3D $(shell $(CC) -dumpmachine) + PKG_CONFIG_LIBDIR :=3D /usr/local/$(CROSS_ARCH)/lib/pkgconfig/ + PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/ + PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_ARC= H)/pkgconfig/ + PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/pkg= config/ + PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/ + export PKG_CONFIG_LIBDIR + endif +endif =20 all: $(FILES) =20 diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 5c35c0d89306..c1553a546a4f 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -193,7 +193,20 @@ HOSTLD ?=3D ld HOSTAR ?=3D ar CLANG ?=3D clang =20 -PKG_CONFIG =3D $(CROSS_COMPILE)pkg-config +PKG_CONFIG ?=3D pkg-config + +# Set the PKG_CONFIG_LIBDIR for cross compilation. +ifdef CROSS_COMPILE + ifndef PKG_CONFIG_LIBDIR + CROSS_ARCH =3D $(shell $(CC) -dumpmachine) + PKG_CONFIG_LIBDIR :=3D /usr/local/$(CROSS_ARCH)/lib/pkgconfig/ + PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/ + PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_ARC= H)/pkgconfig/ + PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/pkg= config/ + PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/ + export PKG_CONFIG_LIBDIR + endif +endif =20 RM =3D rm -f LN =3D ln -f --=20 2.34.1 From nobody Fri Feb 13 01:40:22 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C97EA1448F6; Tue, 4 Jun 2024 09:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493565; cv=none; b=azZYyvZ3o1Rtiyce09EWlVsg4A2NZNJmNyP2xYGwV0Kb5+h7Vs3x7+b5PVRe2s4fAqxXL9czFLci9GAiALmgUyQgdWvMiqfrkqBF/xxZi9a9r7nA9q0WasoZwJFHDuExlVRNgiUkPQ/8Zbuomgrg2jSPZFyu/6hvNuJLewaPf/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493565; c=relaxed/simple; bh=3bxksl8Ny84wUjMLk6cosHjxG9kquj8690iMjEdPc24=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=stZGSnt3ExBf2YdMUNSGVtABSMNiQXNaFs9vW1v7UB9v1UlhBaZ6uy1TviP2T0/rjyJPgXS0RvXEiSlW8yp6GFqk220SvkD9H+FbggP0wdWdWk2Ehr4yk0tgl2s16yPOGBE5Kwl4jqfHThT1fT88Di8OaPTIFphNS3ic/lowxPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 994161474; Tue, 4 Jun 2024 02:33:07 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8C6DE3F762; Tue, 4 Jun 2024 02:32:41 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , James Clark , Ian Rogers , "Liang, Kan" , Nick Terrell , Thomas Richter , Changbin Du , Fangrui Song , "Mateusz Kowalczyk" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 2/6] perf: build: Append libtraceevent path in PKG_CONFIG_LIBDIR Date: Tue, 4 Jun 2024 10:32:19 +0100 Message-Id: <20240604093223.1934236-3-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604093223.1934236-1-leo.yan@arm.com> References: <20240604093223.1934236-1-leo.yan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When a user specifies the path for libtraceevent, it means a self-built package is being used instead of the distro package. This commit appends the specified path in the variable 'PKG_CONFIG_LIBDIR', so that later pkg-config can retrieve version info from the self-built folder. Signed-off-by: Leo Yan --- 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 7f1e016a9253..f545e0c3c176 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -1181,7 +1181,10 @@ ifneq ($(NO_LIBTRACEEVENT),1) CFLAGS +=3D -DHAVE_LIBTRACEEVENT $(LIBTRACEEVENT_CFLAGS) LDFLAGS +=3D $(LIBTRACEEVENT_LDFLAGS) EXTLIBS +=3D ${TRACEEVENTLIBS} - LIBTRACEEVENT_VERSION :=3D $(shell PKG_CONFIG_PATH=3D$(LIBTRACEEVENT_D= IR) $(PKG_CONFIG) --modversion libtraceevent) + ifdef LIBTRACEEVENT_DIR + PKG_CONFIG_LIBDIR :=3D $(LIBTRACEEVENT_DIR):$(PKG_CONFIG_LIBDIR) + endif + LIBTRACEEVENT_VERSION :=3D $(shell $(PKG_CONFIG) --modversion libtrace= event) LIBTRACEEVENT_VERSION_1 :=3D $(word 1, $(subst ., ,$(LIBTRACEEVENT_VER= SION))) LIBTRACEEVENT_VERSION_2 :=3D $(word 2, $(subst ., ,$(LIBTRACEEVENT_VER= SION))) LIBTRACEEVENT_VERSION_3 :=3D $(word 3, $(subst ., ,$(LIBTRACEEVENT_VER= SION))) --=20 2.34.1 From nobody Fri Feb 13 01:40:22 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C429B144D24; Tue, 4 Jun 2024 09:32:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493567; cv=none; b=B1u7XnkZqhLewd+L4TN08Oqd9nXa8J6AQzo5PHnoO51bC3dxMgLfbd7TDt+v0zErEepSFi8H/JA2QNPC7RVgywehSAGEoLinVLNfOHA30CnYj1OJsPuq/wsAGegMlQD65vGieKHTwVG5KvJgJxEUo59itrng1FgBjyCHfmhMUOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493567; c=relaxed/simple; bh=v6eX51MtO/kHVdP5FiWoLf+U6ElkFVAWKVYKBl9e4Hg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NRHusfMH5eUXNZnaX1HeYfSyNOjltbBmLI7carsmE6Ommu23+6lR/vcAGl+9pNa8lIlVUtHpnP2ORkf6drJ3KCGSiS82Vf54oeYB2CXuT0qxXk7PDXlhNpAc0+NxGGDLBgZiOMqNsGk1Jjvn20oTWWehz59Y0IVGt51D8agGqJ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 87BAF1515; Tue, 4 Jun 2024 02:33:09 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7AE6A3F762; Tue, 4 Jun 2024 02:32:43 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , James Clark , Ian Rogers , "Liang, Kan" , Nick Terrell , Thomas Richter , Changbin Du , Fangrui Song , "Mateusz Kowalczyk" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 3/6] perf: build: Set Python configuration for cross compilation Date: Tue, 4 Jun 2024 10:32:20 +0100 Message-Id: <20240604093223.1934236-4-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604093223.1934236-1-leo.yan@arm.com> References: <20240604093223.1934236-1-leo.yan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Python configuration has dedicated folders for different architectures. For example, Python 3.11 has two folders as shown below, one for Arm64 and another for x86_64: /usr/lib/python3.11/config-3.11-aarch64-linux-gnu/ /usr/lib/python3.11/config-3.11-x86_64-linux-gnu/ This commit updates the Python configuration path based on the compiler's machine type, guiding the compiler to find the correct path for Python libraries. It also renames the generated .so file name to match the machine name. Signed-off-by: Leo Yan --- tools/perf/Makefile.config | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index f545e0c3c176..646e5af0ed51 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -303,6 +303,11 @@ endif =20 ifdef PYTHON_CONFIG PYTHON_EMBED_LDOPTS :=3D $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_LDF= LAGS) 2>/dev/null) + # Update the python flags for cross compilation + ifdef CROSS_COMPILE + PYTHON_NATIVE :=3D $(shell echo $(PYTHON_EMBED_LDOPTS) | sed 's/\(-L.*= \/\)\(.*-linux-gnu\).*/\2/') + PYTHON_EMBED_LDOPTS :=3D $(subst $(PYTHON_NATIVE),$(shell $(CC) -dumpm= achine),$(PYTHON_EMBED_LDOPTS)) + endif PYTHON_EMBED_LDFLAGS :=3D $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) PYTHON_EMBED_LIBADD :=3D $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil PYTHON_EMBED_CCOPTS :=3D $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/n= ull) @@ -904,6 +909,9 @@ else PYTHON_SETUPTOOLS_INSTALLED :=3D $(shell $(PYTHON) -c 'import set= uptools;' 2> /dev/null && echo "yes" || echo "no") ifeq ($(PYTHON_SETUPTOOLS_INSTALLED), yes) PYTHON_EXTENSION_SUFFIX :=3D $(shell $(PYTHON) -c 'from importl= ib import machinery; print(machinery.EXTENSION_SUFFIXES[0])') + ifdef CROSS_COMPILE + PYTHON_EXTENSION_SUFFIX :=3D $(subst $(PYTHON_NATIVE),$(shell= $(CC) -dumpmachine),$(PYTHON_EXTENSION_SUFFIX)) + endif LANG_BINDINGS +=3D $(obj-perf)python/perf$(PYTHON_EXTENSION_SUF= FIX) else $(warning Missing python setuptools, the python binding won't b= e built, please install python3-setuptools or equivalent) --=20 2.34.1 From nobody Fri Feb 13 01:40:22 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5DB6145327; Tue, 4 Jun 2024 09:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493569; cv=none; b=uLHv9gZIQQc8IMxoQ4acGbT9wZ0lSY2K8pl+oDFHAl87Xf+Y0AH3eQvnVx7tZE0UO2O2Coe/aNMnJzEmfDdp8HMXWGEDSyuDmqnRpWfgOC0cAOJYpLqfykVTngBC19C5VBdZQc4I8ITYEcxtE85Ggyvo8SL4EGIF0vuz+zNP8iE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493569; c=relaxed/simple; bh=f5zCnqc+nOgXNE3aBYf6+yyhziHuGJt+sO5UjVnaqZU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=q5HgJFumh+uhHEAK5iVkapQE5a+tEOI8sKGT8+/U/Y+HiBT22NgoQXDQBeOHGL238ydcbI8IZowHh3o1SAXH2D/sgeUZ70CpFxKSEMh8KWOCQf4mZ/TbisH3P5VWdFiz+mrzAIjFKA4SUIqKifUNiNIfOIThowzxtRMqYOL2lRY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 762751516; Tue, 4 Jun 2024 02:33:11 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 697483F762; Tue, 4 Jun 2024 02:32:45 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , James Clark , Ian Rogers , "Liang, Kan" , Nick Terrell , Thomas Richter , Changbin Du , Fangrui Song , "Mateusz Kowalczyk" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 4/6] perf: build: Only link libebl.a for old libdw Date: Tue, 4 Jun 2024 10:32:21 +0100 Message-Id: <20240604093223.1934236-5-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604093223.1934236-1-leo.yan@arm.com> References: <20240604093223.1934236-1-leo.yan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since libdw version 0.177, elfutils has merged libebl.a into libdw (see the commit "libebl: Don't install libebl.a, libebl.h and remove backends from spec." in the elfutils repository). As a result, libebl.a does not exist on Debian Bullseye and newer releases, causing static perf builds to fail on these distributions. This commit checks the libdw version and only links libebl.a if it detects that the libdw version is older than 0.177. Signed-off-by: Leo Yan --- tools/build/feature/Makefile | 12 +++++++++++- tools/perf/Makefile.config | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 6f52f892f9a3..2f4cfb7b8c14 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -159,7 +159,17 @@ $(OUTPUT)test-libopencsd.bin: =20 DWARFLIBS :=3D -ldw ifeq ($(findstring -static,${LDFLAGS}),-static) -DWARFLIBS +=3D -lelf -lebl -lz -llzma -lbz2 + DWARFLIBS +=3D -lelf -lz -llzma -lbz2 + + LIBDW_VERSION :=3D $(shell $(PKG_CONFIG) --modversion libdw) + LIBDW_VERSION_1 :=3D $(word 1, $(subst ., ,$(LIBDW_VERSION))) + LIBDW_VERSION_2 :=3D $(word 2, $(subst ., ,$(LIBDW_VERSION))) + + # 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) + DWARFLIBS +=3D -lebl + endif endif =20 $(OUTPUT)test-dwarf.bin: diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 646e5af0ed51..e8d3713b081c 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -152,7 +152,17 @@ ifdef LIBDW_DIR endif DWARFLIBS :=3D -ldw ifeq ($(findstring -static,${LDFLAGS}),-static) - DWARFLIBS +=3D -lelf -lebl -ldl -lz -llzma -lbz2 + DWARFLIBS +=3D -lelf -ldl -lz -llzma -lbz2 + + LIBDW_VERSION :=3D $(shell $(PKG_CONFIG) --modversion libdw) + LIBDW_VERSION_1 :=3D $(word 1, $(subst ., ,$(LIBDW_VERSION))) + LIBDW_VERSION_2 :=3D $(word 2, $(subst ., ,$(LIBDW_VERSION))) + + # 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) + DWARFLIBS +=3D -lebl + endif endif FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind :=3D $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) --=20 2.34.1 From nobody Fri Feb 13 01:40:22 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0F7414534C; Tue, 4 Jun 2024 09:32:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493571; cv=none; b=TL4Q7EOg/4WGAcI5qUKQYyL+RZX37tC0XV8BpK38fOsrl+sKA2gZzC6PK8yn10FCPiFlMyv2KTbrxYM+gVUagGFnuPE+zlOOqsMYN/F6f7vRt3J2ipEVQsjOTxTkJ7kURzkwuHOOlRH306ScEftucnDj4nQ4DidUPHY7YjlrIoI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493571; c=relaxed/simple; bh=EzGLbDGq3jstPVn9G98FIOjt8qMcsCAL/4PAIvj0ZVU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tiG1U+LmNG0VBopdoQ+EvvA6JJc7x3B7IvZzLQcPeuDgdO6BUGLEBbWz7s9aROzUikKruyLoMx6Yn8p3Jm/X0lEr6ediibjEl/7tuOAuYZq5x4LTKsGhigsvZObfJyVaEqI+1QtRrvq5f0JKF/QJA/Zj08bQOGv8fyyvw0vNtJw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 653BD1042; Tue, 4 Jun 2024 02:33:13 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 585E43F762; Tue, 4 Jun 2024 02:32:47 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , James Clark , Ian Rogers , "Liang, Kan" , Nick Terrell , Thomas Richter , Changbin Du , Fangrui Song , "Mateusz Kowalczyk" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 5/6] perf: build: Link lib 'lzma' for static build Date: Tue, 4 Jun 2024 10:32:22 +0100 Message-Id: <20240604093223.1934236-6-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604093223.1934236-1-leo.yan@arm.com> References: <20240604093223.1934236-1-leo.yan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The libunwind feature test failed with the static linkage. This is due to the 'lzma' lib is missed, so link it to dismiss building failure. Signed-off-by: Leo Yan --- tools/build/feature/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 2f4cfb7b8c14..18aa6e654804 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -200,27 +200,27 @@ $(OUTPUT)test-numa_num_possible_cpus.bin: $(BUILD) -lnuma =20 $(OUTPUT)test-libunwind.bin: - $(BUILD) -lelf + $(BUILD) -lelf -llzma =20 $(OUTPUT)test-libunwind-debug-frame.bin: - $(BUILD) -lelf + $(BUILD) -lelf -llzma $(OUTPUT)test-libunwind-x86.bin: - $(BUILD) -lelf -lunwind-x86 + $(BUILD) -lelf -llzma -lunwind-x86 =20 $(OUTPUT)test-libunwind-x86_64.bin: - $(BUILD) -lelf -lunwind-x86_64 + $(BUILD) -lelf -llzma -lunwind-x86_64 =20 $(OUTPUT)test-libunwind-arm.bin: - $(BUILD) -lelf -lunwind-arm + $(BUILD) -lelf -llzma -lunwind-arm =20 $(OUTPUT)test-libunwind-aarch64.bin: - $(BUILD) -lelf -lunwind-aarch64 + $(BUILD) -lelf -llzma -lunwind-aarch64 =20 $(OUTPUT)test-libunwind-debug-frame-arm.bin: - $(BUILD) -lelf -lunwind-arm + $(BUILD) -lelf -llzma -lunwind-arm =20 $(OUTPUT)test-libunwind-debug-frame-aarch64.bin: - $(BUILD) -lelf -lunwind-aarch64 + $(BUILD) -lelf -llzma -lunwind-aarch64 =20 $(OUTPUT)test-libaudit.bin: $(BUILD) -laudit --=20 2.34.1 From nobody Fri Feb 13 01:40:22 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E2DD1459EA; Tue, 4 Jun 2024 09:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493572; cv=none; b=KlgimZqJXPGBt5sIQCdsCUovQ3B9jkJma0lDzZ3saZgu5EPF3FlRS8cusyq3z/Bq1g2u6newgNfZCYs+C2sUbGKf6NQPYW0sKuqdJrt6BAe1G4V2IodU0VMxj4txg2/VehXrv0GOMelLeEviQxrvTYC2KZTynW09LttJ0RrT56I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493572; c=relaxed/simple; bh=N+BgYVByzMrgGeiS8IAeDM2+IOiN9MtSfjmOFc+R2H8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uGRM6wVL46PHKKKwQnSDQjiBJ/cGexsastSJBM5e6JeHan2Xmh9iY3P/3PhfLARzcI6m05/CBH2iF8UH8YR1LdaCmnicjXXnK/dx62MB5VpCMUBetjxbTJEQRZpAfKhPYAIZg6y1rKWXxksexK3JHzDpEEZlJuASoChfI0WfPjU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 538ED1063; Tue, 4 Jun 2024 02:33:15 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 46F0F3F762; Tue, 4 Jun 2024 02:32:49 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , James Clark , Ian Rogers , "Liang, Kan" , Nick Terrell , Thomas Richter , Changbin Du , Fangrui Song , "Mateusz Kowalczyk" , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Leo Yan Subject: [PATCH v1 6/6] perf: build: Link lib 'zstd' for static build Date: Tue, 4 Jun 2024 10:32:23 +0100 Message-Id: <20240604093223.1934236-7-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604093223.1934236-1-leo.yan@arm.com> References: <20240604093223.1934236-1-leo.yan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When build static perf, Makefile reports the error: Makefile.config:480: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >=3D 0.158 and/or set LIBDW_DIR The libdw has been installed on the system, but the build system fails to build the feature detecting binary 'test-libdw-dwarf-unwind'. The failure is caused by missing to link the lib 'zstd'. Link lib 'zstd' for the static build, in the end, the dwarf feature can be enabled in the static perf. Signed-off-by: Leo Yan --- 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 18aa6e654804..80c237890a06 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -159,7 +159,7 @@ $(OUTPUT)test-libopencsd.bin: =20 DWARFLIBS :=3D -ldw ifeq ($(findstring -static,${LDFLAGS}),-static) - DWARFLIBS +=3D -lelf -lz -llzma -lbz2 + DWARFLIBS +=3D -lelf -lz -llzma -lbz2 -lzstd =20 LIBDW_VERSION :=3D $(shell $(PKG_CONFIG) --modversion libdw) LIBDW_VERSION_1 :=3D $(word 1, $(subst ., ,$(LIBDW_VERSION))) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index e8d3713b081c..acd405bc46de 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -152,7 +152,7 @@ ifdef LIBDW_DIR endif DWARFLIBS :=3D -ldw ifeq ($(findstring -static,${LDFLAGS}),-static) - DWARFLIBS +=3D -lelf -ldl -lz -llzma -lbz2 + DWARFLIBS +=3D -lelf -ldl -lz -llzma -lbz2 -lzstd =20 LIBDW_VERSION :=3D $(shell $(PKG_CONFIG) --modversion libdw) LIBDW_VERSION_1 :=3D $(word 1, $(subst ., ,$(LIBDW_VERSION))) --=20 2.34.1