Closed wangyd1988 closed 1 year ago
看样子,报错信息应该是在前面。请问是x86架构的吗?可以尝试clean一下再编译
是的,X86架构,已经clean还是不行,请问你们有具体的步骤吗
使用的是master分支最新的代码吗?我刚才试了一下,docker编译最新的代码是OK的。另外,麻烦确认一下imagedong/nettrace-build是不是最新版的,可以将这个镜像删除重新下载。
使用的是master分支最新的代码吗?我刚才试了一下,docker编译最新的代码是OK的。另外,麻烦确认一下imagedong/nettrace-build是不是最新版的,可以将这个镜像删除重新下载。
代码使用的master分支, imagedong/nettrace-build镜像也是最新的,还是报这个错,能帮忙看看吗
麻烦提供一下完整的编译log
麻烦提供一下完整的编译log
日志如下:
[root@node1 wyd]# docker run -it --rm --network=host --privileged -v /root/wyd/nettrace:/root/nettrace -v /lib/modules/:/lib/modules/ -v /usr/src/:/usr/src/ imagedong/nettrace-build make -C /root/nettrace/ COMPAT=1 all
make: Entering directory '/root/nettrace'
for i in nodetrace src legacy; do make -C $i all; done
make[1]: Entering directory '/root/nettrace/nodetrace'
gcc mark.c /root/nettrace/shared/pkt_utils.c /root/nettrace/component/net_utils.c /root/nettrace/component/arg_parse.c /root/nettrace/component/sys_utils.c /root/nettrace/shared/bpf_utils.c -o mark -lbpf -lelf -lz -O2 -static -I./ -I/root/nettrace/shared/bpf/ -DCOMPAT_MODE -Wno-deprecated-declarations -DVERSION=1.2.6 -DRELEASE=.tl3 -I/root/nettrace/shared/ -I/root/nettrace/component
gcc watch.c /root/nettrace/shared/pkt_utils.c /root/nettrace/component/net_utils.c /root/nettrace/component/arg_parse.c /root/nettrace/component/sys_utils.c /root/nettrace/shared/bpf_utils.c -o watch -lbpf -lelf -lz -O2 -static -I./ -I/root/nettrace/shared/bpf/ -DCOMPAT_MODE -Wno-deprecated-declarations -DVERSION=1.2.6 -DRELEASE=.tl3 -I/root/nettrace/shared/ -I/root/nettrace/component
make[1]: Leaving directory '/root/nettrace/nodetrace'
make[1]: Entering directory '/root/nettrace/src'
gcc trace.c /root/nettrace/shared/pkt_utils.c /root/nettrace/component/net_utils.c /root/nettrace/component/arg_parse.c /root/nettrace/component/sys_utils.c /root/nettrace/shared/bpf_utils.c trace_probe.c trace_tracing.c analysis.c /root/nettrace/component/parse_sym.c trace_group.c dropreason.c nettrace.c -o nettrace -lbpf -lelf -lz -O2 -static -I./ -I/root/nettrace/shared/bpf/ -DCOMPAT_MODE -DBPF_FEAT_STACK_TRACE -Wno-deprecated-declarations -DVERSION=1.2.6 -DRELEASE=.tl3 -I/root/nettrace/shared/ -I/root/nettrace/component
trace_probe.c: In function 'probe_trace_load':
trace_probe.c:90:38: error: 'struct kprobe' has no member named 'maps'
90 | bpf_mapset_max_entries(skel->maps.m_event, get_nprocs_conf());
| ^~
In file included from trace.h:12,
from trace_probe.c:4:
/root/nettrace/shared/bpf_utils.h:25:34: error: 'struct kprobe' has no member named 'maps'
25 | int fd = bpf_mapfd(skel->maps.m_config); \
| ^~
trace_probe.c:99:9: note: in expansion of macro 'bpf_set_config'
99 | bpf_set_config(skel, bss, trace_ctx.bpf_args);
| ^~~~~~
trace_probe.c: In function 'probe_trace_ready':
/root/nettrace/shared/bpf_utils.h:40:34: error: 'struct kprobe' has no member named 'maps'
40 | int fd = bpf_mapfd(skel->maps.m_config); \
| ^~
trace_probe.c:227:9: note: in expansion of macro 'bpf_set_config_field'
227 | bpf_set_config_field(skel, bss, ready, true);
| ^~~~~~~~
trace_probe.c: In function 'probe_print_stack':
trace_probe.c:233:38: error: 'struct kprobe' has no member named 'maps'
233 | int map_fd = bpf_mapfd(skel->maps.m_stack);
| ^~
make[1]: *** [../common.mk:110: nettrace] Error 1
make[1]: Leaving directory '/root/nettrace/src'
make[1]: Entering directory '/root/nettrace/legacy'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/root/nettrace/legacy'
make: Leaving directory '/root/nettrace'
先clean一下,然后再提供一下完整的日志哦~
先clean一下,然后再提供一下完整的日志哦~ [root@node1 wyd]# docker run -it --rm --network=host --privileged -v /root/wyd/nettrace:/root/nettrace -v /lib/modules/:/lib/modules/ -v /usr/src/:/usr/src/ imagedong/nettrace-build make -C /root/nettrace/ COMPAT=1 all make: Entering directory '/root/nettrace' for i in nodetrace src legacy; do make -C $i all; done make[1]: Entering directory '/root/nettrace/nodetrace' clang -O2 -c -S -Wall -fno-asynchronous-unwind-tables \ -Wno-incompatible-pointer-types-discards-qualifiers \ progs/ntrace.c -emit-llvm -Wno-unknown-attributes -I./ -I/root/nettrace/shared/bpf/ -DCOMPAT_MODE -Wno-unused-function -Wno-compare-distinct-pointer-types -Wuninitialized -DTARGET_ARCH_x86 -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/12/include -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//arch/x86/include -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//arch/x86/include/generated -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//include -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//arch/x86/include/uapi -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//arch/x86/include/generated/uapi -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//include/uapi -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//include/generated/uapi -include /lib/modules/4.19.91-26.6.5.kos5.x86_64/build//include/linux/kconfig.h -I/usr/include/ -DKERNEL -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 -DBPF_NO_GLOBAL_DATA -DBPF_NO_PRESERVE_ACCESS_INDEX -g -Xclang \ -disable-llvm-passes -o - | \ opt -O2 -mtriple=bpf-pc-linux | \ llvm-dis | \ llc -march=bpf -filetype=obj -o progs/ntrace.o bpftool gen skeleton progs/ntrace.o > progs/ntrace.skel.h gcc mark.c /root/nettrace/shared/pkt_utils.c /root/nettrace/component/net_utils.c /root/nettrace/component/arg_parse.c /root/nettrace/component/sys_utils.c /root/nettrace/shared/bpf_utils.c -o mark -lbpf -lelf -lz -O2 -static -I./ -I/root/nettrace/shared/bpf/ -DCOMPAT_MODE -Wno-deprecated-declarations -DVERSION=1.2.6 -DRELEASE=.tl3 -I/root/nettrace/shared/ -I/root/nettrace/component gcc watch.c /root/nettrace/shared/pkt_utils.c /root/nettrace/component/net_utils.c /root/nettrace/component/arg_parse.c /root/nettrace/component/sys_utils.c /root/nettrace/shared/bpf_utils.c -o watch -lbpf -lelf -lz -O2 -static -I./ -I/root/nettrace/shared/bpf/ -DCOMPAT_MODE -Wno-deprecated-declarations -DVERSION=1.2.6 -DRELEASE=.tl3 -I/root/nettrace/shared/ -I/root/nettrace/component rm progs/ntrace.o make[1]: Leaving directory '/root/nettrace/nodetrace' make[1]: Entering directory '/root/nettrace/src' python3 gen_trace.py > trace_group.c python3 gen_trace.py probe > progs/kprobe_trace.h ln -s vmlinux_header.h kheaders.h clang -O2 -c -S -Wall -fno-asynchronous-unwind-tables \ -Wno-incompatible-pointer-types-discards-qualifiers \ progs/kprobe.c -emit-llvm -Wno-unknown-attributes -I./ -I/root/nettrace/shared/bpf/ -DCOMPAT_MODE -DBPF_FEAT_STACK_TRACE -Wno-unused-function -Wno-compare-distinct-pointer-types -Wuninitialized -D__TARGET_ARCH_x86 -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/12/include -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//arch/x86/include -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//arch/x86/include/generated -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//include -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//arch/x86/include/uapi -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//arch/x86/include/generated/uapi -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//include/uapi -I/lib/modules/4.19.91-26.6.5.kos5.x86_64/build//include/generated/uapi -include /lib/modules/4.19.91-26.6.5.kos5.x86_64/build//include/linux/kconfig.h -I/usr/include/ -DKERNEL__ -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 -DBPF_NO_GLOBAL_DATA -DBPF_NO_PRESERVE_ACCESS_INDEX -g -DBPF_FEAT_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:79: progs/core.c:75:45: error: too many arguments provided to function-like macro invocation if (!bpf_core_field_exists(possible_net_t, net)) ^ /root/nettrace/shared/bpf/skb_macro.h:51:9: note: macro 'bpf_core_field_exists' defined here
define bpf_core_field_exists(field) false
^ In file included from progs/kprobe.c:79: progs/core.c:75:7: error: use of undeclared identifier 'bpf_core_field_exists' if (!bpf_core_field_exists(possible_net_t, net)) ^ 2 errors generated. bpftool gen skeleton progs/kprobe.o > progs/kprobe.skel.h gcc trace.c /root/nettrace/shared/pkt_utils.c /root/nettrace/component/net_utils.c /root/nettrace/component/arg_parse.c /root/nettrace/component/sys_utils.c /root/nettrace/shared/bpf_utils.c trace_probe.c trace_tracing.c analysis.c /root/nettrace/component/parse_sym.c trace_group.c dropreason.c nettrace.c -o nettrace -lbpf -lelf -lz -O2 -static -I./ -I/root/nettrace/shared/bpf/ -DCOMPAT_MODE -DBPF_FEAT_STACK_TRACE -Wno-deprecated-declarations -DVERSION=1.2.6 -DRELEASE=.tl3 -I/root/nettrace/shared/ -I/root/nettrace/component trace_probe.c: In function 'probe_trace_load': trace_probe.c:90:38: error: 'struct kprobe' has no member named 'maps' 90 | bpf_mapset_max_entries(skel->maps.m_event, get_nprocs_conf()); | ^~ In file included from trace.h:12, from trace_probe.c:4: /root/nettrace/shared/bpf_utils.h:25:34: error: 'struct kprobe' has no member named 'maps' 25 | int fd = bpf_mapfd(skel->maps.m_config); \ | ^~ trace_probe.c:99:9: note: in expansion of macro 'bpf_set_config' 99 | bpf_set_config(skel, bss, trace_ctx.bpf_args); | ^
~~~~~ trace_probe.c: In function 'probe_trace_ready': /root/nettrace/shared/bpf_utils.h:40:34: error: 'struct kprobe' has no member named 'maps' 40 | int fd = bpf_mapfd(skel->maps.m_config); \ | ^~ trace_probe.c:227:9: note: in expansion of macro 'bpf_set_config_field' 227 | bpf_set_config_field(skel, bss, ready, true); | ^~~~~~~~ trace_probe.c: In function 'probe_print_stack': trace_probe.c:233:38: error: 'struct kprobe' has no member named 'maps' 233 | int map_fd = bpf_mapfd(skel->maps.m_stack); | ^~ make[1]: *** [../common.mk:110: nettrace] Error 1 rm progs/kprobe.o make[1]: Leaving directory '/root/nettrace/src' make[1]: Entering directory '/root/nettrace/legacy' make[1]: Nothing to be done for 'all'. make[1]: Leaving directory '/root/nettrace/legacy' make: Leaving directory '/root/nettrace'
上边是clean之后的log,麻烦帮忙看看,谢谢 @xmmgithub
Sorry, 兼容模式下编译,有个宏定义的参数写的有问题。。。待我马上修复哈
Sorry, 兼容模式下编译,有个宏定义的参数写的有问题。。。待我马上修复哈
感谢感谢
编译条件: 操作系统:4.19.91 编译命令:docker run -it --rm --network=host --privileged -v:/root/nettrace -v /lib/modules/:/lib/modules/ -v /usr/src/:/usr/src/ imagedong/nettrace-build make -C /root/nettrace/ all
报错信息:
请问我需要改哪里,谢谢