Re: Question about "asm/rwonce.h: No such file or directory"
From: Masahiro Yamada
Date: Tue Nov 12 2019 - 07:51:20 EST
On Tue, Nov 12, 2019 at 9:31 PM Will Deacon <will@xxxxxxxxxx> wrote:
>
> [+lkml, Masahiro, Alexei and Daniel]
>
> On Tue, Nov 12, 2019 at 04:56:39PM +0800, Xiao Yang wrote:
> > With your patch[1], I alway get the following error when building
> > tools/bpf:
>
> In case people want to reproduce this, my branch is here:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/log/?h=lto
>
> > ----------------------------------------------------------------------------------
> >
> > make -C tools/bpf/
> > make: Entering directory
> > '/usr/src/perf_selftests-x86_64-rhel-7.6-642a312d47ceb54603630d9d04f5052f3b46d9a3/tools/bpf'
> >
> > Auto-detecting system features:
> > ... libbfd: [ on ]
> > ... disassembler-four-args: [ OFF ]
> >
> > CC bpf_jit_disasm.o
> > CC bpf_dbg.o
> > In file included from
> > /usr/src/perf_selftests-x86_64-rhel-7.6-642a312d47ceb54603630d9d04f5052f3b46d9a3/include/uapi/linux/filter.h:9:0,
> > from
> > /usr/src/perf_selftests-x86_64-rhel-7.6-642a312d47ceb54603630d9d04f5052f3b46d9a3/tools/bpf/bpf_dbg.c:41:
> > /usr/src/perf_selftests-x86_64-rhel-7.6-642a312d47ceb54603630d9d04f5052f3b46d9a3/include/linux/compiler.h:247:24:
> > fatal error: asm/rwonce.h: No such file or directory
> > #include <asm/rwonce.h>
> > ^
> > compilation terminated.
> > Makefile:61: recipe for target 'bpf_dbg.o' failed
> > make: *** [bpf_dbg.o] Error 1
> > make: *** Waiting for unfinished jobs....
> > make: Leaving directory
> >
> > ----------------------------------------------------------------------------------
> >
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/commit/?h=lto&id=642a312d47ceb54603630d9d04f5052f3b46d9a3
> >
> > It seems that include/linux/compiler.h cannot find the asm/rwonce.h because
> > tools/bpf/Makefile doesn't include arch/*/include/generated/asm/rwonce.h.
>
> The problem with referring to the generated files is that they don't exist
> unless you've configured the main source directory. The real problem here
> seems to be that tools/bpf/ refers directly to header files in the kernel
> sources without any understanding of kbuild, and therefore mandatory-y
> headers simply don't exist when it goes looking for them.
Please note tools/ is out of scope of Kbuild.
The tools/ created a completely different build system.
tools/bpf/ looks like a host program.
Does it include a kernel-space header
of the target architecture?
I see a lots of header duplication in tools/include/,
but I am not sure if
tools/include/linux/filter.h is the correct header
to include.
>
> Perhaps it's possible to introduce a dependency on a top-level "make
> asm-generic" so that we can reference the generated headers from the arch
> directly. Thoughts?
>
> Will
--
Best Regards
Masahiro Yamada