2020-03-12 11:46 UTC+0000 ~ Quentin Monnet <quentin@xxxxxxxxxxxxx> > 2020-03-11 15:18 UTC-0700 ~ Song Liu <songliubraving@xxxxxx> >> Add the dependency to libbpf, to fix build errors like: >> >> In file included from skeleton/profiler.bpf.c:5: >> .../bpf_helpers.h:5:10: fatal error: 'bpf_helper_defs.h' file not found >> #include "bpf_helper_defs.h" >> ^~~~~~~~~~~~~~~~~~~ >> 1 error generated. >> make: *** [skeleton/profiler.bpf.o] Error 1 >> make: *** Waiting for unfinished jobs.... >> >> Fixes: 47c09d6a9f67 ("bpftool: Introduce "prog profile" command") >> Acked-by: John Fastabend <john.fastabend@xxxxxxxxx> >> Signed-off-by: Song Liu <songliubraving@xxxxxx> > > Reviewed-by: Quentin Monnet <quentin@xxxxxxxxxxxxx> > Sorry, I gave the tag too fast. This one is not solved on my machine, I still observe the same error when building out of tree, e.g. if I compile with e.g. "make O=/tmp/foo". This is because make does not know where to find bpf_helper_defs.h in that case. I could solve it with the additional diff: ---- diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile index 45a37e2fb6e6..8b765993598b 100644 --- a/tools/bpf/bpftool/Makefile +++ b/tools/bpf/bpftool/Makefile @@ -127,7 +127,7 @@ $(OUTPUT)_bpftool: $(_OBJS) $(LIBBPF) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(_OBJS) $(LIBS) skeleton/profiler.bpf.o: skeleton/profiler.bpf.c $(LIBBPF) - $(QUIET_CLANG)$(CLANG) -I$(srctree)/tools/lib -g -O2 -target bpf -c $< -o $@ + $(QUIET_CLANG)$(CLANG) -I$(srctree)/tools/lib -I$(LIBBPF_PATH) -g -O2 -target bpf -c $< -o $@ profiler.skel.h: $(OUTPUT)_bpftool skeleton/profiler.bpf.o $(QUIET_GEN)$(OUTPUT)./_bpftool gen skeleton skeleton/profiler.bpf.o > $@ ---- tools/testing/selftests/bpf/test_bpftool_build.sh seems happy on my setup with the above. Best regards, Quentin