llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.82k stars 11.91k forks source link

Cross compilation of selftest/bpf failing on x86 #78681

Open dubeyabhishek opened 9 months ago

dubeyabhishek commented 9 months ago

While cross compiling linux/selftest/bpf for powerpc64le on x86_64 with Ubuntu22.04, compilation is failing with following error:

~/linux/tools/testing/selftests/bpf# CLANG_CROSS_FLAGS="--target=powerpc64le-linux-gnu --sysroot=/root/rootfs" make LLVM=1 CC=clang CROSS_COMPILE=powerpc64le-linux-gnu- ARCH=powerpc CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/libbpf.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/bpf.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/nlattr.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/btf.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/libbpf_errno.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/str_error.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/netlink.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/bpf_prog_linfo.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/libbpf_probes.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/hashmap.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/btf_dump.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/ringbuf.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/strset.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/linker.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/gen_loader.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/relo_core.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/usdt.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/zip.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/elf.o LD /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/staticobjs/libbpf-in.o LINK /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/libbpf.a Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h' Warning: Kernel ABI header at 'tools/include/uapi/linux/if_xdp.h' differs from latest version at 'include/uapi/linux/if_xdp.h' CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/libbpf.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/bpf.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/nlattr.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/btf.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/libbpf_errno.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/str_error.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/netlink.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/bpf_prog_linfo.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/libbpf_probes.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/hashmap.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/btf_dump.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/ringbuf.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/strset.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/linker.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/gen_loader.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/relo_core.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/usdt.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/zip.o CC /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/elf.o LD /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/sharedobjs/libbpf-in.o LINK /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/libbpf.so.1.4.0 /usr/bin/powerpc64le-linux-gnu-ld: cannot find /lib64/ld64.so.2 inside /root/rootfs clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [Makefile:166: /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/libbpf.so.1.4.0] Error 1 make[1]: [Makefile:140: all] Error 2 make: [Makefile:323: /root/linux/tools/testing/selftests/bpf/tools/build/libbpf/libbpf.a] Error 2 make: Deleting file '/root/linux/tools/testing/selftests/bpf/tools/build/libbpf/libbpf.a'

But, /lib64/ld64.so.2 is present in pointed sysroot.

Ubuntu Clang version 14.0.0 LLVM version 14.0.0 Upstream Linux kernel used

EugeneZelenko commented 9 months ago

Could you please try 17 or main branch?

dubeyabhishek commented 9 months ago

@EugeneZelenko Same result on master

Screenshot from 2024-01-23 20-26-59