Skip to content

Switch Linux builds to musl for fully static binaries#93

Merged
sdairs merged 4 commits intomainfrom
static-linux-binaries
Apr 7, 2026
Merged

Switch Linux builds to musl for fully static binaries#93
sdairs merged 4 commits intomainfrom
static-linux-binaries

Conversation

@sdairs
Copy link
Copy Markdown
Collaborator

@sdairs sdairs commented Apr 7, 2026

Summary

  • Switch Linux release targets from *-linux-gnu to *-linux-musl, producing fully statically linked binaries
  • Use cross (pinned to v0.2.5) for both Linux targets to handle the musl toolchain
  • Update install.sh to fetch the new musl binary names
  • Add static-link verification step (file + ldd) for Linux artifacts
  • Add Docker-based smoke tests across 8 Linux distros before release
  • Expand test-install.yml OS matrix to cover more runners

Context

The CLI fails on Linux systems with older glibc:

chctl: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by chctl)
chctl: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.39' not found (required by chctl)

musl-linked binaries have zero runtime dependencies and work on any Linux distribution regardless of glibc version, similar to how ClickHouse itself ships statically linked binaries.

The project already uses rustls (no OpenSSL dependency), so the musl build works cleanly.

CI improvements

Release workflow (release.yml):

  • Pin cross to v0.2.5 for reproducible builds
  • Static-link verification: file + ldd checks on every Linux musl binary, fails the build if not statically linked
  • Smoke test job runs --version and --help in Docker containers before release is published:
    • Ubuntu 20.04, 22.04, 24.04
    • Debian Bullseye, Bookworm
    • CentOS 7 (glibc 2.17)
    • Amazon Linux 2
    • Alpine 3.18 (musl-based)
  • Release is gated on smoke tests passing (needs: [build, smoke-test])

Install test workflow (test-install.yml):

  • Expanded from [ubuntu-latest, macos-latest] to [ubuntu-22.04, ubuntu-24.04,macos-14, macos-15]

Test plan

  • CI builds succeed for both x86_64-unknown-linux-musl and aarch64-unknown-linux-musl
  • Static-link verification step passes
  • Smoke tests pass on all 8 Linux distros (especially CentOS 7 with glibc 2.17)
  • Install tests pass on expanded OS matrix

🤖 Generated with Claude Code

Linux targets were using gnu libc (dynamically linked), causing the CLI
to fail on systems with older glibc versions. Switch to musl targets
which produce fully statically linked binaries, matching ClickHouse's
approach of maximum portability across Linux distributions.

- x86_64-unknown-linux-gnu → x86_64-unknown-linux-musl (now uses cross)
- aarch64-unknown-linux-gnu → aarch64-unknown-linux-musl
- Updated install.sh to fetch musl binaries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sdairs sdairs requested a review from iskakaushik as a code owner April 7, 2026 19:01
sdairs and others added 3 commits April 7, 2026 20:17
…atrix

Release workflow:
- Pin cross to v0.2.5 instead of floating --git
- Add static-link verification step (file + ldd) for Linux musl artifacts
- Add smoke-test job that runs the built binary in Docker containers
  across 8 distros: Ubuntu 20.04/22.04/24.04, Debian Bullseye/Bookworm,
  CentOS 7, Amazon Linux 2, and Alpine 3.18
- Release now depends on smoke tests passing

Test-install workflow:
- Expand OS matrix: ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, macos-15

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
--tag requires --git flag; --version installs from crates.io which is
the correct way to pin a crates.io release.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sdairs sdairs merged commit 4ca8614 into main Apr 7, 2026
9 checks passed
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.

2 participants