When building libbpf-bootstrap/examples/c, the build fails while compiling the bootstrap libbpf used by bpftool.
The error is:
libbpf.c: In function ‘resolve_full_path’:
libbpf.c:11359:35: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
11359 | next_path = strchr(s, ':');
| ^
At top level:
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
The issue appears to be caused by assigning the result of strchr(s, ':') where s is const char *, to a non-const pointer char *next_path;
Changing it to: const char *next_path fixes this compilation error in my environment.
When building
libbpf-bootstrap/examples/c, the build fails while compiling the bootstrap libbpf used by bpftool.The error is:
The issue appears to be caused by assigning the result of
strchr(s, ':')wheresisconst char *, to a non-const pointerchar *next_path;Changing it to:
const char *next_pathfixes this compilation error in my environment.