yunwei37 / nginx-lua-ebpf-toolkit

profile and tracking tools for lua and nginx using eBPF
https://github.com/apache/apisix-profiler
57 stars 12 forks source link

编译错误 #3

Closed sugue closed 3 months ago

sugue commented 1 year ago

profile_nginx_lua目录下执行make, 报找不到key_t类型错误

clang: 版本 clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin

  MKDIR    .output
  MKDIR    .output/libbpf
  LIB      libbpf.a
  MKDIR    /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/bpf.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/btf.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/libbpf.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/libbpf_errno.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/netlink.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/nlattr.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/str_error.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/libbpf_probes.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/bpf_prog_linfo.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/btf_dump.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/hashmap.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/ringbuf.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/strset.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/linker.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/gen_loader.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/relo_core.o
  CC       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/staticobjs/usdt.o
  AR       /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/libbpf.a
  INSTALL  bpf.h libbpf.h btf.h libbpf_common.h libbpf_legacy.h bpf_helpers.h bpf_helper_defs.h bpf_tracing.h bpf_endian.h bpf_core_read.h skel_internal.h libbpf_version.h usdt.bpf.h
  INSTALL  /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/libbpf.pc
  INSTALL  /data/home/xxxx/tapis/nginx-lua-ebpf-toolkit/bpftools/profile_nginx_lua/.output//libbpf/libbpf.a                                                                                                                                        
  BPF      .output/profile.bpf.o
profile.bpf.c:170:15: error: variable has incomplete type 'struct key_t'
        struct key_t key = {}; 
                     ^  
profile.bpf.c:23:21: note: forward declaration of 'struct key_t'
        __type(key, struct key_t);
                           ^
1 error generated.
make: *** [Makefile:66: .output/profile.bpf.o] Error 1
bjne commented 1 year ago

Any solution to this?

Study-of-slag-weng commented 1 year ago

same question

wait4pumpkin commented 10 months ago

use profile_key_t instead

yunwei37 commented 3 months ago

It's fixed now, thanks!