fix(build): enable musl target compatibility for boxlite-shim#317
Merged
DorianZheng merged 1 commit intomainfrom Mar 1, 2026
Merged
fix(build): enable musl target compatibility for boxlite-shim#317DorianZheng merged 1 commit intomainfrom
DorianZheng merged 1 commit intomainfrom
Conversation
Four issues prevented `make shim` from building on Linux musl (x86_64-unknown-linux-musl): 1. libc::statx missing on musl — the libc crate gates statx behind a musl_v1_2_3 cfg flag. Update libc at build time and set RUST_LIBC_UNSTABLE_MUSL_V1_2_3=1 to enable it. 2. libc::__rlimit_resource_t is glibc-specific — use c_int for musl (same as macOS). 3. Go CGO compiled with glibc gcc — set CC to musl-gcc when building libgvproxy for musl targets to avoid __fprintf_chk references. 4. Duplicate rust_eh_personality from libkrun.a staticlib — add --allow-multiple-definition to musl linker flags in .cargo/config.toml.
DorianZheng
added a commit
that referenced
this pull request
Mar 1, 2026
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
added a commit
that referenced
this pull request
Mar 1, 2026
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.
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.
Summary
make shimbuild failures on Linux musl (x86_64-unknown-linux-musl) by addressing four compatibility issues:RUST_LIBC_UNSTABLE_MUSL_V1_2_3=1to enable musl statx supportc_intfor musl (glibc-specific type)CCto musl-gcc to avoid glibc-specific__fprintf_chkreferences--allow-multiple-definitionlinker flag for all Linux targets (libkrun.a staticlib bundles its own std)Test plan
make shimsucceeds on Linux musl (tested on boxlite-dev GCE instance)