nettrace icon indicating copy to clipboard operation
nettrace copied to clipboard

kylin v10 sp2 编译报错

Open cquliaoli opened this issue 3 months ago • 0 comments

[ll@192 nettrace-master]$ make KERNEL=/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64 NO_BTF=1 NO_GLOBAL_DATA=1 all
make -C src all
make[1]: Entering directory '/home/ll/nettrace/nettrace-master/src'
clang -O2 -S -Wall -fno-asynchronous-unwind-tables		\
-Wno-incompatible-pointer-types-discards-qualifiers		\
progs/kprobe.c -emit-llvm -Wno-unknown-attributes -I./ -I/home/ll/nettrace/nettrace-master/shared/bpf/ -g -DBPF_NO_GLOBAL_DATA -DNO_BTF -D__F_STACK_TRACE -D__KERN_VER=4.19.90 -D__KERN_MAJOR=4 -Wno-unused-function -Wno-compare-distinct-pointer-types -Wuninitialized -D__TARGET_ARCH_x86 -DBPF_NO_PRESERVE_ACCESS_INDEX -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/include -I/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/arch/x86/include -I/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/arch/x86/include/generated -I/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/include -I/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/arch/x86/include/uapi -I/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/arch/x86/include/generated/uapi -I/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/include/uapi -I/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/include/generated/uapi -include /usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/include/linux/kconfig.h -I/usr/include/ -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign -Wno-compare-distinct-pointer-types -Wno-gnu-variable-sized-type-not-at-end -Wno-address-of-packed-member -Wno-tautological-compare -Wno-unknown-warning-option -Wno-frame-address -D__F_SK_PRPTOCOL_LEGACY -Xclang	\
-disable-llvm-passes -o - | 					\
opt -O2 -mtriple=bpf-pc-linux | 				\
llvm-dis |							\
llc -march=bpf -filetype=obj -o progs/kprobe.o
In file included from progs/kprobe.c:3:
progs/skb_parse.h:321:17: warning: implicit declaration of function 'BPF_PROBE_READ' is invalid in C99 [-Wimplicit-function-declaration]
        trans_header = _C(skb, transport_header);
                       ^
progs/skb_parse.h:79:26: note: expanded from macro '_C'
#define _C(src, f, ...)         BPF_PROBE_READ(src, f, ##__VA_ARGS__)
                                ^
progs/skb_parse.h:321:25: error: use of undeclared identifier 'transport_header'
        trans_header = _C(skb, transport_header);
                               ^
progs/skb_parse.h:345:28: error: use of undeclared identifier 'tot_len'
                len = bpf_ntohs(_C(ipv4, tot_len));
                                         ^
progs/skb_parse.h:345:28: error: use of undeclared identifier 'tot_len'
progs/skb_parse.h:345:28: error: use of undeclared identifier 'tot_len'
progs/skb_parse.h:345:28: error: use of undeclared identifier 'tot_len'
progs/skb_parse.h:401:10: warning: implicit declaration of function 'BPF_PROBE_READ' is invalid in C99 [-Wimplicit-function-declaration]
        switch (_C(skc, skc_family)) {
                ^
progs/skb_parse.h:79:26: note: expanded from macro '_C'
#define _C(src, f, ...)         BPF_PROBE_READ(src, f, ##__VA_ARGS__)
                                ^
progs/skb_parse.h:401:18: error: use of undeclared identifier 'skc_family'; did you mean 'xt_family'?
        switch (_C(skc, skc_family)) {
                        ^~~~~~~~~~
                        xt_family
progs/skb_parse.h:79:46: note: expanded from macro '_C'
#define _C(src, f, ...)         BPF_PROBE_READ(src, f, ##__VA_ARGS__)
                                                    ^
/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/include/linux/netfilter/x_tables.h:74:24: note: 'xt_family' declared here
static inline u_int8_t xt_family(const struct xt_action_param *par)
                       ^
In file included from progs/kprobe.c:3:
progs/skb_parse.h:404:32: error: use of undeclared identifier 'skc_rcv_saddr'
                ske->l3.ipv4.saddr = _C(skc, skc_rcv_saddr);
                                             ^
progs/skb_parse.h:405:32: error: use of undeclared identifier 'skc_daddr'
                ske->l3.ipv4.daddr = _C(skc, skc_daddr);
                                             ^
progs/skb_parse.h:450:37: error: use of undeclared identifier 'packets_out'
                        ske->l4.tcp.packets_out = _C(tp, packets_out);
                                                         ^
progs/skb_parse.h:451:37: error: use of undeclared identifier 'retrans_out'
                        ske->l4.tcp.retrans_out = _C(tp, retrans_out);
                                                         ^
progs/skb_parse.h:452:33: error: use of undeclared identifier 'snd_una'
                        ske->l4.tcp.snd_una = _C(tp, snd_una);
                                                     ^
progs/skb_parse.h:460:41: error: use of undeclared identifier 'skc_num'; did you mean 'skb_put'?
                ske->l4.min.sport = bpf_htons(_C(skc, skc_num));
                                                      ^~~~~~~
                                                      skb_put
progs/skb_parse.h:79:46: note: expanded from macro '_C'
#define _C(src, f, ...)         BPF_PROBE_READ(src, f, ##__VA_ARGS__)
                                                    ^
/usr/include/bpf/bpf_endian.h:81:24: note: expanded from macro 'bpf_htons'
        (__builtin_constant_p(x) ?              \
                              ^
/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/include/linux/skbuff.h:2103:7: note: 'skb_put' declared here
void *skb_put(struct sk_buff *skb, unsigned int len);
      ^
In file included from progs/kprobe.c:3:
progs/skb_parse.h:460:41: error: use of undeclared identifier 'skc_num'; did you mean 'skb_put'?
                ske->l4.min.sport = bpf_htons(_C(skc, skc_num));
                                                      ^~~~~~~
                                                      skb_put
progs/skb_parse.h:79:46: note: expanded from macro '_C'
#define _C(src, f, ...)         BPF_PROBE_READ(src, f, ##__VA_ARGS__)
                                                    ^
/usr/include/bpf/bpf_endian.h:82:24: note: expanded from macro 'bpf_htons'
         __bpf_constant_htons(x) : __bpf_htons(x))
                              ^
/usr/include/bpf/bpf_endian.h:54:48: note: expanded from macro '__bpf_constant_htons'
# define __bpf_constant_htons(x)        ___bpf_swab16(x)
                                                      ^
/usr/include/bpf/bpf_endian.h:16:17: note: expanded from macro '___bpf_swab16'
                          ___bpf_mvb(x, 16, 0, 1) |     \
                                     ^
/usr/include/bpf/bpf_endian.h:13:42: note: expanded from macro '___bpf_mvb'
#define ___bpf_mvb(x, b, n, m) ((__u##b)(x) << (b-(n+1)*8) >> (b-8) << (m*8))
                                         ^
/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/include/linux/skbuff.h:2103:7: note: 'skb_put' declared here
void *skb_put(struct sk_buff *skb, unsigned int len);
      ^
In file included from progs/kprobe.c:3:
progs/skb_parse.h:460:41: error: use of undeclared identifier 'skc_num'; did you mean 'skb_put'?
                ske->l4.min.sport = bpf_htons(_C(skc, skc_num));
                                                      ^~~~~~~
                                                      skb_put
progs/skb_parse.h:79:46: note: expanded from macro '_C'
#define _C(src, f, ...)         BPF_PROBE_READ(src, f, ##__VA_ARGS__)
                                                    ^
/usr/include/bpf/bpf_endian.h:82:24: note: expanded from macro 'bpf_htons'
         __bpf_constant_htons(x) : __bpf_htons(x))
                              ^
/usr/include/bpf/bpf_endian.h:54:48: note: expanded from macro '__bpf_constant_htons'
# define __bpf_constant_htons(x)        ___bpf_swab16(x)
                                                      ^
/usr/include/bpf/bpf_endian.h:17:17: note: expanded from macro '___bpf_swab16'
                          ___bpf_mvb(x, 16, 1, 0)))
                                     ^
/usr/include/bpf/bpf_endian.h:13:42: note: expanded from macro '___bpf_mvb'
#define ___bpf_mvb(x, b, n, m) ((__u##b)(x) << (b-(n+1)*8) >> (b-8) << (m*8))
                                         ^
/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/include/linux/skbuff.h:2103:7: note: 'skb_put' declared here
void *skb_put(struct sk_buff *skb, unsigned int len);
      ^
In file included from progs/kprobe.c:3:
progs/skb_parse.h:460:41: error: use of undeclared identifier 'skc_num'; did you mean 'skb_put'?
                ske->l4.min.sport = bpf_htons(_C(skc, skc_num));
                                                      ^~~~~~~
                                                      skb_put
progs/skb_parse.h:79:46: note: expanded from macro '_C'
#define _C(src, f, ...)         BPF_PROBE_READ(src, f, ##__VA_ARGS__)
                                                    ^
/usr/include/bpf/bpf_endian.h:82:41: note: expanded from macro 'bpf_htons'
         __bpf_constant_htons(x) : __bpf_htons(x))
                                               ^
/usr/include/bpf/bpf_endian.h:52:45: note: expanded from macro '__bpf_htons'
# define __bpf_htons(x)                 __builtin_bswap16(x)
                                                          ^
/usr/src/kernels/4.19.90-25.53.v2101.ky10.x86_64/include/linux/skbuff.h:2103:7: note: 'skb_put' declared here
void *skb_put(struct sk_buff *skb, unsigned int len);
      ^
In file included from progs/kprobe.c:3:
progs/skb_parse.h:461:31: error: use of undeclared identifier 'skc_dport'
                ske->l4.min.dport = _C(skc, skc_dport);
                                            ^
progs/skb_parse.h:470:22: error: use of undeclared identifier 'sk_receive_queue'
        ske->rqlen = _C(sk, sk_receive_queue.qlen);
                            ^
progs/skb_parse.h:471:22: error: use of undeclared identifier 'sk_write_queue'
        ske->wqlen = _C(sk, sk_write_queue.qlen);
                            ^
progs/skb_parse.h:475:23: error: use of undeclared identifier 'skc_state'
        ske->state = _C(skc, skc_state);
                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
make[1]: *** [../common.mk:107: progs/kprobe.o] Error 1
make[1]: Leaving directory '/home/ll/nettrace/nettrace-master/src'
make: *** [Makefile:24: all] Error 2

请问这是什么原因报错?

cquliaoli avatar Oct 28 '25 16:10 cquliaoli