bpftools/linux-observability-with-bpf

Error when i ran Hello World Program!!

saireddyavs opened this issue · 1 comments

as per instructions i executed

make  bpfload

and i got error

clang -O2 -target bpf -c bpf_program.c -I/kernel-src/tools/testing/selftests/bpf -o bpf_program.o
clang -o monitor-exec -lelf -I/kernel-src/samples/bpf -I/kernel-src/tools/lib -I/kernel-src/tools/perf -I/kernel-src/tools/include -L/usr/local/lib64 -lbpf \
        /kernel-src/samples/bpf/bpf_load.c loader.c
/usr/bin/ld: /tmp/bpf_load-c3bfb7.o: in function `sys_perf_event_open':
bpf_load.c:(.text+0x1fde): undefined reference to `test_attr__enabled'
/usr/bin/ld: bpf_load.c:(.text+0x2015): undefined reference to `test_attr__open'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:28: bpfload] Error 1

and uname -r output is 5.4.0-39-generic
on my ubuntu 20.04

any help? why the error?

Fast fix this problem is adding -DHAVE_ATTR_TEST=0 for compiling loader.c. It helped me.