Skip to contentSkip to conversation

libbpf: fixed build error for samples/bpf/

PATCH Applied Björn Töpel 3 participants 3 messages Apr 20, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf: fixed build error for samples/bpf/

From: Björn Töpel <[email protected]>

Commit 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") did not include stdbool.h, so GCC complained when building samples/bpf/.

In file included from /home/btopel/src/ext/linux/samples/bpf/libbpf.h:6:0,
from /home/btopel/src/ext/linux/samples/bpf/test_lru_dist.c:24:
/home/btopel/src/ext/linux/tools/lib/bpf/bpf.h:105:4: error: unknown type name ‘bool’; did you mean ‘_Bool’?

    bool do_log);
    ^~~~
    _Bool
---
 tools/lib/bpf/bpf.h | 1 +
 1 file changed, 1 insertion(+)
tools/lib/bpf/bpf.h +1 -0
index 01bda076310f..553b11ad52b3 100644
@@ -24,6 +24,7 @@
 #define __BPF_BPF_H
 
 #include <linux/bpf.h>
+#include <stdbool.h>
 #include <stddef.h>
 
 struct bpf_create_map_attr {
Signature · 1 line
2.14.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Björn Töpel

From: Björn Töpel <[email protected]>

Commit 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") did not include stdbool.h, so GCC complained when building samples/bpf/.

Quoted 8 lines

In file included from /home/btopel/src/ext/linux/samples/bpf/libbpf.h:6:0,
from /home/btopel/src/ext/linux/samples/bpf/test_lru_dist.c:24:
/home/btopel/src/ext/linux/tools/lib/bpf/bpf.h:105:4: error: unknown type name ‘bool’; did you mean ‘_Bool’?

    bool do_log);
    ^~~~
    _Bool

Applied to bpf-next, thanks Björn!

#2 lore raw
In reply to Björn Töpel
Quoted 22 lines · Björn Töpel

From: Björn Töpel <[email protected]>

Commit 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") did not include stdbool.h, so GCC complained when building samples/bpf/.

In file included from /home/btopel/src/ext/linux/samples/bpf/libbpf.h:6:0,
from /home/btopel/src/ext/linux/samples/bpf/test_lru_dist.c:24:
/home/btopel/src/ext/linux/tools/lib/bpf/bpf.h:105:4: error: unknown type name ‘bool’; did you mean ‘_Bool’?

    bool do_log);
    ^~~~
    _Bool
---
 tools/lib/bpf/bpf.h | 1 +
 1 file changed, 1 insertion(+)
tools/lib/bpf/bpf.h +0 -0
index 01bda076310f..553b11ad52b3 100644

tools/lib/bpf/bpf.h line 27

Quoted 4 lines
tools/lib/bpf/bpf.h +1 -0
@@ -24,6 +24,7 @@
 #define __BPF_BPF_H
 
 #include <linux/bpf.h>
+#include <stdbool.h>

Thanks for the fix!