libbpf-bootstrap icon indicating copy to clipboard operation
libbpf-bootstrap copied to clipboard

Cross compile failed with aarch64-none-linux-gnu

Open KevinChau9527 opened this issue 2 years ago • 3 comments

Hi, I'm using buildroot to cross compile bptfool and I get some error

2022-11-29T12:30:29 
2022-11-29T12:30:29 Auto-detecting system features:
2022-11-29T12:30:29 ...                        libbfd: [ on  ]
2022-11-29T12:30:29 ...        disassembler-four-args: [ on  ]
2022-11-29T12:30:29 ...                          zlib: [ on  ]
2022-11-29T12:30:29 ...                        libcap: [ on  ]
2022-11-29T12:30:29 ...               clang-bpf-co-re: [ on  ]
2022-11-29T12:30:29 
2022-11-29T12:30:31 CC       map_perf_ring.o
2022-11-29T12:30:32 CC       xlated_dumper.o
2022-11-29T12:30:33 CC       iter.o
2022-11-29T12:30:35 CC       btf.o
2022-11-29T12:30:36 CC       tracelog.o
2022-11-29T12:30:38 CC       link.o
2022-11-29T12:30:39 CC       perf.o
2022-11-29T12:30:40 CC       cfg.o
2022-11-29T12:30:41 CC       btf_dumper.o
2022-11-29T12:30:43 CC       net.o
2022-11-29T12:30:44 CC       struct_ops.o
2022-11-29T12:30:46 CC       netlink_dumper.o
2022-11-29T12:30:47 CC       common.o
2022-11-29T12:30:48 CC       cgroup.o
2022-11-29T12:30:50 CC       gen.o
2022-11-29T12:30:51 CC       main.o
2022-11-29T12:30:52 CC       json_writer.o
2022-11-29T12:30:53 
2022-11-29T12:30:53 Auto-detecting system features:
2022-11-29T12:30:53 ...                        libelf: [ on  ]
2022-11-29T12:30:53 ...                          zlib: [ on  ]
2022-11-29T12:30:53 ...                           bpf: [ on  ]
2022-11-29T12:30:53 
2022-11-29T12:30:53 GEN      bpf_helper_defs.h
2022-11-29T12:30:53 MKDIR    staticobjs/
2022-11-29T12:30:53 CC       staticobjs/libbpf.o
2022-11-29T12:30:55 CC       staticobjs/bpf.o
2022-11-29T12:30:55 CC       staticobjs/nlattr.o
2022-11-29T12:30:55 CC       staticobjs/btf.o
2022-11-29T12:30:56 CC       staticobjs/libbpf_errno.o
2022-11-29T12:30:56 CC       staticobjs/str_error.o
2022-11-29T12:30:56 CC       staticobjs/netlink.o
2022-11-29T12:30:56 CC       staticobjs/bpf_prog_linfo.o
2022-11-29T12:30:56 CC       staticobjs/libbpf_probes.o
2022-11-29T12:30:56 CC       staticobjs/xsk.o
2022-11-29T12:30:56 CC       staticobjs/hashmap.o
2022-11-29T12:30:56 CC       staticobjs/btf_dump.o
2022-11-29T12:30:57 CC       staticobjs/ringbuf.o
2022-11-29T12:30:57 LD       staticobjs/libbpf-in.o
2022-11-29T12:30:57 LINK     libbpf.a
2022-11-29T12:30:58 LINK     bpftool-bootstrap
2022-11-29T12:30:58 GEN      vmlinux.h
2022-11-29T12:30:58 ./bpftool-bootstrap: error while loading shared libraries: libelf.so.1: cannot open shared object file: No such file or directory
2022-11-29T12:30:58 make[2]: *** [Makefile:140: vmlinux.h] Error 127

It seems an error occurred when executing the bpftool-bootstrap program to generate vmlinux.h .

What should I do to skip this operation, or is there any way to fix it ?

Device:

HOST kernel version:

$ uname -a
Linux KEVIN 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Target kernel version:
VERSION = 5
PATCHLEVEL = 10
SUBLEVEL = 66

My cross-compile toolchain:

gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu

$ aarch64-none-linux-gnu-gcc --version
aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 10.3.1 20210621
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

KevinChau9527 avatar Nov 29 '22 05:11 KevinChau9527