Skip to content

fix(build): switch shim from musl to glibc static linking#319

Merged
DorianZheng merged 1 commit intomainfrom
fix/gnu-static-shim
Mar 1, 2026
Merged

fix(build): switch shim from musl to glibc static linking#319
DorianZheng merged 1 commit intomainfrom
fix/gnu-static-shim

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

Go c-archive (libgvproxy) is fundamentally incompatible with musl TLS, causing SIGSEGV at runtime. Replace musl target with gnu + crt-static for a fully static binary using glibc's static libraries.

Key changes:

--target is required on Linux so RUSTFLAGS don't affect proc-macro compilation. relocation-model=static avoids static-pie which crashes with Go c-archive relocations.

Go c-archive (libgvproxy) is fundamentally incompatible with musl TLS,
causing SIGSEGV at runtime. Replace musl target with gnu + crt-static
for a fully static binary using glibc's static libraries.

Key changes:
- Revert musl compat commits (#317, #318) that are no longer needed
- Use x86_64-unknown-linux-gnu with +crt-static and relocation-model=static
- Add link-krun feature to gate libkrun.a linking (shim-only)
- Feature-gate krun VMM module so boxlite-cli doesn't link libkrun.a
- Remove shim pre-build from CI (builds natively in manylinux container)
- Remove configure_library_env dependency on krun_create_ctx symbol

--target is required on Linux so RUSTFLAGS don't affect proc-macro
compilation. relocation-model=static avoids static-pie which crashes
with Go c-archive relocations.
@DorianZheng DorianZheng merged commit 7c55942 into main Mar 1, 2026
4 checks passed
@DorianZheng DorianZheng deleted the fix/gnu-static-shim branch March 1, 2026 14:45
DorianZheng added a commit that referenced this pull request Mar 2, 2026
Go's CGO net package calls res_search from libresolv for DNS lookups.
With dynamic linking, libresolv.so is resolved transitively. After
switching to glibc static linking (#319), libresolv.a must be linked
explicitly since glibc separates it from libc.a.

Also make glibc-static a required dependency in manylinux setup since
it provides both libc.a and libresolv.a needed for +crt-static builds.
DorianZheng added a commit that referenced this pull request Mar 2, 2026
Go's CGO net package calls res_search from libresolv for DNS lookups.
With dynamic linking, libresolv.so is resolved transitively. After
switching to glibc static linking (#319), libresolv.a must be linked
explicitly since glibc separates it from libc.a.

Also make glibc-static a required dependency in manylinux setup since
it provides both libc.a and libresolv.a needed for +crt-static builds.
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