Configure broken since 1.3.0: btf__type_cnt no longer detected
hhoffstaette opened this issue · comments
Holger Hoffstätte commented
Anything >= 1.3.0 no longer builds because of broken btf__type_cnt detection and consequently mismatching function signatures. libbpf is an external 1.1.0.
libxdp
CC staticobjs/libxdp.o
libxdp.c:280:14: error: static declaration of 'btf__type_cnt' follows non-static declaration
280 | static __u32 btf__type_cnt(const struct btf *btf)
| ^~~~~~~~~~~~~
In file included from libxdp.c:32:
/usr/include/bpf/btf.h:128:18: note: previous declaration of 'btf__type_cnt' with type '__u32(const struct btf *)' {aka 'unsigned int(const struct btf *)'}
128 | LIBBPF_API __u32 btf__type_cnt(const struct btf *btf);
| ^~~~~~~~~~~~~
libxdp.c: In function 'btf__type_cnt':
libxdp.c:283:16: error: implicit declaration of function 'btf__get_nr_types' [-Werror=implicit-function-declaration]
283 | return btf__get_nr_types(btf) + 1;
| ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
configure output from 1.2.9:
holger>cd xdp-tools-1.2.9
holger>./configure
Found clang binary 'clang' with version 15 (from 'clang version 15.0.7')
libbpf support: system v1.1.0
perf_buffer__consume support: yes
btf__load_from_kernel_by_id support: yes
btf__type_cnt support: yes
bpf_object__next_map support: yes
bpf_object__next_program support: yes
bpf_program__insn_cnt support: yes
bpf_map_create support: yes
perf_buffer__new_raw support: yes
bpf_xdp_attach support: yes
secure_getenv support: yes
configure with 1.3.0:
holger>cd xdp-tools-1.3.0
holger>./configure
Found clang binary 'clang' with version 15 (from 'clang version 15.0.7')
using bpftool v6.2
libbpf support: system v1.1.0
perf_buffer__consume support: yes
btf__load_from_kernel_by_id support: yes
btf__type_cnt support: no
bpf_object__next_map support: yes
bpf_object__next_program support: yes
bpf_program__insn_cnt support: yes
bpf_map_create support: yes
perf_buffer__new_raw support: yes
bpf_xdp_attach support: yes
bpf_map__set_autocreate support: yes
bpf_prog_test_run_opts support: yes
secure_getenv support: yes
Toke Høiland-Jørgensen commented
Hmm, the configure check works fine on my machine; could you please post
the output of `DEBUG_CONFIGURE=1 ./configure` (for the 1.3.0 version
that's failing)?
Holger Hoffstätte commented
Hmm, the configure check works fine on my machine; could you please post the output of
DEBUG_CONFIGURE=1 ./configure
(for the 1.3.0 version that's failing)?
Of course - I didn't know about DEBUG_CONFIGURE. Here you go:
holger>tar xf xdp-tools-1.3.0.tar.gz
holger>cd xdp-tools-1.3.0
holger>DEBUG_CONFIGURE=1 ./configure
Found clang binary 'clang' with version 15 (from 'clang version 15.0.7')
using bpftool v6.2
libbpf support: system v1.1.0
perf_buffer__consume support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
btf__load_from_kernel_by_id support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
btf__type_cnt support: no
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -lbpf
config.Psq3Za/libbpftest.c: In function 'main':
config.Psq3Za/libbpftest.c:5:6: error: 'I' undeclared (first use in this function)
5 | -I/usr/include/bpf/uapi ;
| ^
config.Psq3Za/libbpftest.c:5:6: note: each undeclared identifier is reported only once for each function it appears in
config.Psq3Za/libbpftest.c:5:8: error: 'usr' undeclared (first use in this function)
5 | -I/usr/include/bpf/uapi ;
| ^~~
config.Psq3Za/libbpftest.c:5:12: error: 'include' undeclared (first use in this function)
5 | -I/usr/include/bpf/uapi ;
| ^~~~~~~
config.Psq3Za/libbpftest.c:5:20: error: 'bpf' undeclared (first use in this function); did you mean 'btf'?
5 | -I/usr/include/bpf/uapi ;
| ^~~
| btf
config.Psq3Za/libbpftest.c:5:24: error: 'uapi' undeclared (first use in this function)
5 | -I/usr/include/bpf/uapi ;
| ^~~~
bpf_object__next_map support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
bpf_object__next_program support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
bpf_program__insn_cnt support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
bpf_map_create support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
perf_buffer__new_raw support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
bpf_xdp_attach support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
bpf_map__set_autocreate support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
bpf_prog_test_run_opts support: yes
gcc -o config.Psq3Za/libbpftest config.Psq3Za/libbpftest.c -Werror -I/usr/include/bpf/uapi -lbpf
secure_getenv support: yes
uh.. "I undeclared"? what?
Toke Høiland-Jørgensen commented
Holger Hoffstätte ***@***.***> writes:
uh.. "I undeclared"? what?
Lol, swapped function args so the BPF_CFLAGS was inserted into the
source file. BPF_CFLAGS are empty on my system, so that's why I wasn't
seeing the error :)
Toke Høiland-Jørgensen commented
Please check if #300 fixes this for you :)
Holger Hoffstätte commented
#300 makes it work - thanks!
Toke Høiland-Jørgensen commented
Awesome! Thanks for the report :)