Skip to content

fix(ci): cargo-zigbuild for GLIBC 2.17 broad compatibility - #951

Merged
ajianaz merged 4 commits into
developfrom
fix/zigbuild-glibc-2.17
Aug 8, 2026
Merged

ajianaz merged 4 commits into
developfrom
fix/zigbuild-glibc-2.17

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What

Linux binaries sekarang di-link terhadap GLIBC 2.17 via cargo-zigbuild + Zig linker, membuatnya compatible dengan distribusi Linux yang lebih lama.

Why

Binary v0.13.0 sebelumnya butuh GLIBC 2.39 (ubuntu-24.04 runner) — tidak jalan di Debian 12 (2.36), Ubuntu 22.04 LTS (2.35), RHEL 9 (2.34). Mayoritas server production masih di range itu.

cargo-zigbuild compile dengan GCC 14 di ubuntu-24.04 (numkong SIMD support), tapi relink binary against GLIBC 2.17 via Zig cross-linker. Hasil: binary yang jalan di RHEL 9, Debian 11/12, Ubuntu 18.04+ tanpa sacrifice SIMD performance.

Changes

  • Matrix: tambah zigbuild: true + glibc: "2.17" untuk Linux targets
  • Install cargo-zigbuild==0.23.0 + Zig untuk Linux builds
  • cargo zigbuild --target x86_64-unknown-linux-gnu.2.17 untuk Linux
  • Tambah GLIBC verification step (objdump -T check, fail jika > 2.17)
  • macOS/Windows tetap standard cargo build

Compatibility

Distro GLIBC Status
Ubuntu 18.04+ 2.27 ✅
Debian 11+ 2.31 ✅
Debian 12 2.36 ✅
Ubuntu 22.04 LTS 2.35 ✅
RHEL 9 / Rocky 9 2.34 ✅
Ubuntu 24.04 2.39 ✅

Testing

CI akan verify:

  1. Build sukses di ubuntu-24.04 + zigbuild
  2. GLIBC check step confirm binary ≤ 2.17
  3. ARM64 build juga menggunakan zigbuild
  4. macOS/Windows tidak terdampak

Linux binaries now link against GLIBC 2.17 via cargo-zigbuild + Zig
linker, making them compatible with RHEL 9, Debian 11/12, Ubuntu
18.04+, and other older Linux distributions.

Changes:
- Add zigbuild: true/glibc: '2.17' to Linux matrix entries
- Install Zig + cargo-zigbuild for Linux builds
- Use cargo zigbuild --target ...2.17 for Linux
- Add GLIBC verification step (objdump check)
- Keep standard cargo build for macOS/Windows

numkong 7.7.0 SIMD kernels still compile (GCC 14 on ubuntu-24.04),
but final binary links against old GLIBC via Zig's cross-linker.
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

⚠️ Review could not complete. LLM API error after retries: Unknown error — check workflow logs


Review powered by cora-code · BYOK · MIT

Address CodeCora findings:
- Explicitly install ziglang==0.14.1 alongside cargo-zigbuild
- Replace bash string comparison with sort -V for correct version
  ordering (handles 2.100 > 2.99 edge case)
ls -lh "${ORT_LIB_DIR:-ort-lib}/" || true

- name: Build release binaries
- name: Build release binaries (zigbuild — GLIBC 2.17)
Address CodeCora finding: cargo-zigbuild may output to suffixed path
(target/x86_64-unknown-linux-gnu.2.17/release/) depending on version.

- Add 'Resolve binary directory' step that checks both paths
- All subsequent steps (strip, verify, package) use resolved path
- Handles macOS correctly (no glibc suffix, falls through to standard)
- name: Verify GLIBC requirement (Linux zigbuild only)
if: matrix.zigbuild == true
run: |
BIN_DIR="${{ steps.bindir.outputs.path }}"
Address CodeCora finding #4: if objdump returns empty (corrupt binary,
static link, or silent failure), MAX_GLIBC would be empty and the
sort -V comparison would pass incorrectly.

- Add explicit empty check that fails the build
- Log '<none>' when MAX_GLIBC is empty for debuggability
@ajianaz
ajianaz merged commit cd8e23f into develop Aug 8, 2026
13 checks passed
ajianaz added a commit that referenced this pull request Aug 13, 2026
* fix(ci): use cargo-zigbuild for GLIBC 2.17 broad compat

Linux binaries now link against GLIBC 2.17 via cargo-zigbuild + Zig
linker, making them compatible with RHEL 9, Debian 11/12, Ubuntu
18.04+, and other older Linux distributions.

Changes:
- Add zigbuild: true/glibc: '2.17' to Linux matrix entries
- Install Zig + cargo-zigbuild for Linux builds
- Use cargo zigbuild --target ...2.17 for Linux
- Add GLIBC verification step (objdump check)
- Keep standard cargo build for macOS/Windows

numkong 7.7.0 SIMD kernels still compile (GCC 14 on ubuntu-24.04),
but final binary links against old GLIBC via Zig's cross-linker.

* fix(ci): pin ziglang version + use sort -V for GLIBC comparison

Address CodeCora findings:
- Explicitly install ziglang==0.14.1 alongside cargo-zigbuild
- Replace bash string comparison with sort -V for correct version
  ordering (handles 2.100 > 2.99 edge case)

* fix(ci): resolve zigbuild output path dynamically

Address CodeCora finding: cargo-zigbuild may output to suffixed path
(target/x86_64-unknown-linux-gnu.2.17/release/) depending on version.

- Add 'Resolve binary directory' step that checks both paths
- All subsequent steps (strip, verify, package) use resolved path
- Handles macOS correctly (no glibc suffix, falls through to standard)

* fix(ci): guard against empty GLIBC symbols in verification

Address CodeCora finding #4: if objdump returns empty (corrupt binary,
static link, or silent failure), MAX_GLIBC would be empty and the
sort -V comparison would pass incorrectly.

- Add explicit empty check that fails the build
- Log '<none>' when MAX_GLIBC is empty for debuggability

---------

Co-authored-by: ajianaz <[email protected]>
@ajianaz
ajianaz deleted the fix/zigbuild-glibc-2.17 branch August 13, 2026 01:52
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