2020-06-24 06:46:21

by Li Xinhai

[permalink] [raw]
Subject: tools/bpf: build failed with defconfig(x86_64) on v5.6 and v5.7

- 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);
  ^~~~~~~~~~~~
```

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
```

On this same machine and with same configuration, I've tried v5.4 and v5.5, no failures.



2020-06-24 19:29:23

by Andrii Nakryiko

[permalink] [raw]
Subject: Re: tools/bpf: build failed with defconfig(x86_64) on v5.6 and v5.7

On Tue, Jun 23, 2020 at 11:46 PM Li Xinhai <[email protected]> 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.
>
>