Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 4/4] selftests/bpf: fix compiling errors
       [not found] ` <1522056208-4004-5-git-send-email-changbin.du@intel.com>
@ 2018-03-26 14:55   ` Alexei Starovoitov
  2018-03-27  2:20     ` Du, Changbin
  2018-03-27  2:33     ` Du, Changbin
  0 siblings, 2 replies; 9+ messages in thread
From: Alexei Starovoitov @ 2018-03-26 14:55 UTC (permalink / raw)
  To: changbin.du; +Cc: shuah, linux-kselftest, linux-kernel, Daniel Borkmann, netdev

On Mon, Mar 26, 2018 at 05:23:28PM +0800, changbin.du@intel.com wrote:
> From: Changbin Du <changbin.du@intel.com>
> 
> This patch fixed below errors of missing head files.
> 
> tools/testing/selftests$ make
> ...
> clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
> 	 -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \
> llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_pkt_access.o
> In file included from test_pkt_access.c:9:
> In file included from ../../../include/uapi/linux/bpf.h:11:
> In file included from ./include/uapi/linux/types.h:5:
> /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
>  #include <asm/bitsperlong.h>
>          ^
> 1 error generated.
> clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
> 	 -O2 -target bpf -emit-llvm -c test_xdp.c -o - |      \
> llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_xdp.o
> In file included from test_xdp.c:9:
> In file included from ../../../include/uapi/linux/bpf.h:11:
> In file included from ./include/uapi/linux/types.h:5:
> /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
>  #include <asm/bitsperlong.h>
>          ^
> 1 error generated.
> clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
> 	 -O2 -target bpf -emit-llvm -c test_l4lb.c -o - |      \
> llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_l4lb.o
> In file included from test_l4lb.c:10:
> In file included from /usr/include/linux/pkt_cls.h:4:
> In file included from ./include/uapi/linux/types.h:5:
> /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
>  #include <asm/bitsperlong.h>
>          ^
> 1 error generated.
> clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
> 	 -O2 -target bpf -emit-llvm -c test_tcp_estats.c -o - |      \
> llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_tcp_estats.o
> In file included from test_tcp_estats.c:35:
> In file included from ../../../include/uapi/linux/bpf.h:11:
> In file included from ./include/uapi/linux/types.h:5:
> /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
>  #include <asm/bitsperlong.h>
> ...
> 
> Signed-off-by: Changbin Du <changbin.du@intel.com>
> ---
>  tools/testing/selftests/bpf/Makefile | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 5c43c18..dc0fdc8 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
>    GENFLAGS := -DHAVE_GENHDR
>  endif
>  
> -CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
> +CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
> +	  -I../../../include -I../../../../usr/include
>  LDLIBS += -lcap -lelf -lrt -lpthread
>  
>  # Order correspond to 'make run_tests' order
> @@ -62,7 +63,7 @@ else
>    CPU ?= generic
>  endif
>  
> -CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
> +CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
>  	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory
itself instead of the outer one.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] selftests/bpf: fix compiling errors
  2018-03-26 14:55   ` [PATCH 4/4] selftests/bpf: fix compiling errors Alexei Starovoitov
@ 2018-03-27  2:20     ` Du, Changbin
  2018-03-27  3:02       ` Alexei Starovoitov
  2018-03-27  2:33     ` Du, Changbin
  1 sibling, 1 reply; 9+ messages in thread
From: Du, Changbin @ 2018-03-27  2:20 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: changbin.du, shuah, linux-kselftest, linux-kernel,
	Daniel Borkmann, netdev

On Mon, Mar 26, 2018 at 07:55:13AM -0700, Alexei Starovoitov wrote:
> On Mon, Mar 26, 2018 at 05:23:28PM +0800, changbin.du@intel.com wrote:
> > Signed-off-by: Changbin Du <changbin.du@intel.com>
> > ---
> >  tools/testing/selftests/bpf/Makefile | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index 5c43c18..dc0fdc8 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
> >    GENFLAGS := -DHAVE_GENHDR
> >  endif
> >  
> > -CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
> > +CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
> > +	  -I../../../include -I../../../../usr/include
> >  LDLIBS += -lcap -lelf -lrt -lpthread
> >  
> >  # Order correspond to 'make run_tests' order
> > @@ -62,7 +63,7 @@ else
> >    CPU ?= generic
> >  endif
> >  
> > -CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
> > +CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
> >  	      -Wno-compare-distinct-pointer-types
> 
> Nack.
> I suspect that will break the build for everyone else who's doing it in the directory
> itself instead of the outer one.
>

This one? But I didn't see any problem.

changbin@gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$ make
make -C ../../../lib/bpf OUTPUT=/home/changbin/work/linux/tools/testing/selftests/bpf/
make[1]: Entering directory '/home/changbin/work/linux/tools/lib/bpf'
  HOSTCC   /home/changbin/work/linux/tools/testing/selftests/bpf/fixdep.o
  HOSTLD   /home/changbin/work/linux/tools/testing/selftests/bpf/fixdep-in.o
  LINK     /home/changbin/work/linux/tools/testing/selftests/bpf/fixdep
  CC       /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.o
  CC       /home/changbin/work/linux/tools/testing/selftests/bpf/bpf.o
  CC       /home/changbin/work/linux/tools/testing/selftests/bpf/nlattr.o
  LD       /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf-in.o
  LINK     /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a
  LINK     /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.so
make[1]: Leaving directory '/home/changbin/work/linux/tools/lib/bpf'
make -C ../../../lib/bpf OUTPUT=/home/changbin/work/linux/tools/testing/selftests/bpf/
make[1]: Entering directory '/home/changbin/work/linux/tools/lib/bpf'
make[1]: Leaving directory '/home/changbin/work/linux/tools/lib/bpf'
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_verifier.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_verifier
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_tag.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tag
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_maps.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_maps
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_lru_map.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_lru_map
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_lpm_map.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_lpm_map
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_progs.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_progs
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_align.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_align
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_verifier_log.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_verifier_log
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_dev_cgroup.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_dev_cgroup
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_tcpbpf_user.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tcpbpf_user
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_libbpf_open.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_libbpf_open
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_xdp.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_xdp.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_l4lb.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_l4lb.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_tcp_estats.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tcp_estats.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_obj_id.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_obj_id.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_md_access.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_md_access.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_xdp_redirect.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_xdp_redirect.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_xdp_meta.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_xdp_meta.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c sockmap_parse_prog.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/sockmap_parse_prog.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c sockmap_verdict_prog.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/sockmap_verdict_prog.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c dev_cgroup.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/dev_cgroup.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c sample_ret0.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/sample_ret0.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_tracepoint.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tracepoint.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types -fno-inline \
         -O2 -target bpf -emit-llvm -c test_l4lb_noinline.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_l4lb_noinline.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types -fno-inline \
         -O2 -target bpf -emit-llvm -c test_xdp_noinline.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_xdp_noinline.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_stacktrace_map.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_stacktrace_map.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c sample_map_ret0.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/sample_map_ret0.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_tcpbpf_kern.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tcpbpf_kern.o
changbin@gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$ 

-- 
Thanks,
Changbin Du

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] selftests/bpf: fix compiling errors
  2018-03-26 14:55   ` [PATCH 4/4] selftests/bpf: fix compiling errors Alexei Starovoitov
  2018-03-27  2:20     ` Du, Changbin
@ 2018-03-27  2:33     ` Du, Changbin
  1 sibling, 0 replies; 9+ messages in thread
From: Du, Changbin @ 2018-03-27  2:33 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: changbin.du, shuah, linux-kselftest, linux-kernel,
	Daniel Borkmann, netdev

Hi Starovoitov,

This one does have the issue you mentioned.
[PATCH 2/4] selftests/gpio: fix paths in Makefile

And can be fixed by:

--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0

+OUTPUT ?= $(shell pwd)
 TEST_PROGS := gpio-mockup.sh
 TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
 BINARIES := gpio-mockup-chardev
@@ -24,7 +25,7 @@ LDLIBS += -lmount -I/usr/include/libmount
 $(BINARIES): gpio-utils.o ../../../../usr/include/linux/gpio.h

 gpio-utils.o:
-       make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+       make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) OUTPUT=$(OUTPUT)/ -C ../../../gpio

 ../../../../usr/include/linux/gpio.h:


I will update it later.

On Mon, Mar 26, 2018 at 07:55:13AM -0700, Alexei Starovoitov wrote:
> On Mon, Mar 26, 2018 at 05:23:28PM +0800, changbin.du@intel.com wrote:
> > From: Changbin Du <changbin.du@intel.com>
> > 
> > This patch fixed below errors of missing head files.
> > 
> > tools/testing/selftests$ make
> > ...
> > clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
> > 	 -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \
> > llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_pkt_access.o
> > In file included from test_pkt_access.c:9:
> > In file included from ../../../include/uapi/linux/bpf.h:11:
> > In file included from ./include/uapi/linux/types.h:5:
> > /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
> >  #include <asm/bitsperlong.h>
> >          ^
> > 1 error generated.
> > clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
> > 	 -O2 -target bpf -emit-llvm -c test_xdp.c -o - |      \
> > llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_xdp.o
> > In file included from test_xdp.c:9:
> > In file included from ../../../include/uapi/linux/bpf.h:11:
> > In file included from ./include/uapi/linux/types.h:5:
> > /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
> >  #include <asm/bitsperlong.h>
> >          ^
> > 1 error generated.
> > clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
> > 	 -O2 -target bpf -emit-llvm -c test_l4lb.c -o - |      \
> > llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_l4lb.o
> > In file included from test_l4lb.c:10:
> > In file included from /usr/include/linux/pkt_cls.h:4:
> > In file included from ./include/uapi/linux/types.h:5:
> > /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
> >  #include <asm/bitsperlong.h>
> >          ^
> > 1 error generated.
> > clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
> > 	 -O2 -target bpf -emit-llvm -c test_tcp_estats.c -o - |      \
> > llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_tcp_estats.o
> > In file included from test_tcp_estats.c:35:
> > In file included from ../../../include/uapi/linux/bpf.h:11:
> > In file included from ./include/uapi/linux/types.h:5:
> > /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
> >  #include <asm/bitsperlong.h>
> > ...
> > 
> > Signed-off-by: Changbin Du <changbin.du@intel.com>
> > ---
> >  tools/testing/selftests/bpf/Makefile | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index 5c43c18..dc0fdc8 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
> >    GENFLAGS := -DHAVE_GENHDR
> >  endif
> >  
> > -CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
> > +CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
> > +	  -I../../../include -I../../../../usr/include
> >  LDLIBS += -lcap -lelf -lrt -lpthread
> >  
> >  # Order correspond to 'make run_tests' order
> > @@ -62,7 +63,7 @@ else
> >    CPU ?= generic
> >  endif
> >  
> > -CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
> > +CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
> >  	      -Wno-compare-distinct-pointer-types
> 
> Nack.
> I suspect that will break the build for everyone else who's doing it in the directory
> itself instead of the outer one.
> 

-- 
Thanks,
Changbin Du

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] selftests/bpf: fix compiling errors
  2018-03-27  2:20     ` Du, Changbin
@ 2018-03-27  3:02       ` Alexei Starovoitov
  2018-03-27  3:06         ` Du, Changbin
  0 siblings, 1 reply; 9+ messages in thread
From: Alexei Starovoitov @ 2018-03-27  3:02 UTC (permalink / raw)
  To: Du, Changbin
  Cc: shuah, linux-kselftest, linux-kernel, Daniel Borkmann, netdev

On Tue, Mar 27, 2018 at 10:20:10AM +0800, Du, Changbin wrote:
> On Mon, Mar 26, 2018 at 07:55:13AM -0700, Alexei Starovoitov wrote:
> > On Mon, Mar 26, 2018 at 05:23:28PM +0800, changbin.du@intel.com wrote:
> > > Signed-off-by: Changbin Du <changbin.du@intel.com>
> > > ---
> > >  tools/testing/selftests/bpf/Makefile | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > > index 5c43c18..dc0fdc8 100644
> > > --- a/tools/testing/selftests/bpf/Makefile
> > > +++ b/tools/testing/selftests/bpf/Makefile
> > > @@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
> > >    GENFLAGS := -DHAVE_GENHDR
> > >  endif
> > >  
> > > -CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
> > > +CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
> > > +	  -I../../../include -I../../../../usr/include
> > >  LDLIBS += -lcap -lelf -lrt -lpthread
> > >  
> > >  # Order correspond to 'make run_tests' order
> > > @@ -62,7 +63,7 @@ else
> > >    CPU ?= generic
> > >  endif
> > >  
> > > -CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
> > > +CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
> > >  	      -Wno-compare-distinct-pointer-types
> > 
> > Nack.
> > I suspect that will break the build for everyone else who's doing it in the directory
> > itself instead of the outer one.
> >
> 
> This one? But I didn't see any problem.

because the build was lucky and additional path ../../../../usr/include didn't point
to a valid dir?
Please test with in-source and out-of-source builds.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] selftests/bpf: fix compiling errors
  2018-03-27  3:02       ` Alexei Starovoitov
@ 2018-03-27  3:06         ` Du, Changbin
  2018-03-27  8:52           ` Daniel Borkmann
  0 siblings, 1 reply; 9+ messages in thread
From: Du, Changbin @ 2018-03-27  3:06 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Du, Changbin, shuah, linux-kselftest, linux-kernel,
	Daniel Borkmann, netdev

On Mon, Mar 26, 2018 at 08:02:30PM -0700, Alexei Starovoitov wrote:
> On Tue, Mar 27, 2018 at 10:20:10AM +0800, Du, Changbin wrote:
> > On Mon, Mar 26, 2018 at 07:55:13AM -0700, Alexei Starovoitov wrote:
> > > On Mon, Mar 26, 2018 at 05:23:28PM +0800, changbin.du@intel.com wrote:
> > > > Signed-off-by: Changbin Du <changbin.du@intel.com>
> > > > ---
> > > >  tools/testing/selftests/bpf/Makefile | 5 +++--
> > > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > > > index 5c43c18..dc0fdc8 100644
> > > > --- a/tools/testing/selftests/bpf/Makefile
> > > > +++ b/tools/testing/selftests/bpf/Makefile
> > > > @@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
> > > >    GENFLAGS := -DHAVE_GENHDR
> > > >  endif
> > > >  
> > > > -CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
> > > > +CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
> > > > +	  -I../../../include -I../../../../usr/include
> > > >  LDLIBS += -lcap -lelf -lrt -lpthread
> > > >  
> > > >  # Order correspond to 'make run_tests' order
> > > > @@ -62,7 +63,7 @@ else
> > > >    CPU ?= generic
> > > >  endif
> > > >  
> > > > -CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
> > > > +CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
> > > >  	      -Wno-compare-distinct-pointer-types
> > > 
> > > Nack.
> > > I suspect that will break the build for everyone else who's doing it in the directory
> > > itself instead of the outer one.
> > >
> > 
> > This one? But I didn't see any problem.
> 
> because the build was lucky and additional path ../../../../usr/include didn't point
> to a valid dir?
I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.

> Please test with in-source and out-of-source builds.
> 
agree.

-- 
Thanks,
Changbin Du

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] selftests/bpf: fix compiling errors
  2018-03-27  3:06         ` Du, Changbin
@ 2018-03-27  8:52           ` Daniel Borkmann
  2018-03-27  9:00             ` Du, Changbin
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Borkmann @ 2018-03-27  8:52 UTC (permalink / raw)
  To: Du, Changbin, Alexei Starovoitov
  Cc: shuah, linux-kselftest, linux-kernel, netdev

On 03/27/2018 05:06 AM, Du, Changbin wrote:
> On Mon, Mar 26, 2018 at 08:02:30PM -0700, Alexei Starovoitov wrote:
>> On Tue, Mar 27, 2018 at 10:20:10AM +0800, Du, Changbin wrote:
>>> On Mon, Mar 26, 2018 at 07:55:13AM -0700, Alexei Starovoitov wrote:
>>>> On Mon, Mar 26, 2018 at 05:23:28PM +0800, changbin.du@intel.com wrote:
>>>>> Signed-off-by: Changbin Du <changbin.du@intel.com>
>>>>> ---
>>>>>  tools/testing/selftests/bpf/Makefile | 5 +++--
>>>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
>>>>> index 5c43c18..dc0fdc8 100644
>>>>> --- a/tools/testing/selftests/bpf/Makefile
>>>>> +++ b/tools/testing/selftests/bpf/Makefile
>>>>> @@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
>>>>>    GENFLAGS := -DHAVE_GENHDR
>>>>>  endif
>>>>>  
>>>>> -CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
>>>>> +CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
>>>>> +	  -I../../../include -I../../../../usr/include
>>>>>  LDLIBS += -lcap -lelf -lrt -lpthread
>>>>>  
>>>>>  # Order correspond to 'make run_tests' order
>>>>> @@ -62,7 +63,7 @@ else
>>>>>    CPU ?= generic
>>>>>  endif
>>>>>  
>>>>> -CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
>>>>> +CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
>>>>>  	      -Wno-compare-distinct-pointer-types
>>>>
>>>> Nack.
>>>> I suspect that will break the build for everyone else who's doing it in the directory
>>>> itself instead of the outer one.
>>>
>>> This one? But I didn't see any problem.
>>
>> because the build was lucky and additional path ../../../../usr/include didn't point
>> to a valid dir?

Agree.

> I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.

The problem is that this suddenly requires users to do a 'make headers_install' in
order to populate usr/include/ directory in the first place. While it's annoying
enough for BPF samples where this is needed, I absolutely don't want to introduce
this for BPF kselftests. It's the wrong approach. Besides, in tools infra, there is
a tools/arch/*/include/uapi/asm/bitsperlong.h header copy already, so we really need
to use that instead. Please adapt your patch accordingly and respin. Please also Cc
us and netdev@vger.kernel.org for BPF kselftests changes.

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] selftests/bpf: fix compiling errors
  2018-03-27  8:52           ` Daniel Borkmann
@ 2018-03-27  9:00             ` Du, Changbin
  2018-03-27  9:52               ` Daniel Borkmann
  0 siblings, 1 reply; 9+ messages in thread
From: Du, Changbin @ 2018-03-27  9:00 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: Du, Changbin, Alexei Starovoitov, shuah, linux-kselftest,
	linux-kernel, netdev

On Tue, Mar 27, 2018 at 10:52:57AM +0200, Daniel Borkmann wrote:
> On 03/27/2018 05:06 AM, Du, Changbin wrote:
> > On Mon, Mar 26, 2018 at 08:02:30PM -0700, Alexei Starovoitov wrote:
> >> On Tue, Mar 27, 2018 at 10:20:10AM +0800, Du, Changbin wrote:
> >>> On Mon, Mar 26, 2018 at 07:55:13AM -0700, Alexei Starovoitov wrote:
> >>>> On Mon, Mar 26, 2018 at 05:23:28PM +0800, changbin.du@intel.com wrote:
> >>>>> Signed-off-by: Changbin Du <changbin.du@intel.com>
> >>>>> ---
> >>>>>  tools/testing/selftests/bpf/Makefile | 5 +++--
> >>>>>  1 file changed, 3 insertions(+), 2 deletions(-)
> >>>>>
> >>>>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> >>>>> index 5c43c18..dc0fdc8 100644
> >>>>> --- a/tools/testing/selftests/bpf/Makefile
> >>>>> +++ b/tools/testing/selftests/bpf/Makefile
> >>>>> @@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
> >>>>>    GENFLAGS := -DHAVE_GENHDR
> >>>>>  endif
> >>>>>  
> >>>>> -CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
> >>>>> +CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
> >>>>> +	  -I../../../include -I../../../../usr/include
> >>>>>  LDLIBS += -lcap -lelf -lrt -lpthread
> >>>>>  
> >>>>>  # Order correspond to 'make run_tests' order
> >>>>> @@ -62,7 +63,7 @@ else
> >>>>>    CPU ?= generic
> >>>>>  endif
> >>>>>  
> >>>>> -CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
> >>>>> +CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
> >>>>>  	      -Wno-compare-distinct-pointer-types
> >>>>
> >>>> Nack.
> >>>> I suspect that will break the build for everyone else who's doing it in the directory
> >>>> itself instead of the outer one.
> >>>
> >>> This one? But I didn't see any problem.
> >>
> >> because the build was lucky and additional path ../../../../usr/include didn't point
> >> to a valid dir?
> 
> Agree.
> 
> > I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.
> 
> The problem is that this suddenly requires users to do a 'make headers_install' in
> order to populate usr/include/ directory in the first place. While it's annoying
> enough for BPF samples where this is needed, I absolutely don't want to introduce
> this for BPF kselftests. It's the wrong approach. Besides, in tools infra, there is
> a tools/arch/*/include/uapi/asm/bitsperlong.h header copy already, so we really need
> to use that instead. Please adapt your patch accordingly and respin. Please also Cc
> us and netdev@vger.kernel.org for BPF kselftests changes.
> 
> Thanks,
> Daniel
Thanks for the explanation. So we expect that tools/arch/*/include is in the searching list, right?
The corrent makefile seems not. How do you get this built?

changbin@gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$ make -p
[...]
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o
In file included from test_pkt_access.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
#include <asm/bitsperlong.h>


-- 
Thanks,
Changbin Du

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] selftests/bpf: fix compiling errors
  2018-03-27  9:00             ` Du, Changbin
@ 2018-03-27  9:52               ` Daniel Borkmann
  2018-03-27 10:19                 ` Du, Changbin
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Borkmann @ 2018-03-27  9:52 UTC (permalink / raw)
  To: Du, Changbin
  Cc: Alexei Starovoitov, shuah, linux-kselftest, linux-kernel, netdev

On 03/27/2018 11:00 AM, Du, Changbin wrote:
> On Tue, Mar 27, 2018 at 10:52:57AM +0200, Daniel Borkmann wrote:
>> On 03/27/2018 05:06 AM, Du, Changbin wrote:
>>> On Mon, Mar 26, 2018 at 08:02:30PM -0700, Alexei Starovoitov wrote:
>>>> On Tue, Mar 27, 2018 at 10:20:10AM +0800, Du, Changbin wrote:
>>>>> On Mon, Mar 26, 2018 at 07:55:13AM -0700, Alexei Starovoitov wrote:
>>>>>> On Mon, Mar 26, 2018 at 05:23:28PM +0800, changbin.du@intel.com wrote:
>>>>>>> Signed-off-by: Changbin Du <changbin.du@intel.com>
>>>>>>> ---
>>>>>>>  tools/testing/selftests/bpf/Makefile | 5 +++--
>>>>>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>>>>>
>>>>>>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
>>>>>>> index 5c43c18..dc0fdc8 100644
>>>>>>> --- a/tools/testing/selftests/bpf/Makefile
>>>>>>> +++ b/tools/testing/selftests/bpf/Makefile
>>>>>>> @@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
>>>>>>>    GENFLAGS := -DHAVE_GENHDR
>>>>>>>  endif
>>>>>>>  
>>>>>>> -CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
>>>>>>> +CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
>>>>>>> +	  -I../../../include -I../../../../usr/include
>>>>>>>  LDLIBS += -lcap -lelf -lrt -lpthread
>>>>>>>  
>>>>>>>  # Order correspond to 'make run_tests' order
>>>>>>> @@ -62,7 +63,7 @@ else
>>>>>>>    CPU ?= generic
>>>>>>>  endif
>>>>>>>  
>>>>>>> -CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
>>>>>>> +CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
>>>>>>>  	      -Wno-compare-distinct-pointer-types
>>>>>>
>>>>>> Nack.
>>>>>> I suspect that will break the build for everyone else who's doing it in the directory
>>>>>> itself instead of the outer one.
>>>>>
>>>>> This one? But I didn't see any problem.
>>>>
>>>> because the build was lucky and additional path ../../../../usr/include didn't point
>>>> to a valid dir?
>>
>> Agree.
>>
>>> I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.
>>
>> The problem is that this suddenly requires users to do a 'make headers_install' in
>> order to populate usr/include/ directory in the first place. While it's annoying
>> enough for BPF samples where this is needed, I absolutely don't want to introduce
>> this for BPF kselftests. It's the wrong approach. Besides, in tools infra, there is
>> a tools/arch/*/include/uapi/asm/bitsperlong.h header copy already, so we really need
>> to use that instead. Please adapt your patch accordingly and respin. Please also Cc
>> us and netdev@vger.kernel.org for BPF kselftests changes.
>>
> Thanks for the explanation. So we expect that tools/arch/*/include is in the searching list, right?
> The corrent makefile seems not. How do you get this built?

E.g. take a look at tools/include/asm/barrier.h or tools/include/uapi/asm/bpf_perf_event.h
just to name two examples. We'd need something similar to this which then points to the
arch specific includes.

Thanks,
Daniel

> changbin@gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$ make -p
> [...]
> clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
>          -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \
> llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o
> In file included from test_pkt_access.c:9:
> In file included from ../../../include/uapi/linux/bpf.h:11:
> In file included from ./include/uapi/linux/types.h:5:
> /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
> #include <asm/bitsperlong.h>
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] selftests/bpf: fix compiling errors
  2018-03-27  9:52               ` Daniel Borkmann
@ 2018-03-27 10:19                 ` Du, Changbin
  0 siblings, 0 replies; 9+ messages in thread
From: Du, Changbin @ 2018-03-27 10:19 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: Du, Changbin, Alexei Starovoitov, shuah, linux-kselftest,
	linux-kernel, netdev

On Tue, Mar 27, 2018 at 11:52:27AM +0200, Daniel Borkmann wrote:
> On 03/27/2018 11:00 AM, Du, Changbin wrote:
> > On Tue, Mar 27, 2018 at 10:52:57AM +0200, Daniel Borkmann wrote:
> >> On 03/27/2018 05:06 AM, Du, Changbin wrote:
> >>> On Mon, Mar 26, 2018 at 08:02:30PM -0700, Alexei Starovoitov wrote:
> >>>> On Tue, Mar 27, 2018 at 10:20:10AM +0800, Du, Changbin wrote:
> >>>>> On Mon, Mar 26, 2018 at 07:55:13AM -0700, Alexei Starovoitov wrote:
> >>>>>> On Mon, Mar 26, 2018 at 05:23:28PM +0800, changbin.du@intel.com wrote:
> >>>>>>> Signed-off-by: Changbin Du <changbin.du@intel.com>
> >>>>>>> ---
> >>>>>>>  tools/testing/selftests/bpf/Makefile | 5 +++--
> >>>>>>>  1 file changed, 3 insertions(+), 2 deletions(-)
> >>>>>>>
> >>>>>>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> >>>>>>> index 5c43c18..dc0fdc8 100644
> >>>>>>> --- a/tools/testing/selftests/bpf/Makefile
> >>>>>>> +++ b/tools/testing/selftests/bpf/Makefile
> >>>>>>> @@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
> >>>>>>>    GENFLAGS := -DHAVE_GENHDR
> >>>>>>>  endif
> >>>>>>>  
> >>>>>>> -CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
> >>>>>>> +CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
> >>>>>>> +	  -I../../../include -I../../../../usr/include
> >>>>>>>  LDLIBS += -lcap -lelf -lrt -lpthread
> >>>>>>>  
> >>>>>>>  # Order correspond to 'make run_tests' order
> >>>>>>> @@ -62,7 +63,7 @@ else
> >>>>>>>    CPU ?= generic
> >>>>>>>  endif
> >>>>>>>  
> >>>>>>> -CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
> >>>>>>> +CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
> >>>>>>>  	      -Wno-compare-distinct-pointer-types
> >>>>>>
> >>>>>> Nack.
> >>>>>> I suspect that will break the build for everyone else who's doing it in the directory
> >>>>>> itself instead of the outer one.
> >>>>>
> >>>>> This one? But I didn't see any problem.
> >>>>
> >>>> because the build was lucky and additional path ../../../../usr/include didn't point
> >>>> to a valid dir?
> >>
> >> Agree.
> >>
> >>> I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.
> >>
> >> The problem is that this suddenly requires users to do a 'make headers_install' in
> >> order to populate usr/include/ directory in the first place. While it's annoying
> >> enough for BPF samples where this is needed, I absolutely don't want to introduce
> >> this for BPF kselftests. It's the wrong approach. Besides, in tools infra, there is
> >> a tools/arch/*/include/uapi/asm/bitsperlong.h header copy already, so we really need
> >> to use that instead. Please adapt your patch accordingly and respin. Please also Cc
> >> us and netdev@vger.kernel.org for BPF kselftests changes.
> >>
> > Thanks for the explanation. So we expect that tools/arch/*/include is in the searching list, right?
> > The corrent makefile seems not. How do you get this built?
> 
> E.g. take a look at tools/include/asm/barrier.h or tools/include/uapi/asm/bpf_perf_event.h
> just to name two examples. We'd need something similar to this which then points to the
> arch specific includes.
> 
> Thanks,
> Daniel
>
ok, I see. But I am going to skip this fix this time. Because one get fixed, another appears.
IMHO, It doesn't sound like a good idea to sync all these files manually. We should have
better solution I think.

clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o
In file included from test_pkt_access.c:12:
/usr/include/linux/ip.h:20:10: fatal error: 'asm/byteorder.h' file not found
#include <asm/byteorder.h>

 
> > changbin@gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$ make -p
> > [...]
> > clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
> >          -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \
> > llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o
> > In file included from test_pkt_access.c:9:
> > In file included from ../../../include/uapi/linux/bpf.h:11:
> > In file included from ./include/uapi/linux/types.h:5:
> > /usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
> > #include <asm/bitsperlong.h>
> > 
> > 
> 

-- 
Thanks,
Changbin Du

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-03-27 10:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1522056208-4004-1-git-send-email-changbin.du@intel.com>
     [not found] ` <1522056208-4004-5-git-send-email-changbin.du@intel.com>
2018-03-26 14:55   ` [PATCH 4/4] selftests/bpf: fix compiling errors Alexei Starovoitov
2018-03-27  2:20     ` Du, Changbin
2018-03-27  3:02       ` Alexei Starovoitov
2018-03-27  3:06         ` Du, Changbin
2018-03-27  8:52           ` Daniel Borkmann
2018-03-27  9:00             ` Du, Changbin
2018-03-27  9:52               ` Daniel Borkmann
2018-03-27 10:19                 ` Du, Changbin
2018-03-27  2:33     ` Du, Changbin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox