Skip to content

fix(ci): add -x to x86_64-unknown-linux-gnu build for glibc compat#22

Merged
Princesseuh merged 1 commit intowithastro:feat/rustfrom
ramonclaudio:fix/linux-x64-gnu-glibc-v2
Apr 8, 2026
Merged

fix(ci): add -x to x86_64-unknown-linux-gnu build for glibc compat#22
Princesseuh merged 1 commit intowithastro:feat/rustfrom
ramonclaudio:fix/linux-x64-gnu-glibc-v2

Conversation

@ramonclaudio
Copy link
Copy Markdown

@ramonclaudio ramonclaudio commented Apr 6, 2026

Changes

  • Add -x flag to the x86_64-unknown-linux-gnu build command in CI, matching the pattern used by aarch64-unknown-linux-gnu, x86_64-unknown-linux-musl, and aarch64-unknown-linux-musl
  • Without -x, the x64-gnu target builds natively on ubuntu-latest (glibc 2.39), linking the binary against the host glibc. The published binary requires glibc 2.35+, which breaks on Vercel (glibc 2.34) and Amazon Linux 2023.
  • With -x, cargo-zigbuild pins glibc to 2.28

The upstream fix (napi-rs/napi-rs#3189) shipped in @napi-rs/[email protected] (2026-04-08). This PR is now ready to merge.

Testing

Verified on Vercel that the current binary fails with GLIBC_2.35 not found when loaded by Node.js on glibc 2.34. CI change only.

Docs

Bug fix only.

the x64-gnu target builds natively on ubuntu-latest (glibc 2.39)
without -x, linking the binary against the host glibc. this makes
it incompatible with glibc < 2.35 systems like Vercel (glibc 2.34)
and Amazon Linux 2023.

every other linux target already passes -x. the x64-gnu target was
the only one missing it.

requires the next @napi-rs/cli release after napi-rs/napi-rs#3189,
which fixes -x being ignored when host matches target.
@ramonclaudio
Copy link
Copy Markdown
Author

@Princesseuh the upstream napi-rs fix (napi-rs/napi-rs#3189) shipped in @napi-rs/[email protected] today, so -x now forces cargo-zigbuild on native linux builds. The current @astrojs/compiler-rs binary can't load on Vercel (and presumably AWS Lambda and Amazon Linux 2023, all glibc 2.34). Anyone trying the experimental rustCompiler flag on those platforms hits GLIBC_2.35 not found at build time and has to disable it.

Copy link
Copy Markdown
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ramonclaudio
Copy link
Copy Markdown
Author

NP.

@Princesseuh Princesseuh merged commit f54b744 into withastro:feat/rust Apr 8, 2026
6 checks passed
@ramonclaudio
Copy link
Copy Markdown
Author

ramonclaudio commented Apr 19, 2026

Follow-up: the -x flag added here turned out to be necessary but insufficient. The 0.1.7 binaries built with it still require GLIBC_2.35 because cargo zigbuild without an explicit glibc suffix defaults to zig's per-arch baseline (2.35 on x64, 2.30 on arm64 for zig 0.15).

Opened #25 with the real fix: switching to --use-napi-cross which matches @napi-rs/package-template, oxc, swc, and others. Verified end to end via fork CI, binaries now require GLIBC_2.16 (x64) and GLIBC_2.17 (arm64).

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