Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp537222lqt; Thu, 6 Jun 2024 10:29:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVFapDHSa2tESaKFsH0BmasTu8xl6uV0xhm57zNyH8q/thRaPTRAeJcoKKeXtweVh1D2GiypP6wm+BKof/npGXKplxhWUpf35D1/4kMIA== X-Google-Smtp-Source: AGHT+IGiHvlLPcVXIWsfPDU16XLDGnjDrDYnHfDRZlx1xJE+hsAwOu3Z8sH9xYhuJV4WtqCws98C X-Received: by 2002:a50:d4cf:0:b0:574:c3e4:1fa3 with SMTP id 4fb4d7f45d1cf-57aa55c7454mr2548182a12.20.1717694946356; Thu, 06 Jun 2024 10:29:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717694946; cv=pass; d=google.com; s=arc-20160816; b=TQQtL6vDvQTu+tz4oPHW1C8B60Akk6iOSQsMS2Ac8izRv6MocPODYq2VMgiNaeR0FX wIfLPs6Prq4ASPGuzIDagSn8proFeXv1suF9XOPPJ9RQZz4uzlmtgWJN/PPHl15Zpw0s bROdJ1ixGl+EXQHDAp353gWRSE4z+2hbQkcN9B3B9FZ6LxcCZ0tiuvGkuYV4mXfHuy46 PAFJB/tHPJYFSpgVxO1tgdYEBnQMFre7ZQQZ4tcpnOpHIkOj/kp35O+tK22wFGt2N+d0 UKY7W3Qhn8HCdHgv9CqwgYDqk7Ars2QJ26/85Dly7lvz/CRBhUWVvDaqw8SdoERrZy1Y CPFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JtekPTRz6HA/FC51sxi9t3abSCouA4D5zik9TS6vv/k=; fh=RnXafB7KaCzs0DhHSFvKgjr7RLKjWL5fYGQ/mgxPg2o=; b=GMfLJ6ylvNhQP4FTp5Arj9MPViVE8jj3hQg1ofX+NRez5UOEBa9V3/oecoFoUn+j8+ 0seCYngqFWCpKxcepzHdO1qliJcGjxKV/Ea5UWsFkPjqHzvs/rHjF91LnNWv3yXfF8Ir ricVfcrHiU0u2Bl2DOqBNyiPGvqNVUUM0npg7oEpCODvGf+/hkytzdRZt1+SfSC6xGs0 x2vWzXtPFZGwuKtPcqUSlfBaE/1t+5Oq3UjwvLFvBg4E5sJsAGIWSkmRj8atKD9wKRxX NMedlQ8KFCqoxXSHRqAOFXH8mZWQ1e6wD3c5Vu9+JX3jIWaC/oQrzrGYz3NQ1zgq+7XO P5pA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dP3yt6rB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204801-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204801-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae25fdc8si894795a12.496.2024.06.06.10.29.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 10:29:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204801-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dP3yt6rB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204801-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204801-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id EC7A21F246EA for ; Thu, 6 Jun 2024 17:29:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A86481991A9; Thu, 6 Jun 2024 17:28:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dP3yt6rB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD3E21990CE; Thu, 6 Jun 2024 17:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717694938; cv=none; b=AC7K6X2WmDK7WIx1wbiG4MzqfHcupcQAQwKKWifbFcd18NXa/2lcY2coGSrwvFrK+7d6PC7XSIThjhdveXKVqNX6549/EVF1ri4XZj0Mjk2AAHInjOsGNHCRcYELXX+yDON5G+wKb66XI7vR0WbOYGaRinLSKAsa0u5r3mBB5rs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717694938; c=relaxed/simple; bh=0VOTymSltSm46M0tWgnYW1sxiIawEOkUL0FrWY5YCPI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dZ3BSYpVTwZ7y82ZT30BaPoZZqcEQy3pwpN9p2eIIBwH8mAaaMbyMSglYPHAr6Pg1kULvPkRX3Bc+UPTRqi7BhZRTiFecZH8HIQZPhbbDOxfWXbZEjGPHwXMrtnvWg4VNaxWpGrI0xRcs+B6sqRePCJFPml377jBjrZY0qHENAI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dP3yt6rB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C49D7C2BD10; Thu, 6 Jun 2024 17:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717694938; bh=0VOTymSltSm46M0tWgnYW1sxiIawEOkUL0FrWY5YCPI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dP3yt6rBauKLyUXSmvUQlKMv9b+IZxxP5U5a9chY/5DoATvlBY+jPRJfZjGzufEzK I4cFzo9XU1/Q6vPMcVBsrP45WiA8bmK3xJx6wk300XvvAzrp0DJZSaWW1tztjieZJ5 +81x+uZjb7UWRhCXjEOEQqz1nQzx9n58qg5f9tRuecRkM4znRbyTMNPwZTwMIlaGZS ztwbh33zNyncdklSDwYeXSmdxnkW9FBBwvHN6IQX0dNLHKHvHY/KVcxqLGQbhpU5XY TvaJ+VAbB45PxsYntGZ8TM2+JeEGQk3P5rcdHlgG2a4NhpuDMVmHnX7FVi1QK75u7s HxwLBGk97+R+Q== Date: Thu, 6 Jun 2024 10:28:56 -0700 From: Namhyung Kim To: Leo Yan Cc: Arnaldo Carvalho de Melo , 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 Subject: Re: [PATCH v1 1/6] perf: build: Setup PKG_CONFIG_LIBDIR for cross compilation Message-ID: References: <20240604093223.1934236-1-leo.yan@arm.com> <20240604093223.1934236-2-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-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240604093223.1934236-2-leo.yan@arm.com> Hi Leo, On Tue, Jun 04, 2024 at 10:32:18AM +0100, Leo Yan wrote: > 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 Can we do that only if the cross-compile-pkg-config is not available? Thanks, Namhyung > + 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 >