WAMR runtime example failed to build on arm
saivian1 opened this issue · 4 comments
- When I run the make command in a project, I get an error that says 'LIBBPF_STRICT_ALL' is not declared in this range.
- The error code is in line 24 of
src/wasm-bpf.cpp
with the code libbpf_set_strict_mode(LIBBPF_STRICT_ALL); LIBBPF_STRICT_ALL
is the macro defined in #include. This header file was added in wasm-bpf.cpp.
This is strange
I pulled the latest repository and did not get this error after executing the make command, can you provide the error message output from the terminal?
[ 63%] Building C object CMakeFiles/vmlib.dir/third_party/wasm-micro-runtime/core/iwasm/aot/aot_runtime.c.o
[ 65%] Building C object CMakeFiles/vmlib.dir/third_party/wasm-micro-runtime/core/iwasm/aot/arch/aot_reloc_aarch64.c.o
[ 67%] Linking C static library libvmlib.a
gmake[3]: Leaving directory '/home/saivian1/wasm-bpf/build'
[ 67%] Built target vmlib
gmake[3]: Entering directory '/home/saivian1/wasm-bpf/build'
Scanning dependencies of target wasm-bpf_LIB
gmake[3]: Leaving directory '/home/saivian1/wasm-bpf/build'
gmake[3]: Entering directory '/home/saivian1/wasm-bpf/build'
[ 68%] Building CXX object CMakeFiles/wasm-bpf_LIB.dir/src/wasm-bpf.cpp.o
/home/saivian1/wasm-bpf/src/wasm-bpf.cpp: In function ‘void init_libbpf()’:
/home/saivian1/wasm-bpf/src/wasm-bpf.cpp:24:28: error: ‘LIBBPF_STRICT_ALL’ was not declared in this scope
24 | libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
| ^~~~~~~~~~~~~~~~~
/home/saivian1/wasm-bpf/src/wasm-bpf.cpp:24:5: error: ‘libbpf_set_strict_mode’ was not declared in this scope; did you mean ‘libbpf_set_print’?
24 | libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
| ^~~~~~~~~~~~~~~~~~~~~~
| libbpf_set_print
/home/saivian1/wasm-bpf/src/wasm-bpf.cpp: In function ‘bpf_buffer* bpf_buffer__new(bpf_map*)’:
/home/saivian1/wasm-bpf/src/wasm-bpf.cpp:83:9: error: ‘bpf_map__set_autocreate’ was not declared in this scope; did you mean ‘bpf_map__set_pin_path’?
83 | bpf_map__set_autocreate(events, false);
| ^~~~~~~~~~~~~~~~~~~~~~~
| bpf_map__set_pin_path
/home/saivian1/wasm-bpf/src/wasm-bpf.cpp: In function ‘int bpf_buffer__open(bpf_buffer*, bpf_buffer_sample_fn, void*)’:
/home/saivian1/wasm-bpf/src/wasm-bpf.cpp:112:61: error: cannot convert ‘void ()(void, int, void*, __u32)’ {aka ‘void ()(void, int, void*, unsigned int)’} to ‘const perf_buffer_opts*’
112 | inner = perf_buffer__new(fd, PERF_BUFFER_PAGES, perfbuf_sample_fn,
|
The two symbols libbpf_set_strict_mode
and bpf_map__set_autocreate
are defined in the ./third_party/bpftool
folder. I guess the problem is that the header file is not correctly added to the search path. Maybe you need to check whether the header file is included in CMakeLists.txt correctly, or whether the correct header file is included in the cpp/h file.
closed as completed.