Hey, I want to use an XDP program in Proxmox VE 6.2-1 (Linux pve 5.4.78-2-pve)
I already installed with apt the following packages:
Python
test.c
After finally making the python importing BPF from bcc, the python unable to compile the c file and throw the following errors:
What am I missing? how I can make it works without even get the asm_inline errors? is all of that related to the versions I am using?
I managed to successfully use XDP on a regular ubuntu machine with regular Linux-headers but in Proxmox I didn't.
Thanks for your help.
I already installed with apt the following packages:
python3-bcc
bpfcc-tools
python3-bpfcc
libbpfcc
libbpfcc-dev
pve-headers-5.4.78-2-pve
Then, I wrote a python file and a .c file:Python
Python:
from bcc import BPF
b = BPF(src_file="test.c")
test.c
C:
// I added the following lines because I got a lot of errors about asm_inline
#ifdef asm_inline
#undef asm_inline
#define asm_inline asm
#endif
#include <linux/bpf.h>
int test(struct xdp_md *ctx)
{
bpf_trace_printk("hello\n");
return XDP_PASS;
}
After finally making the python importing BPF from bcc, the python unable to compile the c file and throw the following errors:
Code:
In file included from /virtual/main.c:7:
include/linux/bpf.h:118:3: error: variable has incomplete type 'struct bpf_spin_lock'
(struct bpf_spin_lock){};
^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:117:11: note: forward declaration of 'struct bpf_spin_lock'
*(struct bpf_spin_lock *)(dst + map->spin_lock_off) =
^
include/linux/bpf.h:128:22: error: invalid application of 'sizeof' to an incomplete type 'struct bpf_spin_lock'
memcpy(dst + off + sizeof(struct bpf_spin_lock),
^ ~~~~~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:128:36: note: forward declaration of 'struct bpf_spin_lock'
memcpy(dst + off + sizeof(struct bpf_spin_lock),
^
include/linux/bpf.h:129:22: error: invalid application of 'sizeof' to an incomplete type 'struct bpf_spin_lock'
src + off + sizeof(struct bpf_spin_lock),
^ ~~~~~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:128:36: note: forward declaration of 'struct bpf_spin_lock'
memcpy(dst + off + sizeof(struct bpf_spin_lock),
^
include/linux/bpf.h:130:34: error: invalid application of 'sizeof' to an incomplete type 'struct bpf_spin_lock'
map->value_size - off - sizeof(struct bpf_spin_lock));
^ ~~~~~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:128:36: note: forward declaration of 'struct bpf_spin_lock'
memcpy(dst + off + sizeof(struct bpf_spin_lock),
^
include/linux/bpf.h:457:39: error: use of undeclared identifier 'BPF_F_RDONLY_PROG'
u32 access_flags = map->map_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG);
^
include/linux/bpf.h:457:59: error: use of undeclared identifier 'BPF_F_WRONLY_PROG'
u32 access_flags = map->map_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG);
^
include/linux/bpf.h:462:21: error: use of undeclared identifier 'BPF_F_RDONLY_PROG'
if (access_flags & BPF_F_RDONLY_PROG)
^
include/linux/bpf.h:464:26: error: use of undeclared identifier 'BPF_F_WRONLY_PROG'
else if (access_flags & BPF_F_WRONLY_PROG)
^
include/linux/bpf.h:472:26: error: use of undeclared identifier 'BPF_F_RDONLY_PROG'
return (access_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG)) !=
^
include/linux/bpf.h:472:46: error: use of undeclared identifier 'BPF_F_WRONLY_PROG'
return (access_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG)) !=
^
include/linux/bpf.h:473:10: error: use of undeclared identifier 'BPF_F_RDONLY_PROG'
(BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG);
^
include/linux/bpf.h:473:30: error: use of undeclared identifier 'BPF_F_WRONLY_PROG'
(BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG);
^
12 errors generated.
Traceback (most recent call last):
File "test.py", line 3, in <module>
b = BPF(src_file="test.c")
File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 331, in __init__
raise Exception("Failed to compile BPF module %s" % src_file)
Exception: Failed to compile BPF module b'test.c'
What am I missing? how I can make it works without even get the asm_inline errors? is all of that related to the versions I am using?
I managed to successfully use XDP on a regular ubuntu machine with regular Linux-headers but in Proxmox I didn't.
Thanks for your help.
Last edited: