Skip to content

Build Linux MCP executable with static musl#859

Draft
st0012 wants to merge 1 commit into
mainfrom
codex/static-musl-mcp-ci-proof
Draft

Build Linux MCP executable with static musl#859
st0012 wants to merge 1 commit into
mainfrom
codex/static-musl-mcp-ci-proof

Conversation

@st0012

@st0012 st0012 commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

This prototypes building the packaged rubydex_mcp executable as a fully static musl binary for Linux precompiled gem builds.

The Ruby native extension keeps using the normal platform-specific build path. Only the standalone MCP executable is cross-built to musl during RELEASE=true Linux packaging, then verified before it is copied into the gem.

Why

A standalone Linux executable can fail to start on environments that do not provide the dynamic loader path baked into the binary. For the MCP server, we can avoid that class of startup failure by packaging a fully static executable with no ELF interpreter segment.

This is intentionally narrower than full musl support for the Ruby native extension. The extension is loaded by a running Ruby process and has different platform constraints.

What changed

  • Install musl-tools and the matching Rust musl target in Linux cibuildgem compile jobs.
  • Add Rubydex::MCPExecutableBuild to choose the MCP executable target and build command.
  • Split the MCP Cargo build from the Ruby extension build only when the MCP target differs from the extension target.
  • Verify the Linux musl MCP artifact has no PT_INTERP entry before packaging it.

Testing

  • shadowenv exec -- ruby -Itest -Ilib test/mcp_executable_build_test.rb
  • shadowenv exec -- bundle exec rubocop ext/rubydex/extconf.rb lib/rubydex/mcp_executable_build.rb test/mcp_executable_build_test.rb
  • git diff --check -- .github/workflows/cibuildgem.yaml ext/rubydex/extconf.rb lib/rubydex/mcp_executable_build.rb test/mcp_executable_build_test.rb

Notes

This is a draft PR to let CI prove whether the Linux packaging job can produce the fully static MCP artifact. If CI passes, the next useful check is to test the CI-built gem or executable artifact in a target environment without publishing a release.

@st0012 st0012 force-pushed the codex/static-musl-mcp-ci-proof branch 2 times, most recently from 6575940 to cd7db94 Compare June 12, 2026 17:11
@st0012 st0012 force-pushed the codex/static-musl-mcp-ci-proof branch from cd7db94 to 31931ef Compare June 12, 2026 17:22
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