2022-05-30 13:25:59

by Lina Wang

[permalink] [raw]
Subject: [PATCH] selftests net: fix bpf build error

bpf_helpers.h has been moved to tools/lib/bpf since 5.10, so add more
incliding path.

Fixes: edae34a3ed92 ("selftests net: add UDP GRO fraglist + bpf self-tests")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Lina Wang <[email protected]>
---
tools/testing/selftests/net/bpf/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/net/bpf/Makefile b/tools/testing/selftests/net/bpf/Makefile
index f91bf14bbee7..070251986dbe 100644
--- a/tools/testing/selftests/net/bpf/Makefile
+++ b/tools/testing/selftests/net/bpf/Makefile
@@ -2,6 +2,7 @@

CLANG ?= clang
CCINCLUDE += -I../../bpf
+CCINCLUDE += -I../../../../lib
CCINCLUDE += -I../../../../../usr/include/

TEST_CUSTOM_PROGS = $(OUTPUT)/bpf/nat6to4.o
--
2.18.0



2022-06-01 19:13:26

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH] selftests net: fix bpf build error

On 5/30/22 8:21 AM, Lina Wang wrote:
> bpf_helpers.h has been moved to tools/lib/bpf since 5.10, so add more
> incliding path.
>
> Fixes: edae34a3ed92 ("selftests net: add UDP GRO fraglist + bpf self-tests")
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Lina Wang <[email protected]>
> ---
> tools/testing/selftests/net/bpf/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/net/bpf/Makefile b/tools/testing/selftests/net/bpf/Makefile
> index f91bf14bbee7..070251986dbe 100644
> --- a/tools/testing/selftests/net/bpf/Makefile
> +++ b/tools/testing/selftests/net/bpf/Makefile
> @@ -2,6 +2,7 @@
>
> CLANG ?= clang
> CCINCLUDE += -I../../bpf
> +CCINCLUDE += -I../../../../lib
> CCINCLUDE += -I../../../../../usr/include/
>
> TEST_CUSTOM_PROGS = $(OUTPUT)/bpf/nat6to4.o
>

From building the selftest in general, I'm getting:

clang -O2 -target bpf -c bpf/nat6to4.c -I../../bpf -I../../../../lib -I../../../../../usr/include/ -o /root/daniel/bpf/tools/testing/selftests/net/bpf/nat6to4.o
In file included from bpf/nat6to4.c:27:
In file included from /usr/include/linux/bpf.h:11:
/usr/include/linux/types.h:5:10: fatal error: 'asm/types.h' file not found
#include <asm/types.h>
^~~~~~~~~~~~~
1 error generated.

Could we reuse the build infra from tools/testing/selftests/bpf/ for nat6to4.c?

2022-06-01 21:00:22

by Song Liu

[permalink] [raw]
Subject: Re: [PATCH] selftests net: fix bpf build error

On Sun, May 29, 2022 at 11:28 PM Lina Wang <[email protected]> wrote:
>
> bpf_helpers.h has been moved to tools/lib/bpf since 5.10, so add more
> incliding path.
nit: including

>
> Fixes: edae34a3ed92 ("selftests net: add UDP GRO fraglist + bpf self-tests")
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Lina Wang <[email protected]>

Acked-by: Song Liu <[email protected]>


> ---
> tools/testing/selftests/net/bpf/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/net/bpf/Makefile b/tools/testing/selftests/net/bpf/Makefile
> index f91bf14bbee7..070251986dbe 100644
> --- a/tools/testing/selftests/net/bpf/Makefile
> +++ b/tools/testing/selftests/net/bpf/Makefile
> @@ -2,6 +2,7 @@
>
> CLANG ?= clang
> CCINCLUDE += -I../../bpf
> +CCINCLUDE += -I../../../../lib
> CCINCLUDE += -I../../../../../usr/include/
>
> TEST_CUSTOM_PROGS = $(OUTPUT)/bpf/nat6to4.o
> --
> 2.18.0
>