Skip to content

fix(docker): install arm64 target libc headers for the cross build#964

Merged
minhd-vu merged 2 commits into
mainfrom
minhd-vu/docker-arm64-libc-headers
Jul 21, 2026
Merged

fix(docker): install arm64 target libc headers for the cross build#964
minhd-vu merged 2 commits into
mainfrom
minhd-vu/docker-arm64-libc-headers

Conversation

@minhd-vu

Copy link
Copy Markdown
Contributor

Summary

The Docker publish workflow added in #963 fails on the arm64 cross-compile step (failed run):

/usr/include/stdio.h:28:10: fatal error: bits/libc-header-start.h: No such file or directory

Cause

The build stage installs gcc-aarch64-linux-gnu, which pulls the arm64 runtime libs (libc6-arm64-cross, libgcc-14-dev-arm64-cross) but not the arm64 libc dev headers. The CGO cross-compile then can't find bits/libc-header-start.h / bits/wordsize.h. The release workflow (make cross) doesn't hit this because it runs on the full ubuntu-latest VM where those headers already exist; the slim golang image ships neither.

The amd64 image builds fine (native compile on the amd64 runner), so only the arm64 path was affected.

Fix

Install libc6-dev-arm64-cross, which provides the aarch64 sysroot headers.

Validation

Reproduced the exact amd64 → arm64 cross-compile under emulation:

  • Without libc6-dev-arm64-cross: identical bits/libc-header-start.h: No such file failure.
  • With it: CROSS_OK.

arm64 image also rebuilt and runs (polycli version) locally.

🤖 Generated with Claude Code

minhd-vu and others added 2 commits July 21, 2026 10:35
The slim golang image ships gcc-aarch64-linux-gnu's runtime libs but not
the arm64 libc dev headers, so the CGO cross-compile failed with
`bits/libc-header-start.h: No such file`. Add libc6-dev-arm64-cross,
which provides the aarch64 sysroot headers. Verified by reproducing the
amd64->arm64 cross-compile under emulation (fails without, CROSS_OK with).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@minhd-vu
minhd-vu enabled auto-merge (squash) July 21, 2026 14:45
@minhd-vu
minhd-vu merged commit 4879e47 into main Jul 21, 2026
16 checks passed
@minhd-vu
minhd-vu deleted the minhd-vu/docker-arm64-libc-headers branch July 21, 2026 14:46
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.

2 participants