dns icon indicating copy to clipboard operation
dns copied to clipboard

Ubuntu Compiling Issue

Open cli0 opened this issue 1 year ago • 3 comments

Hello, I am having issues with compiling dnswatch on Ubuntu 22.04.

I installed every requirement in the README but when I run make I get the following error:

cli0@Tardis:/home/WorkSpace/dnswatch/dns/dnswatch$ make
bpftool btf dump file /sys/kernel/btf/vmlinux format c > bpf/vmlinux.h
clang -g -O2 -Wall -fpie -fno-stack-protector -I /usr/include/bpf -target bpf -D__TARGET_ARCH_x86 -I bpf  -c bpf/dnswatch.bpf.c -o snoop/out/dnswatch_bpf_probe_core.o
bpf/dnswatch.bpf.c:151:21: warning: unused variable 'inet' [-Wunused-variable]
  struct inet_sock* inet = (struct inet_sock*)sk;
                    ^
bpf/dnswatch.bpf.c:176:21: warning: unused variable 'inet' [-Wunused-variable]
  struct inet_sock* inet = (struct inet_sock*)sk;
                    ^
2 warnings generated.
CGO_LDFLAGS="-lbpf" CGO_CFLAGS="-I /usr/include/bpf  -I /usr/include/pcap" go build .
# github.com/aquasecurity/libbpfgo
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:30:9: could not determine kind of name for C.LIBBPF_MAJOR_VERSION
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:35:9: could not determine kind of name for C.LIBBPF_MINOR_VERSION
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:276:55: could not determine kind of name for C.LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:277:55: could not determine kind of name for C.LIBBPF_STRICT_MAP_DEFINITIONS
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:275:55: could not determine kind of name for C.LIBBPF_STRICT_NO_OBJECT_LIST
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:274:55: could not determine kind of name for C.LIBBPF_STRICT_SEC_NAME
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:707:9: could not determine kind of name for C.bpf_map__lookup_elem
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:516:15: could not determine kind of name for C.bpf_map_create
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:978:7: could not determine kind of name for C.bpf_object__next_map
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:1001:7: could not determine kind of name for C.bpf_object__next_program
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:1285:21: could not determine kind of name for C.bpf_program__type
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:1983:16: could not determine kind of name for C.libbpf_probe_bpf_map_type
/home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:1991:16: could not determine kind of name for C.libbpf_probe_bpf_prog_type
cgo: 
gcc errors for preamble:
In file included from /home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:5:
./libbpfgo.h: In function 'init_perf_buf':
./libbpfgo.h:69:10: error: 'struct perf_buffer_opts' has no member named 'sz'
   69 |   pb_opts.sz = sizeof(struct perf_buffer_opts);
      |          ^
./libbpfgo.h:71:8: error: too many arguments to function 'perf_buffer__new'
   71 |   pb = perf_buffer__new(map_fd, page_cnt, perfCallback, perfLostCallback,
      |        ^~~~~~~~~~~~~~~~
In file included from ./libbpfgo.h:16,
                 from /home/cli0/go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:5:
/usr/include/bpf/libbpf.h:682:1: note: declared here
  682 | perf_buffer__new(int map_fd, size_t page_cnt,
      | ^~~~~~~~~~~~~~~~

make: *** [Makefile:11: build] Error 2

I don't know where to go from here, the error message doesn't help. Any suggestions would be very appreciated.

cli0 avatar Jun 05 '23 20:06 cli0