eunomia-bpf / wasm-bpf

WebAssembly library, toolchain and runtime for eBPF programs

Home Page:https://eunomia.dev/wasm-bpf/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] call to undeclared function 'xdp_bpf__open_and_load'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Albertchamberlain opened this issue · comments

Describe the bug
It's looks like the compatibility problem

Screenshots
Sorry,I don't know why can‘t submit the photo ,so i copy the commands & outs 👇

root@edge:/home/amos/wasm-bpf/examples/xdp# make
ln -f -s ../../wasm-sdk/c/libbpf-wasm.h libbpf-wasm.h
/opt/wasi-sdk/bin/clang -O2 --sysroot=/opt/wasi-sdk/share/wasi-sysroot -Wl,--allow-undefined,--export-table -o xdp.wasm xdp.c
In file included from xdp.c:6:
./xdp.skel.h:1:1: **error**: expected identifier or '('
{"data_sections":[],"obj_name":"xdp_bpf","maps":[{"name":"xdp_bpf.rodata","ident":"rodata"}],"progs":[{"name":"xdp_pass","attach":"xdp","link":true}]}
^
xdp.c:12:12: **error**: call to undeclared function 'xdp_bpf__open_and_load'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    skel = xdp_bpf__open_and_load();
           ^
xdp.c:12:10: **error**: incompatible integer to pointer conversion assigning to 'struct xdp_bpf *' from 'int' [-Wint-conversion]
    skel = xdp_bpf__open_and_load();
         ^ ~~~~~~~~~~~~~~~~~~~~~~~~
xdp.c:17:36: **error**: incomplete definition of type 'struct xdp_bpf'
    bpf_set_prog_attach_target(skel->progs.xdp_pass, argv[1]);
                               ~~~~^
xdp.c:9:12: note: forward declaration of 'struct xdp_bpf'
    struct xdp_bpf* skel = NULL;
           ^
xdp.c:19:11: **error**: call to undeclared function 'xdp_bpf__attach'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    err = xdp_bpf__attach(skel);
          ^
5 errors generated.
make: *** [Makefile:64:xdp.wasm] 错误 1

Desktop (please complete the following information):

Ubuntu LLVM version 14.0.0

Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: skylake

Registered Targets:
aarch64 - AArch64 (little endian)
aarch64_32 - AArch64 (little endian ILP32)
aarch64_be - AArch64 (big endian)
amdgcn - AMD GCN GPUs
arm - ARM
arm64 - ARM64 (little endian)
arm64_32 - ARM64 (little endian ILP32)
armeb - ARM (big endian)
avr - Atmel AVR Microcontroller
bpfeb - BPF (big endian)
bpfel - BPF (little endian)
hexagon - Hexagon
lanai - Lanai
m68k - Motorola 68000 family
mips - MIPS (32-bit big endian)
mips64 - MIPS (64-bit big endian)
mips64el - MIPS (64-bit little endian)
mipsel - MIPS (32-bit little endian)
msp430 - MSP430 [experimental]
nvptx - NVIDIA PTX 32-bit
nvptx64 - NVIDIA PTX 64-bit
ppc32 - PowerPC 32
ppc32le - PowerPC 32 LE
ppc64 - PowerPC 64
ppc64le - PowerPC 64 LE
r600 - AMD GPUs HD2XXX-HD6XXX
riscv32 - 32-bit RISC-V
riscv64 - 64-bit RISC-V
sparc - Sparc
sparcel - Sparc LE
sparcv9 - Sparc V9
systemz - SystemZ
thumb - Thumb
thumbeb - Thumb (big endian)
ve - VE
wasm32 - WebAssembly 32-bit
wasm64 - WebAssembly 64-bit
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
xcore - XCore

Additional context

root@edge:/home/amos/wasm-bpf/examples/xdp# clang --version
Ubuntu clang version 14.0.0-1ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin