Thanks, Oak > -----Original Message----- > From: Jiri Olsa <olsajiri@xxxxxxxxx> > Sent: July 15, 2022 4:26 AM > To: Zeng, Oak <oak.zeng@xxxxxxxxx> > Cc: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>; bpf@xxxxxxxxxxxxxxx > Subject: Re: Build error of samples/bpf > > On Fri, Jul 15, 2022 at 03:54:42AM +0000, Zeng, Oak wrote: > > SNIP > > > > > CC samples/bpf/xdp_router_ipv4_user.o > > > > CC samples/bpf/xdp_rxq_info_user.o > > > > CC samples/bpf/xdp_sample_pkts_user.o > > > > CC samples/bpf/xdp_tx_iptunnel_user.o > > > > CC samples/bpf/xdpsock_ctrl_proc.o > > > > CC samples/bpf/xsk_fwd.o > > > > CLANG-BPF samples/bpf/xdp_sample.bpf.o > > > > CLANG-BPF samples/bpf/xdp_redirect_map_multi.bpf.o > > > > CLANG-BPF samples/bpf/xdp_redirect_cpu.bpf.o > > > > CLANG-BPF samples/bpf/xdp_redirect_map.bpf.o > > > > CLANG-BPF samples/bpf/xdp_monitor.bpf.o > > > > CLANG-BPF samples/bpf/xdp_redirect.bpf.o > > > > BPF GEN-OBJ samples/bpf/xdp_monitor > > > > BPF GEN-SKEL samples/bpf/xdp_monitor > > > > libbpf: map 'rx_cnt': unexpected def kind var. > > > > > > IIRC, this error is due to older clang. Can you try with a newer clang > > > (11 and above)? > > > > Thank you Kumar. > > > > I updated to llvm/clang to version 12, the issue persists. > > > > I also have another problem... To build those xdp samples, I need to enable > CONFIG_DEBUG_INFO_BTF. But once this is enabled, I failed to build linux > kernel with below errors. I was able to build on a 4.15 ubuntu machine but on > a 5.11 ubuntu machine, I had below error to build the same kernel. Any one > can give me some hint? I searched google but didn't figure out. I noticed > somethings is killed during build of .bpf.vmlinux.bin.o, so I guess some of my > tools is not updated? > > > > > > > > szeng@szeng-develop:~/dii-tools/linux$ make -j$(nproc) > > DESCEND objtool > > DESCEND bpf/resolve_btfids > > CALL scripts/atomic/check-atomics.sh > > CALL scripts/checksyscalls.sh > > CHK include/generated/compile.h > > UPD include/generated/compile.h > > CC init/version.o > > AR init/built-in.a > > CHK kernel/kheaders_data.tar.xz > > GEN .version > > CHK include/generated/compile.h > > UPD include/generated/compile.h > > CC init/version.o > > AR init/built-in.a > > LD vmlinux.o > > MODPOST vmlinux.symvers > > MODINFO modules.builtin.modinfo > > GEN modules.builtin > > LD .tmp_vmlinux.btf > > BTF .btf.vmlinux.bin.o > > Killed > > looks like something happened during BTF generation and that's > probably the reason why 'BTFIDS' is failing below > > I'd double check with V=1 and if it's pahole that's killed, > I'd check that you can run it properly.. maybe some library > mismatch? or try to build and install the latest pahole Hi Jiri, Thanks for your reply. Yes the problem was a old version of pahole (v 1.21). After installed pahole 1.23 above issue disappeared. But when I build xdp samples, below error still persist even I updated llvm to version 12 or 14. Anyone had the same issue? CLANG-BPF samples/bpf/xdp_redirect.bpf.o BPF GEN-OBJ samples/bpf/xdp_monitor BPF GEN-SKEL samples/bpf/xdp_monitor libbpf: map 'rx_cnt': unexpected def kind var. Error: failed to open BPF object file: Invalid argument make[1]: *** [samples/bpf/Makefile:439: samples/bpf/xdp_monitor.skel.h] Error 255 make[1]: *** Deleting file 'samples/bpf/xdp_monitor.skel.h' make: *** [Makefile:1868: samples/bpf] Error 2 > > there was similar issue recently: > https://lore.kernel.org/bpf/CAJQ9wQ- > 0UUAqzyB5P9Xy_0=hpxg9m+2OEzAmk2nWnoX9es9Gnw@xxxxxxxxxxxxxx/T > /#t > > jira > > > > LD .tmp_vmlinux.kallsyms1 > > KSYMS .tmp_vmlinux.kallsyms1.S > > AS .tmp_vmlinux.kallsyms1.S > > LD .tmp_vmlinux.kallsyms2 > > KSYMS .tmp_vmlinux.kallsyms2.S > > AS .tmp_vmlinux.kallsyms2.S > > LD vmlinux > > BTFIDS vmlinux > > FAILED: load BTF from vmlinux: No such file or directory > > make: *** [Makefile:1183: vmlinux] Error 255 > > make: *** Deleting file 'vmlinux' > > > > > > Thanks, > > Oak > > > > > > > > > Error: failed to open BPF object file: Invalid argument > > > > samples/bpf/Makefile:430: recipe for target > > > 'samples/bpf/xdp_monitor.skel.h' failed > > > > make[1]: *** [samples/bpf/xdp_monitor.skel.h] Error 255 > > > > make[1]: *** Deleting file 'samples/bpf/xdp_monitor.skel.h' > > > > Makefile:1868: recipe for target 'samples/bpf' failed > > > > make: *** [samples/bpf] Error 2 > > > > > > > > > > > > Thanks, > > > > Oak > > > >