On 12/18, Ivan Babrou wrote:
> Hey,
> 
> Is it possible to cross-compile bpftool for arm64? I'm trying to do
> the same thing we do for perf, but bpftool Makefile doesn't seem to
> support CROSS_COMPILE variable, so one needs to pass
> CC=aarch64-linux-gnu-gcc as well. Problems do not end there as it
What error are you getting? Can you try setting the ARCH:
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

[..]
> requires EXTRA_LDFLAGS="-lz" too. With that I'm getting a long sad
> error about missing stuff from libbfd:
For this I've been waiting for the following patch to be merged
first: https://lkml.org/lkml/2018/11/16/243
Basically, on some platforms, -lbfd requires -liberty and/or -lz.
We need to test each case individually for bpftool, but the feature
tests are semi-broken without the patch above.

> 
> /lib/aarch64-linux-gnu/libbfd.a(elflink.o): In function
> `elf_link_add_object_symbols':
> /build/binutils-YyZpUv/binutils-2.28/builddir-single/bfd/../../bfd/elflink.c:4938:
> undefined reference to `objalloc_free_block'
> /build/binutils-YyZpUv/binutils-2.28/builddir-single/bfd/../../bfd/elflink.c:5185:
> undefined reference to `_sch_istable'
> /build/binutils-YyZpUv/binutils-2.28/builddir-single/bfd/../../bfd/elflink.c:5185:
> undefined reference to `_sch_istable'
> /lib/aarch64-linux-gnu/libbfd.a(elflink.o): In function
> `bfd_elf_size_dynamic_sections':
> /build/binutils-YyZpUv/binutils-2.28/builddir-single/bfd/../../bfd/elflink.c:6373:
> undefined reference to `lbasename'
> /build/binutils-YyZpUv/binutils-2.28/builddir-single/bfd/../../bfd/elflink.c:6604:
> undefined reference to `lbasename'
> /lib/aarch64-linux-gnu/libbfd.a(elflink.o): In function `elf_output_implib':
> /build/binutils-YyZpUv/binutils-2.28/builddir-single/bfd/../../bfd/elflink.c:11172:
> undefined reference to `xmalloc'
> /lib/aarch64-linux-gnu/libbfd.a(archures.o): In function `bfd_default_scan':
> /build/binutils-YyZpUv/binutils-2.28/builddir-single/bfd/../../bfd/archures.c:1171:
> undefined reference to `_sch_istable'
> /build/binutils-YyZpUv/binutils-2.28/builddir-single/bfd/../../bfd/archures.c:1171:
> undefined reference to `_sch_istable'
> 
> Binutils for arm64 are installed:
> 
> $ dpkg -l | fgrep binutils
> ii  binutils                           2.28-5
> amd64        GNU assembler, linker and binary utilities
> ii  binutils-aarch64-linux-gnu         2.28-5
> amd64        GNU binary utilities, for aarch64-linux-gnu target
> ii  binutils-dev                       2.28-5
> amd64        GNU binary utilities (BFD development files)
> 
> I'd love for it to work out of the box just like perf.

Reply via email to