Skip to content

[CI] Build Nitro CLI musl binary in an Alpine container - #9959

Merged
tobias-tengler merged 2 commits into
mainfrom
tte/fix-nitro-cli-musl-aot-build
Jun 20, 2026
Merged

[CI] Build Nitro CLI musl binary in an Alpine container#9959
tobias-tengler merged 2 commits into
mainfrom
tte/fix-nitro-cli-musl-aot-build

Conversation

@tobias-tengler

@tobias-tengler tobias-tengler commented Jun 20, 2026

Copy link
Copy Markdown
Member

Problem

The linux-musl-x64 leg of the Build and Publish Nitro CLI job (release.yml) ran a NativeAOT publish (-p:PublishAot=true) on a glibc ubuntu-22.04 host. NativeAOT links a real native executable, and the link failed:

libSystem.Native.a(pal_errno.c.o): in function `SystemNative_StrErrorR':
pal_errno.c: undefined reference to `strlcpy'
clang : error : linker command failed with exit code 1

strlcpy is provided by musl libc, not glibc. The musl runtime pack must be linked against musl, which isn't present on a glibc host. That's why the Alpine/musl build never produced a working binary. The linux-x64 leg works because there host libc == target libc.

Fix

Run the musl leg inside an alpine:3.21 container so host libc == target libc, and install the AOT toolchain (clang, lld, build-base, zlib-dev, musl-dev, icu-libs, ...) plus github-cli (needed for the release-upload step, which isn't preinstalled in Alpine) via apk. The job-level container is driven from the matrix, so only the musl leg gets the container; all other legs still run directly on their host.

The linux-musl-x64 leg of the Nitro CLI release built a NativeAOT binary
on a glibc ubuntu-22.04 host. The native link step failed with
"undefined reference to 'strlcpy'" because the musl runtime pack must be
linked against musl libc, which is not present on a glibc host, so the
musl build never produced a working binary.

Run the musl leg inside an alpine:3.21 container (host libc == target
libc) and install the clang/lld/build-base toolchain plus github-cli via
apk so both the AOT link and the release upload succeed.

Also add a temporary nitro-musl-build-test job to ci.yml that reproduces
the Alpine musl build on every PR and runs the produced binary, so the
release change can be verified before merging.
Copilot AI review requested due to automatic review settings June 20, 2026 20:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@tobias-tengler
tobias-tengler merged commit e95a34f into main Jun 20, 2026
142 checks passed
@tobias-tengler
tobias-tengler deleted the tte/fix-nitro-cli-musl-aot-build branch June 20, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants