<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/78681>78681</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Cross compilation of selftest/bpf failing on x86
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dubeyabhishek
</td>
</tr>
</table>
<pre>
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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WU1v2zgQ_TX0ZWBDoj5sH3xw5Lpb1GkXDbY9GpQ0sljTpEBS-djD_vYFJbtWkna7i60IBGYiUu89amaU5yEzhh8k4ookNyTZTFhra6VXZZvjE8trbmo8TnJVPq2-1FwgFFoZA4U6NVxweQDBZftI6NagqCwaS-g2byqolIZGPaBuijQWCKAkPC7SfRrDA7c1_JG30raUzoKY0OyMxyxXEriBivXg3dJKCaEe3J-otdIkWpNgQ4Lz51-Ebi8arFLCuBGN5fIwUGV6WYRGkO3WH97us08f7-7229367R2J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