Skip to content

chore(release): cross-compile libbpf for arm64#107

Open
maxgio92 wants to merge 1 commit into
mainfrom
goreleaser-arm64-fix
Open

chore(release): cross-compile libbpf for arm64#107
maxgio92 wants to merge 1 commit into
mainfrom
goreleaser-arm64-fix

Conversation

@maxgio92

@maxgio92 maxgio92 commented Jun 4, 2026

Copy link
Copy Markdown
Owner

The before.hooks step built libbpfgo-static once on the x86_64 host, producing a single libbpf.a for amd64. The arm64 build override correctly used aarch64-linux-gnu-gcc for the Go CGO step, but pointed at the same x86_64 libbpf.a, causing the linker to fail with 'file in wrong format'.

Fix by cross-compiling libbpf for arm64 into a separate output-arm64/ directory using aarch64-linux-gnu-gcc, then pointing the arm64 override at that directory. UAPI headers are arch-independent and are copied from the amd64 build.

The before.hooks step built libbpfgo-static once on
the x86_64 host, producing a single libbpf.a for
 amd64. The arm64 build override correctly used
aarch64-linux-gnu-gcc for the Go CGO step, but
pointed at the same x86_64 libbpf.a, causing
the linker to fail with 'file in wrong format'.

Fix by cross-compiling libbpf for arm64 into a separate
output-arm64/ directory using aarch64-linux-gnu-gcc,
then pointing the arm64 override at that directory.
UAPI headers are arch-independent and are copied
from the amd64 build.

Signed-off-by: Massimiliano Giovagnoli <maxgio92@pm.me>
@maxgio92 maxgio92 marked this pull request as ready for review June 4, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant