Skip to content

Add musl target builds for glibc-independent binary distribution#46

Merged
azuchi merged 4 commits into
mainfrom
task-161-add-musl-static-build-for-release
Apr 14, 2026
Merged

Add musl target builds for glibc-independent binary distribution#46
azuchi merged 4 commits into
mainfrom
task-161-add-musl-static-build-for-release

Conversation

@rantan

@rantan rantan commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • リリースCIに x86_64-unknown-linux-musl / aarch64-unknown-linux-musl ターゲットを追加し、glibc非依存の静的リンクバイナリを配布可能にした
  • cross (cross-rs v0.2.5) によるDockerベースのmuslクロスコンパイル環境を構成
  • strip = true[profile.release] に統合し、全ターゲットで統一的にシンボル除去

Background

GitHub Actions の ubuntu-latest が Ubuntu 24.04 (glibc 2.39) に切り替わり、リリースバイナリが glibc 2.38+ に依存するようになった。AL2023 (glibc 2.34) 等の環境で動作しないため、musl静的リンクバイナリの追加が必要。

Changes

.github/workflows/release.yml

  • musl ターゲット2種をビルドマトリクスに追加(use_cross フラグで分岐)
  • cross インストールステップ追加(musl ターゲットのみ)
  • 成果物パスの条件分岐(target/{target}/release/ vs target/release/
  • fail-fast: false 追加
  • publish-crate / releaseif: startsWith(github.ref, 'refs/tags/') ガード追加

Cross.toml(新規)

  • musl ターゲットの Docker イメージを v0.2.5 に固定
  • aarch64 musl の GMP ツールチェイン名前解決用 symlink 設定

Cargo.toml

  • バージョン 0.5.70.5.8
  • gmp-mpfr-sysforce-cross フィーチャー追加(musl環境でのGMPビルド対応)
  • strip = true[profile.release] に追加

New release assets

  • electrs-v0.5.8-{platform}.tar.gz + .sha256
    • aarch64-linux-muslNEW
    • x86_64-linux-muslNEW
    • aarch64-linux-gnu (既存)
    • x86_64-linux-gnu (既存)
    • aarch64-apple-darwin (既存)

Test plan

  • テスト用タグ v0.5.8-rc1 で全5ターゲットのビルド成功を確認(Run
  • musl バイナリがアーティファクトとして生成されることを確認
  • musl バイナリの lddnot a dynamic executable を確認
  • AL2023 (glibc 2.34) 環境での起動確認

🤖 Generated with Claude Code

rantan and others added 4 commits April 13, 2026 17:28
- Add x86_64-unknown-linux-musl and aarch64-unknown-linux-musl to build matrix
- Use cross-rs for musl cross-compilation in Docker containers
- Add gmp-mpfr-sys with force-cross feature for musl builds
- Conditionally set binary path for cross vs cargo builds
- Restrict publish-crate and release jobs to tag pushes only
- Add branch trigger for build testing
- Bump version to 0.5.8

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move aarch64-unknown-linux-musl to ubuntu-latest (x86_64) runner
  since cross-rs Docker images are x86_64-only
- Add pre-build symlinks in Cross.toml to bridge tool naming mismatch
  (GMP configure expects "aarch64-unknown-linux-musl-*" but cross-rs
  provides "aarch64-linux-musl-*")
- Both musl targets verified: static-linked, glibc-independent binaries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use aarch64-linux-gnu-strip for aarch64 musl binary on x86_64 runner
- Install binutils-aarch64-linux-gnu for cross-arch strip support
- Add fail-fast: false so one build failure doesn't cancel others

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mplify version step

- Remove test branch trigger from release workflow
- Pin cross-rs Docker images to :0.2.5 (was :main)
- Pin cross install to --tag v0.2.5 for reproducibility
- Move strip to Cargo.toml (strip = true) and remove manual strip steps
- Remove unreachable SHA fallback in Get version step (only tag trigger exists)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rantan rantan requested a review from azuchi April 14, 2026 00:54
@azuchi azuchi merged commit ed2a1a9 into main Apr 14, 2026
13 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