Message ID | 20200311123421.3634-1-tklauser@distanz.ch |
---|---|
State | Changes Requested |
Delegated to: | BPF Maintainers |
Headers | show |
Series | bpftool: fix iprofiler build on systems without /usr/include/asm symlink | expand |
Tobias Klauser <tklauser@distanz.ch> writes: > When compiling bpftool on a system where the /usr/include/asm symlink > doesn't exist (e.g. on an Ubuntu system without gcc-multilib installed), > the build fails with: > > CLANG skeleton/profiler.bpf.o > In file included from skeleton/profiler.bpf.c:4: > 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. > make: *** [Makefile:123: skeleton/profiler.bpf.o] Error 1 > > To fix this, add /usr/include/$(uname -m)-linux-gnu to the clang search > path so <asm/types.h> can be found. Isn't the right thing here to just install gcc-multilib? -Toke
On 2020-03-11 at 13:49:53 +0100, Toke Høiland-Jørgensen <toke@redhat.com> wrote: > Tobias Klauser <tklauser@distanz.ch> writes: > > > When compiling bpftool on a system where the /usr/include/asm symlink > > doesn't exist (e.g. on an Ubuntu system without gcc-multilib installed), > > the build fails with: > > > > CLANG skeleton/profiler.bpf.o > > In file included from skeleton/profiler.bpf.c:4: > > 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. > > make: *** [Makefile:123: skeleton/profiler.bpf.o] Error 1 > > > > To fix this, add /usr/include/$(uname -m)-linux-gnu to the clang search > > path so <asm/types.h> can be found. > > Isn't the right thing here to just install gcc-multilib? For a container build we would like to avoid installing gcc-multilib which pulls in additional dependencies which are otherwise not needed to build bpftool. This patch would allow that. Tobias
Tobias Klauser <tklauser@distanz.ch> writes: > On 2020-03-11 at 13:49:53 +0100, Toke Høiland-Jørgensen <toke@redhat.com> wrote: >> Tobias Klauser <tklauser@distanz.ch> writes: >> >> > When compiling bpftool on a system where the /usr/include/asm symlink >> > doesn't exist (e.g. on an Ubuntu system without gcc-multilib installed), >> > the build fails with: >> > >> > CLANG skeleton/profiler.bpf.o >> > In file included from skeleton/profiler.bpf.c:4: >> > 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. >> > make: *** [Makefile:123: skeleton/profiler.bpf.o] Error 1 >> > >> > To fix this, add /usr/include/$(uname -m)-linux-gnu to the clang search >> > path so <asm/types.h> can be found. >> >> Isn't the right thing here to just install gcc-multilib? > > For a container build we would like to avoid installing gcc-multilib > which pulls in additional dependencies which are otherwise not needed to > build bpftool. This patch would allow that. Ah, right. Well, stating that use case in the commit message would have been nice :) I'm personally a little skeptical about having to add this (how many weird build systems should we support?), but I can also see where you're coming from. Up to the maintainers, I suppose... -Toke
On 2020-03-11 at 15:24:23 +0100, Toke Høiland-Jørgensen <toke@redhat.com> wrote: > Tobias Klauser <tklauser@distanz.ch> writes: > > > On 2020-03-11 at 13:49:53 +0100, Toke Høiland-Jørgensen <toke@redhat.com> wrote: > >> Tobias Klauser <tklauser@distanz.ch> writes: > >> > >> > When compiling bpftool on a system where the /usr/include/asm symlink > >> > doesn't exist (e.g. on an Ubuntu system without gcc-multilib installed), > >> > the build fails with: > >> > > >> > CLANG skeleton/profiler.bpf.o > >> > In file included from skeleton/profiler.bpf.c:4: > >> > 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. > >> > make: *** [Makefile:123: skeleton/profiler.bpf.o] Error 1 > >> > > >> > To fix this, add /usr/include/$(uname -m)-linux-gnu to the clang search > >> > path so <asm/types.h> can be found. > >> > >> Isn't the right thing here to just install gcc-multilib? > > > > For a container build we would like to avoid installing gcc-multilib > > which pulls in additional dependencies which are otherwise not needed to > > build bpftool. This patch would allow that. > > Ah, right. Well, stating that use case in the commit message would have > been nice :) Agree. Can also do a v2 if needed adding that rationale to the commit message. There's anyway a typo in the patch subject (s/iprofiler/profiler) which I could also fix :) Tobias
> On Mar 11, 2020, at 5:34 AM, Tobias Klauser <tklauser@distanz.ch> wrote: > > When compiling bpftool on a system where the /usr/include/asm symlink > doesn't exist (e.g. on an Ubuntu system without gcc-multilib installed), > the build fails with: > > CLANG skeleton/profiler.bpf.o > In file included from skeleton/profiler.bpf.c:4: > 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. > make: *** [Makefile:123: skeleton/profiler.bpf.o] Error 1 > > To fix this, add /usr/include/$(uname -m)-linux-gnu to the clang search > path so <asm/types.h> can be found. > > Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Looks good, with a nit below. Acked-by: Song Liu <songliubraving@fb.com> > --- > tools/bpf/bpftool/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > index 20a90d8450f8..3cc0644fd91e 100644 > --- a/tools/bpf/bpftool/Makefile > +++ b/tools/bpf/bpftool/Makefile > @@ -120,7 +120,7 @@ $(OUTPUT)_bpftool: $(_OBJS) $(LIBBPF) > $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(_OBJS) $(LIBS) > > skeleton/profiler.bpf.o: skeleton/profiler.bpf.c > - $(QUIET_CLANG)$(CLANG) -I$(srctree)/tools/lib -g -O2 -target bpf -c $< -o $@ > + $(QUIET_CLANG)$(CLANG) -I/usr/include/$(shell uname -m)-linux-gnu -I$(srctree)/tools/lib -g -O2 -target bpf -c $< -o $@ Nit: this line is too long. It is better to break it into two lines. > > profiler.skel.h: $(OUTPUT)_bpftool skeleton/profiler.bpf.o > $(QUIET_GEN)$(OUTPUT)./_bpftool gen skeleton skeleton/profiler.bpf.o > $@ > -- > 2.25.1 >
On 2020-03-11 at 16:55:38 +0100, Song Liu <songliubraving@fb.com> wrote: > > > > On Mar 11, 2020, at 5:34 AM, Tobias Klauser <tklauser@distanz.ch> wrote: > > > > When compiling bpftool on a system where the /usr/include/asm symlink > > doesn't exist (e.g. on an Ubuntu system without gcc-multilib installed), > > the build fails with: > > > > CLANG skeleton/profiler.bpf.o > > In file included from skeleton/profiler.bpf.c:4: > > 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. > > make: *** [Makefile:123: skeleton/profiler.bpf.o] Error 1 > > > > To fix this, add /usr/include/$(uname -m)-linux-gnu to the clang search > > path so <asm/types.h> can be found. > > > > Signed-off-by: Tobias Klauser <tklauser@distanz.ch> > > Looks good, with a nit below. > > Acked-by: Song Liu <songliubraving@fb.com> > > > --- > > tools/bpf/bpftool/Makefile | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > > index 20a90d8450f8..3cc0644fd91e 100644 > > --- a/tools/bpf/bpftool/Makefile > > +++ b/tools/bpf/bpftool/Makefile > > @@ -120,7 +120,7 @@ $(OUTPUT)_bpftool: $(_OBJS) $(LIBBPF) > > $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(_OBJS) $(LIBS) > > > > skeleton/profiler.bpf.o: skeleton/profiler.bpf.c > > - $(QUIET_CLANG)$(CLANG) -I$(srctree)/tools/lib -g -O2 -target bpf -c $< -o $@ > > + $(QUIET_CLANG)$(CLANG) -I/usr/include/$(shell uname -m)-linux-gnu -I$(srctree)/tools/lib -g -O2 -target bpf -c $< -o $@ > > Nit: this line is too long. It is better to break it into two lines. Thanks. Will send a v2, also with Toke's feedback regarding commit message included.
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile index 20a90d8450f8..3cc0644fd91e 100644 --- a/tools/bpf/bpftool/Makefile +++ b/tools/bpf/bpftool/Makefile @@ -120,7 +120,7 @@ $(OUTPUT)_bpftool: $(_OBJS) $(LIBBPF) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(_OBJS) $(LIBS) skeleton/profiler.bpf.o: skeleton/profiler.bpf.c - $(QUIET_CLANG)$(CLANG) -I$(srctree)/tools/lib -g -O2 -target bpf -c $< -o $@ + $(QUIET_CLANG)$(CLANG) -I/usr/include/$(shell uname -m)-linux-gnu -I$(srctree)/tools/lib -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 > $@
When compiling bpftool on a system where the /usr/include/asm symlink doesn't exist (e.g. on an Ubuntu system without gcc-multilib installed), the build fails with: CLANG skeleton/profiler.bpf.o In file included from skeleton/profiler.bpf.c:4: 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. make: *** [Makefile:123: skeleton/profiler.bpf.o] Error 1 To fix this, add /usr/include/$(uname -m)-linux-gnu to the clang search path so <asm/types.h> can be found. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> --- tools/bpf/bpftool/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)