Skip to content

fix: build linux gnu binaries against glibc 2.17#62

Merged
dsherret merged 1 commit into
mainfrom
ci_zigbuild_glibc
Jul 15, 2026
Merged

fix: build linux gnu binaries against glibc 2.17#62
dsherret merged 1 commit into
mainfrom
ci_zigbuild_glibc

Conversation

@dsherret

Copy link
Copy Markdown
Member

Same change as dprint/dprint#1203 (fixes the same class of issue as dprint/dprint#796 for this plugin).

The published linux gnu binaries inherited the runner's glibc floor (ubuntu-22.04 = glibc 2.35), so they fail on older distros. This builds them with cargo-zigbuild targeting glibc 2.17 — Rust's own minimum for these targets (CentOS 7+) — so the runner's glibc no longer matters.

  • the test suite builds and runs through cargo-zigbuild test on the x86_64 gnu target, so tests exercise binaries linked exactly like the published ones (glibc 2.17 binaries run fine on the newer-glibc runner)
  • a readelf guard verifies the max required GLIBC_ symbol never exceeds the target version: on the debug build for PRs, and on the release build after the tests so it checks the exact binary that gets zipped (readelf instead of objdump because the aarch64 binary is checked on the x86_64 runner)
  • aarch64 gnu no longer needs gcc-aarch64-linux-gnu or the linker env var — zigbuild provides the cross linker (aarch64-musl keeps its own gcc install; its linker comes from .cargo/config.toml)

Unlike the dprint repo, no LZMA_API_STATIC is needed here — this crate has no native system-library dependencies (checked Cargo.lock: no lzma-sys/zstd-sys/ring).

Same change as dprint/dprint#1203. The published gnu binaries inherited
the runner's glibc floor (ubuntu-22.04 = 2.35), breaking older distros
(dprint/dprint#796). Building with cargo-zigbuild targeting glibc 2.17
(Rust's own minimum for these targets, CentOS 7+) makes the binaries
run anywhere regardless of the runner's glibc.

- the test suite builds and runs through cargo-zigbuild too, so tests
  exercise binaries linked the same way as the published ones
- a readelf check verifies the max required GLIBC_ symbol never exceeds
  the target version (debug on PRs, release right before zipping)
- aarch64 gnu no longer needs gcc-aarch64-linux-gnu -- zigbuild
  provides the cross linker
@dsherret dsherret changed the title ci: build linux gnu binaries against glibc 2.17 with cargo-zigbuild fix: build linux gnu binaries against glibc 2.17 Jul 15, 2026
@dsherret
dsherret merged commit 21f17c3 into main Jul 15, 2026
16 checks passed
@dsherret
dsherret deleted the ci_zigbuild_glibc branch July 15, 2026 14:43
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