Closed vimalk78 closed 1 year ago
i found the reason for compilation errors.
The bpf program uses a TRACEPOINT_PROBE
and to compile the generated function we need access to /sys/kernel/debug/tracing/events/
to read the format of the input args.
and without sudo
, the compilation process cannot access this path, and hence the error.
While calling
NewModule
https://github.com/iovisor/gobpf/blob/master/bcc/module.go#L138 how to passcflags
to this function which makes bcc loader print detailed compilation output?I am running a program which loads a bpf program. It runs fine if i run it with sudo, but it gives compilation errors while compiling the bpf program if executed without sudo.
I looked into bcc https://github.com/iovisor/bcc/blob/master/src/cc/frontends/clang/loader.cc#L193 and i see that it tries to look into kernel modules for kernel header and tries to compile the bpf code.
My laptop has
/lib/module/6.1.15-200.fc37.x86_64
folder withsource
anddebug
folders.the bpf program does get compiled if the program is run with root permissions, but otherwise it gives compilation warnings and fails. why?
thats why i am looking for some compilation flags to be passed to clang via
NewModule
so that i can get more verbose output.