From: Leo Yan <leo.yan@arm.com>
To: hupu <hupu.gm@gmail.com>
Cc: namhyung@kernel.org, acme@kernel.org, adrian.hunter@intel.com,
alexander.shishkin@linux.intel.com, irogers@google.com,
jolsa@kernel.org, justinstitt@google.com,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
mark.rutland@arm.com, mingo@redhat.com, morbo@google.com,
nathan@kernel.org, nick.desaulniers+lkml@gmail.com,
peterz@infradead.org
Subject: Re: [RFC] perf build: Use self-contained headers from kernel source when compiling
Date: Tue, 25 Nov 2025 16:39:20 +0000 [thread overview]
Message-ID: <20251125163920.GG724103@e132581.arm.com> (raw)
In-Reply-To: <20251124072310.3592-1-hupu.gm@gmail.com>
On Mon, Nov 24, 2025 at 03:23:10PM +0800, hupu wrote:
> When building perf, switch to using the self-contained headers provided
> in the kernel source tree to avoid build failures caused by missing
> architecture-specific headers. For example, the build may fail with
> errors like:
>
> /usr/include/linux/ioctl.h:5:10: fatal error: 'asm/ioctl.h' file not
> found
> 5 | #include <asm/ioctl.h>
> | ^~~~~~~~~~~~~
>
> This issue may occur because system-installed headers are incomplete,
> incompatible with the kernel version being built, or the corresponding
> architecture-specific headers are not installed at all. Using the
> self-contained headers from the kernel source ensures a consistent and
> compatible build environment.
>
> Signed-off-by: hupu <hupu.gm@gmail.com>
> ---
> tools/perf/Makefile.perf | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 47c906b807ef..eaccaae87e3c 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -1202,7 +1202,9 @@ endif
>
> CLANG_OPTIONS = -Wall
> CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
> -BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCLUDES)
> +KHDR_INCLUDES := $(abspath $(OUTPUT)/../../usr/include)
This doesn't work if use the commands:
make -j `nproc` Image O=$OUT
make headers_install O=$OUT
make O=$OUT -C tools/perf VF=1 CORESIGHT=1 DEBUG=1
Maybe it is good to search possible paths:
$(abspath ../../usr/include) => Build in local folder
$(abspath $(OUTPUT)usr/include) => Build in a specified folder
> +BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) \
> + -I$(KHDR_INCLUDES) $(CLANG_SYS_INCLUDES)
Why the issue only happens for eBPF skel build but not for perf binary
build? As I said in another reply, I'd consolidate options for both
cases.
Thanks,
Leo
next prev parent reply other threads:[~2025-11-25 16:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 7:23 [RFC] perf build: Use self-contained headers from kernel source when compiling hupu
2025-11-24 7:51 ` hupu
2025-11-25 13:12 ` hupu
2025-11-25 16:39 ` Leo Yan [this message]
2025-12-05 6:29 ` hupu
2025-12-08 9:04 ` hupu
2025-12-10 10:24 ` hupu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251125163920.GG724103@e132581.arm.com \
--to=leo.yan@arm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=hupu.gm@gmail.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).