bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpftool: fix iprofiler build on systems without /usr/include/asm symlink
@ 2020-03-11 12:34 Tobias Klauser
  2020-03-11 12:49 ` Toke Høiland-Jørgensen
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Tobias Klauser @ 2020-03-11 12:34 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov
  Cc: Quentin Monnet, Song Liu, Yonghong Song, bpf

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(-)

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 > $@
-- 
2.25.1


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

end of thread, other threads:[~2020-03-12 10:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 12:34 [PATCH] bpftool: fix iprofiler build on systems without /usr/include/asm symlink Tobias Klauser
2020-03-11 12:49 ` Toke Høiland-Jørgensen
2020-03-11 12:53   ` Tobias Klauser
2020-03-11 14:24     ` Toke Høiland-Jørgensen
2020-03-11 15:00       ` Tobias Klauser
2020-03-11 15:55 ` Song Liu
2020-03-11 16:06   ` Tobias Klauser
2020-03-11 16:14 ` [PATCH bpf-next v2] bpftool: fix profiler " Tobias Klauser
2020-03-11 17:26   ` Alexei Starovoitov
2020-03-11 19:42     ` Tobias Klauser
2020-03-12 10:30     ` Tobias Klauser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).