Message ID | 20200311221844.3089820-3-songliubraving@fb.com |
---|---|
State | Changes Requested |
Delegated to: | BPF Maintainers |
Headers | show |
Series | Fixes for bpftool-prog-profile | expand |
2020-03-11 15:18 UTC-0700 ~ Song Liu <songliubraving@fb.com> > 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@gmail.com> > Signed-off-by: Song Liu <songliubraving@fb.com> Reviewed-by: Quentin Monnet <quentin@isovalent.com>
2020-03-12 11:46 UTC+0000 ~ Quentin Monnet <quentin@isovalent.com> > 2020-03-11 15:18 UTC-0700 ~ Song Liu <songliubraving@fb.com> >> 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@gmail.com> >> Signed-off-by: Song Liu <songliubraving@fb.com> > > Reviewed-by: Quentin Monnet <quentin@isovalent.com> > 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
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile index 0d9ede8e7340..45a37e2fb6e6 100644 --- a/tools/bpf/bpftool/Makefile +++ b/tools/bpf/bpftool/Makefile @@ -126,7 +126,7 @@ $(OUTPUT)_prog.o: prog.c $(OUTPUT)_bpftool: $(_OBJS) $(LIBBPF) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(_OBJS) $(LIBS) -skeleton/profiler.bpf.o: skeleton/profiler.bpf.c +skeleton/profiler.bpf.o: skeleton/profiler.bpf.c $(LIBBPF) $(QUIET_CLANG)$(CLANG) -I$(srctree)/tools/lib -g -O2 -target bpf -c $< -o $@ profiler.skel.h: $(OUTPUT)_bpftool skeleton/profiler.bpf.o