aquasecurity / libbpfgo

eBPF library for Go. Powered by libbpf.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling a user space application that uses libbpfgo as dependency fails

alexjch opened this issue · comments

libbpfgo version v0.6.0-libbpf-1.3
libbpf 1.3 (it's installed in the ./root directory

make build-go
CC=gcc CGO_CFLAGS="-I ./root/usr/include" CGO_LDFLAGS="./root/usr/lib64/libbpf.a" go build -mod vendor -o mce_log cmd/mce_log/main.go
# github.com/aquasecurity/libbpfgo
vendor/github.com/aquasecurity/libbpfgo/map-common.go:154:10: could not determine kind of name for C.bpf_map_get_info_by_fd
make: *** [Makefile:14: build-go] Error 1```

Commenting map-common.go:152 - 158 allows me to avoid the issue. It seems that  bpf_map_get_info_by_fd does not exists in libbpf?

Use this directory as an example how to achieve what you want please: https://github.com/rafaeldtinoco/random/tree/main/bpf-example.