NobinPegasus
Member
Whenever I'm trying to build libbpf. I'm facing the following error. When I try to build tools related libbpf I also face the same errors.
I'm unable to figure out the actual reason of this.
Code:
pegasus@pegasus:~/Documents/eBPF/libbpf/src$ make
MKDIR staticobjs
CC staticobjs/bpf.o
CC staticobjs/btf.o
CC staticobjs/libbpf.o
CC staticobjs/libbpf_errno.o
CC staticobjs/netlink.o
CC staticobjs/nlattr.o
CC staticobjs/str_error.o
CC staticobjs/libbpf_probes.o
CC staticobjs/bpf_prog_linfo.o
CC staticobjs/btf_dump.o
CC staticobjs/hashmap.o
CC staticobjs/ringbuf.o
CC staticobjs/strset.o
CC staticobjs/linker.o
CC staticobjs/gen_loader.o
CC staticobjs/relo_core.o
CC staticobjs/usdt.o
usdt.c:572:56: error: unknown type name ‘GElf_Nhdr’; did you mean ‘GElf_Shdr’?
572 | static int parse_usdt_note(Elf *elf, const char *path, GElf_Nhdr *nhdr,
| ^~~~~~~~~
| GElf_Shdr
usdt.c: In function ‘collect_usdt_targets’:
usdt.c:589:9: error: unknown type name ‘GElf_Nhdr’; did you mean ‘GElf_Shdr’?
589 | GElf_Nhdr nhdr;
| ^~~~~~~~~
| GElf_Shdr
usdt.c:621:23: error: implicit declaration of function ‘gelf_getnote’; did you mean ‘gelf_getsym’? [-Werror=implicit-function-declaration]
621 | while ((off = gelf_getnote(data, off, &nhdr, &name_off, &desc_off)) > 0) {
| ^~~~~~~~~~~~
| gelf_getsym
usdt.c:627:23: error: implicit declaration of function ‘parse_usdt_note’; did you mean ‘parse_usdt_spec’? [-Werror=implicit-function-declaration]
627 | err = parse_usdt_note(elf, path, &nhdr, data->d_buf, name_off, desc_off, ¬e);
| ^~~~~~~~~~~~~~~
| parse_usdt_spec
usdt.c: At top level:
usdt.c:1133:56: error: unknown type name ‘GElf_Nhdr’; did you mean ‘GElf_Shdr’?
1133 | static int parse_usdt_note(Elf *elf, const char *path, GElf_Nhdr *nhdr,
| ^~~~~~~~~
| GElf_Shdr
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors
make: *** [Makefile:134: staticobjs/usdt.o] Error 1
Code:
pegasus@pegasus:~/Documents/eBPF/xdp-tutorial$ uname -a
Linux pegasus 6.4.0-060400-generic #202306271339 SMP PREEMPT_DYNAMIC Tue Jun 27 14:26:34 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
I'm unable to figure out the actual reason of this.