fix: link ICU dynamically on Alpine (musl static ICU is non-PIC) - #36
Merged
Conversation
Alpine's icu-static (libicuuc.a) is NOT built with -fPIC, so it can't link into the .node shared object — the alpine prebuild failed with the same "recompile with -fPIC" error as glibc. Correcting my earlier assumption that musl static archives are PIC. Static ICU is therefore only viable on macOS (Homebrew). Link ICU dynamically on ALL Linux (glibc + Alpine); the runtime image must provide ICU (`apk add icu-libs` in the zero-cache Alpine image). - icu.js: useStatic = isMac only; drop the Alpine static branch. - build.yml: drop `icu-static` from the alpine prebuild apk installs (icu-dev provides the headers and the .so we now link against). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
arv
force-pushed
the
arv/alpine-dynamic-icu
branch
from
June 3, 2026 08:05
b6b198f to
a42b828
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Alpine prebuild fails to link with:
Alpine's
icu-staticis not built with-fPIC, so it can't be linked into the.nodeshared object — the same wall glibc hit. (Correcting an earlier wrong assumption that musl static archives are PIC.)Static ICU only works on macOS. Both glibc and musl ship non-PIC static archives.
Fix
Link ICU dynamically on all Linux (glibc + Alpine); keep static on macOS.
deps/icu.js:useStatic = isMaconly (drop the Alpine static branch).build.yml: dropicu-staticfrom the alpine prebuild apk installs —icu-devprovides the headers and the.sowe now link against.Verified macOS still static-links and stays self-contained (
otool -Lshows no ICU).The Alpine
.nodenow has aNEEDED libicu*.so.<ver>, so the zero-cache Alpine runtime image must install ICU:RUN apk add --no-cache icu-libsWithout it, loading
@rocicorp/zero-sqlite3will fail at runtime on Alpine. (Couples to the ICU soname/major in the build image — currently Alpineicu 76.)Note on the in-flight v1.1.0 release
v1.1.0was cut before this fix, so its Alpine prebuild failed andnpm publishnever ran (npm is still on 1.0.18). This fix needs to be onmainand in a new tag (e.g. re-cut after merge) for the release to complete cleanly.🤖 Generated with Claude Code