Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1470684lqj; Tue, 4 Jun 2024 02:33:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfnAASw1cpueBMOcOt6Fz+Aw4d6jXRF76acnQHj1HIe6oNpkWjjH9JInkLUCdmpBI4rBNUJvpl9KRbV3k+ZmhEwp74OSjLWiWmoL2E9g== X-Google-Smtp-Source: AGHT+IHIlDyAJepuR/YiD1qIie1Fn0Rske/MmTXu5s8y/oAzzcZU82ZvD68iMaAdEOVfO5isnLX1 X-Received: by 2002:a05:6808:1796:b0:3d1:ea41:5bcd with SMTP id 5614622812f47-3d1ea415d33mr9729513b6e.55.1717493637443; Tue, 04 Jun 2024 02:33:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717493637; cv=pass; d=google.com; s=arc-20160816; b=YbWBBhnW8Fe4ZJDOAvmkS9e1flkhq3QnDAAKhgf56pkFmEkoP8kMil6BOeHxZ/14nW b2OW9oBz79U4unQuAe1d4yB9p5YjngSU1zGdRcij64VJyb+QL6u99b+ej+rydBpRlq9j zgcBYW908D7IABPrmHZ43QlvENAtthAbCPO7wZ0sqgmYg9J8H1Ke7JVdMzlyXf5tFuab e2R8hTIKQNvWk9VSdzOeehZ1m+hV0OrBD1y98yHwrJppeiTQAGhD1tcQh+hmStGZdcWr KyqNieuHsHRSqN7e5qgKhfmxqh90Zvf+UG/J2YM0FtqzynI4jibNGsPVLsHdcxdehi7x Y3eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=7O/roh7MuXz9hibL2gpyGZmz7fa9YLuTR9cU+yQQghI=; fh=KSiWrCR7xjqa6nMnB8EyauKJbY8zFKZ3kSm6JhLxeok=; b=iu5RGSRO/kRq3ssN/LWRBWvb3G2tHULN4/U/F722hek+1CyLqUNaWMV5zmHzR1FQvQ rDhmGp8c6BBxfwGsIoOjClvqHHQp7ePYKJFwztiClhEipZMCNMGzEOsVDf3DeX6aMaeB eS5JhZofmGhaZI6Bm+7BlpJfgotm316E8pPpTTb8Sxc2M3M8pV53daEUcVAZXJ+U/COI nP18oMzA3e2JcrKKXRcXQDOXz1kM5Ch7SlmcbJPbvCWCOTZQ2w+NIoRTopTKwhy3O00R Ab+hxDp52TEyfnS1U28KQtJ1mO0CmDY06hHdFCAaSf1DsMt5UhHgquvj75IeR1/z9s8f 4vDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-200356-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4a732b30si16626766d6.110.2024.06.04.02.33.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:33:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200356-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-200356-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B25D61C23665 for ; Tue, 4 Jun 2024 09:33:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCCB21448FA; Tue, 4 Jun 2024 09:32:43 +0000 (UTC) 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: 8bit 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= \ FILES := $(addprefix $(OUTPUT),$(FILES)) -PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config +PKG_CONFIG ?= pkg-config + +ifdef CROSS_COMPILE + ifndef PKG_CONFIG_LIBDIR + CROSS_ARCH = $(shell $(CC) -dumpmachine) + PKG_CONFIG_LIBDIR := /usr/local/$(CROSS_ARCH)/lib/pkgconfig/ + PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/ + PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_ARCH)/pkgconfig/ + PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/pkgconfig/ + PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/ + export PKG_CONFIG_LIBDIR + endif +endif all: $(FILES) 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 ?= ld HOSTAR ?= ar CLANG ?= clang -PKG_CONFIG = $(CROSS_COMPILE)pkg-config +PKG_CONFIG ?= pkg-config + +# Set the PKG_CONFIG_LIBDIR for cross compilation. +ifdef CROSS_COMPILE + ifndef PKG_CONFIG_LIBDIR + CROSS_ARCH = $(shell $(CC) -dumpmachine) + PKG_CONFIG_LIBDIR := /usr/local/$(CROSS_ARCH)/lib/pkgconfig/ + PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/ + PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_ARCH)/pkgconfig/ + PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/pkgconfig/ + PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/ + export PKG_CONFIG_LIBDIR + endif +endif RM = rm -f LN = ln -f -- 2.34.1