Re: tools/bpf: build failed with defconfig(x86_64) on v5.6 and v5.7
From: Andrii Nakryiko
Date: Wed Jun 24 2020 - 15:27:33 EST
On Tue, Jun 23, 2020 at 11:46 PM Li Xinhai <lixinhai.lxh@xxxxxxxxx> wrote:
>
> - information of machine
> Linux localhost.localdomain 4.18.0-193.6.3.el8_2.x86_64 #1 SMP Wed Jun 10 11:09:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
>
> - configurations
> make defconfig
> make kvmconfig
>
> - failed logs on v5.6
> ```
> LINK /mnt/build/1_build/05_build_v5.6/bpf/bpftool//libbpf/libbpf.a
> LINK /mnt/build/1_build/05_build_v5.6/bpf/bpftool/bpftool
> DESCEND runqslower
> GEN /mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/bpf_helper_defs.h
> make[4]: *** No rule to make target '/mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h', needed by '/mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/staticobjs/libbpf.o'. Stop.
> make[3]: *** [Makefile:183: /mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/staticobjs/libbpf-in.o] Error 2
> make[2]: *** [Makefile:79: .output/libbpf.a] Error 2
> make[1]: *** [Makefile:119: runqslower] Error 2
> make: *** [Makefile:68: bpf] Error 2
> ```
>
> - failed logs on v5.7
> ```
> In file included from /mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h:5,
> from /mnt/build/0_code/0_linux/linux/tools/include/linux/kernel.h:8,
> from /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.h:10,
> from /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.c:8:
> /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.c: In function â__func_get_nameâ:
> /mnt/build/0_code/0_linux/linux/tools/include/linux/compiler.h:37:38: warning: nested extern declaration of â__compiletime_assert_0â [-Wnested-externs]
> _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> ^~~~~~~~~~~~~~~~~~~~~
> /mnt/build/0_code/0_linux/linux/tools/include/linux/compiler.h:16:15: note: in definition of macro â__compiletime_assertâ
> extern void prefix ## suffix(void) __compiletime_error(msg); \
> ^~~~~~
> /mnt/build/0_code/0_linux/linux/tools/include/linux/compiler.h:37:2: note: in expansion of macro â_compiletime_assertâ
> _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> ^~~~~~~~~~~~~~~~~~~
> /mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h:39:37: note: in expansion of macro âcompiletime_assertâ
> #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> ^~~~~~~~~~~~~~~~~~
> /mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h:50:2: note: in expansion of macro âBUILD_BUG_ON_MSGâ
> BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> ^~~~~~~~~~~~~~~~
> /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.c:20:2: note: in expansion of macro âBUILD_BUG_ONâ
> BUILD_BUG_ON(ARRAY_SIZE(func_id_str) != __BPF_FUNC_MAX_ID);
> ^~~~~~~~~~~~
> ```
>
This one I've seen and I have no idea why this is happening (suddenly)
and how to fix that.
> and
> ```
> LINK /mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/libbpf.a
> GEN vmlinux.h
> BPF runqslower.bpf.o
> In file included from runqslower.bpf.c:3:
> .output/vmlinux.h:5:15: error: attribute 'preserve_access_index' is not supported by '#pragma clang attribute'
> #pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
> ^
> .output/vmlinux.h:98607:15: error: '#pragma clang attribute pop' with no matching '#pragma clang attribute push'
> #pragma clang attribute pop
> ^
> 2 errors generated.
> make[2]: *** [Makefile:57: .output/runqslower.bpf.o] Error 1
> make[1]: *** [Makefile:119: runqslower] Error 2
> make: *** [Makefile:68: bpf] Error 2
> ```
>
This just means you don't have recent-enough Clang on your system. You
need Clang 10 at least.
> On this same machine and with same configuration, I've tried v5.4 and v5.5, no failures.
>
>