Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2803190rwr; Sat, 6 May 2023 20:57:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ64t5r7RZK+8HlQOVpKv2oVXpWhJl6P3H39cPYi7FMkIjxniSudCHcOtHlQPLP3Lvk1HhKP X-Received: by 2002:a05:6a20:8f1b:b0:ff:98ad:16a4 with SMTP id b27-20020a056a208f1b00b000ff98ad16a4mr3654942pzk.38.1683431855130; Sat, 06 May 2023 20:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683431855; cv=none; d=google.com; s=arc-20160816; b=Sg+PrtcIYvMA8jOTzGqcMcRX9tM1ntakyGyzU12XcBMiv1fkxkT7/UMVE/hJ6XwIxw eqwbPH1EJl3wwMLU+G9MJnU8/iL8g33E6pxBFAKOtx/WH07dmE9OXSEweUhMXDL7Izq9 4v6ly4qtHTmhRn+Z9L5gLCPmI1Slfo8sXrrTf448DWBLhKZZr8nX8V3cQiWtonT+4ZTb BJF37vY+Yc9gvIFElQVj36Hyo7BGnX/CiETU/2tp2xZKTIJzTeAoAKTAoaFobMgNo0bT zR2IhfEM66GLre+7jaWZRlkl7V1is2PrLskJyhQFLgw+1VVpiSocf2nK3nFPL/vpU1vg K9QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=bMNpiin0egogJOyiNQBZsiMHvC9MAFsODtP+dA6AAaU=; b=hMrtA+BnlWheX7nCSmjSulUmjI5rneNwglHFmPsqLpsYo/Ee+9hF0zIsnZBxcm5Iyg yGAfxEeR0RlWKZQ3MmL5m2ZKcqQeLjsKVOi77lQe1kxIVwps70Etx9Xw0CT1fU5MfKZU 3UbvVaZMgclqRGg3G6ISAQpGfk3hbG9iyA18nfG+2mWEgROnYo2ra/jCeu2kE5MHnxpT 50jvlK4Cdf+sJRmgH2CS5rxCX/bHbSL6aQk5K9TdVzspj4vQi1ADsIwhqnc7k67I1bIV bRszwoF6pHiVtxz0AAkWkq/t0/WlhOssR9YIFlzcehvNvahafhiECkus6AIXOm05wJ7T X97Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j190-20020a638bc7000000b00524b3efc310si5750069pge.83.2023.05.06.20.57.18; Sat, 06 May 2023 20:57:35 -0700 (PDT) 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; 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 S229918AbjEGC5M convert rfc822-to-8bit (ORCPT + 99 others); Sat, 6 May 2023 22:57:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjEGC5L (ORCPT ); Sat, 6 May 2023 22:57:11 -0400 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A6B0100FC; Sat, 6 May 2023 19:57:10 -0700 (PDT) Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-ba2362d4ea9so658480276.3; Sat, 06 May 2023 19:57:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683428229; x=1686020229; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y27uBZQDxoMMmtt5dKQE+mflLBajPhR2V/YDaYqpNNc=; b=A90SH9+Br6HbaXDq8LUAqmiSeIlDsq262SOZN+mwQwpJKmeMHQrtByTfQpMc2nhdnC jfAyvJzN87Y6cfhHKuZWG+26fO6jjNJu+1497FIwuL0IKiMewIQvUYSiPiqEJwx8XK6i rE8vp5S3RqZ4Q2aZbnOBY9sBR2GKW37gK/q5nwoK1brYVSFiI1UvMbdJINPRjxdXw7ze Iesd09+Z0Dm+6erB/0uItWl6yRuqQQzrjcCq3LfYM44iJzV+CHKyLdgMUxSmQmsWRgmY Vfvc/4FX+a6jO5m5oyRJdU/1aXkrh98Dqm9/+XeUKFS9asrRlHJ4absiejtyFsIAD/fR QXNw== X-Gm-Message-State: AC+VfDwSXVIm6nqoGl2xbQYUEXrlisoYE0nSHt0FXKPS35Qe3gsRtjhI A8NNh/JBRhLn+gknh7fgjA1ZbmyS+kaAQARwRoQ= X-Received: by 2002:a25:e648:0:b0:b9e:712f:4a17 with SMTP id d69-20020a25e648000000b00b9e712f4a17mr6602071ybh.6.1683428229058; Sat, 06 May 2023 19:57:09 -0700 (PDT) MIME-Version: 1.0 References: <20230506021450.3499232-1-irogers@google.com> In-Reply-To: <20230506021450.3499232-1-irogers@google.com> From: Namhyung Kim Date: Sat, 6 May 2023 19:56:56 -0700 Message-ID: Subject: Re: [PATCH v1] perf build: Add system include paths to BPF builds To: Ian Rogers Cc: Song Liu , Yang Jihong , Andrii Nakryiko , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, bpf@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Ian, On Fri, May 5, 2023 at 7:15 PM Ian Rogers wrote: > > There are insufficient headers in tools/include to satisfy building > BPF programs and their header dependencies. Add the system include > paths from the non-BPF clang compile so that these headers can be > found. > > This code was taken from: > tools/testing/selftests/bpf/Makefile > > Signed-off-by: Ian Rogers Thanks, this fixes the BPF build failure on my machine. Tested-by: Namhyung Kim Thanks, Namhyung > --- > tools/perf/Makefile.perf | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf > index 61c33d100b2b..37befdfa8ac8 100644 > --- a/tools/perf/Makefile.perf > +++ b/tools/perf/Makefile.perf > @@ -1057,7 +1057,25 @@ $(SKEL_TMP_OUT) $(LIBAPI_OUTPUT) $(LIBBPF_OUTPUT) $(LIBPERF_OUTPUT) $(LIBSUBCMD_ > > ifndef NO_BPF_SKEL > BPFTOOL := $(SKEL_TMP_OUT)/bootstrap/bpftool > -BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) > + > +# Get Clang's default includes on this system, as opposed to those seen by > +# '-target bpf'. This fixes "missing" files on some architectures/distros, > +# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc. > +# > +# Use '-idirafter': Don't interfere with include mechanics except where the > +# build would have failed anyways. > +define get_sys_includes > +$(shell $(1) $(2) -v -E - &1 \ > + | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \ > +$(shell $(1) $(2) -dM -E - +endef > + > +ifneq ($(CROSS_COMPILE),) > +CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%)) > +endif > + > +CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) > +BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCLUDES) > > $(BPFTOOL): | $(SKEL_TMP_OUT) > $(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \ > -- > 2.40.1.521.gf1e218fcd8-goog >