From patchwork Tue Jan 10 15:04:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 41511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2798774wrt; Tue, 10 Jan 2023 07:08:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXsqV40fpkJtQo+by4LykrwVanNMcEzrFIMP4NpP+5Zqh46QUJRpXSldkUkmM3bbypQOzNST X-Received: by 2002:a17:906:a38f:b0:7c4:f348:3b1f with SMTP id k15-20020a170906a38f00b007c4f3483b1fmr57791846ejz.44.1673363284473; Tue, 10 Jan 2023 07:08:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673363284; cv=none; d=google.com; s=arc-20160816; b=jQS2nb48C5vBAXU5sgyNe7h8xkKJzpBP+EK6AjrglEa2t8uuBOPgG22S9H4NTNK8ws M0GXHY/ZqIHgdc8iTHBI1Q2GqK9XaDDGAFNNGQdCkNYTpCqnlUcJbGP5Z7dZc5k04DYE KTOB8AAG3OBoDScbDrS9KSPVhJUrWf1ZJc8oKfTinhOKcEi53QcB5/rdsRTnwjR4AvsO 2I56dcHbNH4EnBbONhWdrmtmThUow2dKZQ2wu90YD1VeAksKNFDDchVmTR9SxlEn/gNl Pan8mtvaJOcLWGzmt7neHWEE2INCfIFKgjP3wpLVy6DRIPhiLA6/ZrKUfGH+2TfIClmo 7srA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YyiceAOw4MQQ1ZjH/BY4+o1aRaI/4kmrI4ijgumzNRY=; b=a7fgbXcP/cpjWrewDOdvSlxFUfcfDBIG1EcHkUuy4y8kWZH0llWYZZXBVk3YZoyvBy ete3GO6EvuwF5AKnAKEC7kcnNv2/1fU/yOAVUMTiaJDQj8H66XYH3v55ypc1v42d8Kwa hztssGYcpEiKHzpT1jdIFaJqKi3S1wpcIhoAZabaaV7JmmRQJLbcAFzjqptMXRiR3FiJ imDbotnAbJ13C9G2IdPWfsKHxa9dGC4LMNc8UYEh2ufaps8cOmEJ62II4NlYxBEC/SYK 6G0gfNiXVRsRaWIhRRM4zU73HaYRMC6MEBscF+AJPVdPkv1HtpPoPOtcwkiRD+FRc1hj VkMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JOk9BjE4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a5085c4000000b00499d35c577csi32105edh.104.2023.01.10.07.07.40; Tue, 10 Jan 2023 07:08:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JOk9BjE4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238734AbjAJPGN (ORCPT + 99 others); Tue, 10 Jan 2023 10:06:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238828AbjAJPFq (ORCPT ); Tue, 10 Jan 2023 10:05:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9935A8E9B0; Tue, 10 Jan 2023 07:04:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1C62B816D7; Tue, 10 Jan 2023 15:04:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94CE7C433F2; Tue, 10 Jan 2023 15:04:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673363069; bh=BoEnbr/eDcQ/EJ6JsPc1z5jbuiyapCdGXR2pXG7CW3M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JOk9BjE4iLg0bmvUfrxUV7sq8lM6Vxd6wM7ct3rLOKhqvPXVQGqrrvkRwp4y34Ky+ qSAuEAw00ZilCK7q57KCs/Sj/1xY7APwE1LrxtvIAIuPf1F547o3gTLq6Aa/zrlDE7 ukz4GcpAKKJknNXTb5nCcE4tknuZ6/nL/G43uN/JtwjSFbR2mkxHXAy/Y6Z3a7Y1ZE hXK7FyJ8AIIVsUIYMJUkLYqeZ4vQzeUDD+UxvIefJziuDfxhQfEx0pzrf03BMJjsD9 acT8QcdZRObwXu4eeoD/qjo65WvWLQSlMrflogNTTJ6reNgP9LFALGvpeLDBuIf6QY AXJiPcVQIAx4A== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 06CE040468; Tue, 10 Jan 2023 12:04:27 -0300 (-03) Date: Tue, 10 Jan 2023 12:04:26 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Mike Leach , Alexander Shishkin , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] perf bpf: Avoid build breakage with libbpf < 0.8.0 + LIBBPF_DYNAMIC=1 Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754648579339356031?= X-GMAIL-MSGID: =?utf-8?q?1754648579339356031?= In 746bd29e348f99b4 ("perf build: Use tools/lib headers from install path") we stopped having the tools/lib/ directory from the kernel sources in the header include path unconditionally, which breaks the build on systems with older versions of libbpf-devel, in this case 0.7.0 as some of the structures and function declarations present in the newer version of libbpf included in the kernel sources (tools/lib/bpf) are not anymore used, just the ones in the system libbpf. So instead of trying to provide alternative functions when the libbpf-bpf_program__set_insns feature test fails, fail a LIBBPF_DYNAMIC=1 build (requesting the use of the system's libbpf) and emit this build error message: $ make LIBBPF_DYNAMIC=1 -C tools/perf Makefile.config:593: *** Error: libbpf devel library needs to be >= 0.8.0 to build with LIBBPF_DYNAMIC, update or build statically with the version that comes with the kernel sources. Stop. $ For v6.3 these tests will be revamped and we'll require libbpf 1.0 as a minimal version for using LIBBPF_DYNAMIC=1, most distros should have it by now or at v6.3 time. Fixes: 746bd29e348f99b4 ("perf build: Use tools/lib headers from install path") Cc: Alexander Shishkin Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/CAP-5=fVa51_URGsdDFVTzpyGmdDRj_Dj2EKPuDHNQ0BYgMSzUA@mail.gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Makefile.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 9962ae23ab8c5868..5b87846759036f6f 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -589,6 +589,8 @@ ifndef NO_LIBELF $(call feature_check,libbpf-bpf_program__set_insns) ifeq ($(feature-libbpf-bpf_program__set_insns), 1) CFLAGS += -DHAVE_LIBBPF_BPF_PROGRAM__SET_INSNS + else + dummy := $(error Error: libbpf devel library needs to be >= 0.8.0 to build with LIBBPF_DYNAMIC, update or build statically with the version that comes with the kernel sources); endif $(call feature_check,libbpf-btf__raw_data) ifeq ($(feature-libbpf-btf__raw_data), 1)