[Buildroot] [PATCH 1/4] package/libbpf: fix cross compilation for 32-bit targets

Thomas Petazzoni thomas.petazzoni at bootlin.com
Wed Oct 26 20:00:09 UTC 2022


Hello Tobias,

Thanks for this patch!

On Thu, 20 Oct 2022 16:14:09 +0200
Tobias Waldekranz <tobias at waldekranz.com> wrote:

> Add upstream patch that sources the library path (lib vs. lib64) from
> the compiler rather than from uname(1).

Could you copy/paste the details of the build failure that was
occurring, and provide details on the context it was occurring?

Indeed, when looking at the results of our autobuilders in terms of
failures when building libbpf, I don't see anything relevant:

  http://autobuild.buildroot.net/?reason=libbpf%

In recent months, we only had build failures on the S390x architecture,
that don't seem related to this.

>  ...cross-compilation-for-32-bit-targets.patch | 37 +++++++++++++++++++
>  1 file changed, 37 insertions(+)
>  create mode 100644 package/libbpf/1.0.1/0001-Makefile-Fix-cross-compilation-for-32-bit-targets.patch
> 
> diff --git a/package/libbpf/1.0.1/0001-Makefile-Fix-cross-compilation-for-32-bit-targets.patch b/package/libbpf/1.0.1/0001-Makefile-Fix-cross-compilation-for-32-bit-targets.patch
> new file mode 100644
> index 0000000000..3730b2fa41

Please put the patch directly in package/libbpf/. Putting it in a
1.0.1/ sub-directory is not needed. We only do that for packages where
multiple versions are used (like package/gcc, package/binutils for
example).

> --- /dev/null
> +++ b/package/libbpf/1.0.1/0001-Makefile-Fix-cross-compilation-for-32-bit-targets.patch
> @@ -0,0 +1,37 @@
> +From 68e6f83f223ebf3fbf0d94c0f4592e5e6773f0c1 Mon Sep 17 00:00:00 2001
> +From: Tobias Waldekranz <tobias at waldekranz.com>
> +Date: Fri, 14 Oct 2022 21:14:14 +0200
> +Subject: [PATCH] Makefile: Fix cross-compilation for 32-bit targets
> +
> +Determining the correct library installation path (lib vs. lib64)
> +using uname(1) breaks in cross compilation scenarios where word widths
> +differ between the host and target system.
> +
> +Instead, source the information from the compilers '-dumpmachine'
> +option (supported by both GCC and Clang).
> +
> +We call this the "host" architecture, using the same nomenclature as
> +Autotools (--host configure option).
> +

Please add:

Upstream: https://github.com/libbpf/libbpf/commit/68e6f83f223ebf3fbf0d94c0f4592e5e6773f0c1

> +Signed-off-by: Tobias Waldekranz <tobias at waldekranz.com>

Could you send a v2 with those changes? I was about to do the changes
myself, but I really don't know which build failure this patch is
fixing so I couldn't fix that up myself in the commit log.

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com



More information about the buildroot mailing list