Skip to content

Add s390x-unknown-linux-gnu target - #20327

Open
satyamg1620 wants to merge 2 commits into
tailwindlabs:mainfrom
satyamg1620:s390x-fix
Open

Add s390x-unknown-linux-gnu target#20327
satyamg1620 wants to merge 2 commits into
tailwindlabs:mainfrom
satyamg1620:s390x-fix

Conversation

@satyamg1620

Copy link
Copy Markdown

Summary

Adds s390x-unknown-linux-gnu (Linux on IBM Z, big-endian) as a supported platform for @tailwindcss/oxide, so it ships a prebuilt binding like the other Linux targets.

The oxide engine is byte-order-correct on big-endian — no code changes were needed, only build/packaging config:

  • Register s390x-unknown-linux-gnu in napi.targets + add the @tailwindcss/oxide-linux-s390x-gnu optional dependency
  • Add the crates/node/npm/linux-s390x-gnu sub-package
  • Add an s390x-unknown-linux-gnu row to the release build matrix (cross-compiled via --use-napi-cross, so no s390x runner is required)

Test plan

Verified on a native s390x host (RHEL, GCC 11.5, Node 24):

  • cargo test332 passed, 0 failed (extractors, scanner, glob, utf16)
  • Built the native binding with
    pnpm run --filter @tailwindcss/oxide build:platformtailwindcss-oxide.linux-s390x-gnu.node

Signed-off-by: satyamg1620 <Satyam.Gupta.3@ibm.com>
@satyamg1620
satyamg1620 requested a review from a team as a code owner July 14, 2026 06:22
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — all three changed files follow the exact same patterns as existing platform targets with no functional code changes.

Purely additive build/packaging config mirroring existing patterns exactly — no logic changes, no runtime code affected. napi-rs v3 explicitly documents s390x-unknown-linux-gnu as a supported cross-compilation target with --use-napi-cross.

No files require special attention.

Reviews (2): Last reviewed commit: "Copy s390x binding into its npm package ..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c68c9919-a786-48e7-8a83-8121cc3d557f

📥 Commits

Reviewing files that changed from the base of the PR and between af01dd3 and 525bf54.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release.yml

Walkthrough

Adds npm packaging metadata and optional dependency wiring for the @tailwindcss/oxide-linux-s390x-gnu native module. Extends the N-API target list and release workflow matrix for s390x-unknown-linux-gnu, including target-specific stripping, cross-compilation flags, binutils installation, and artifact staging.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding the s390x-unknown-linux-gnu target.
Description check ✅ Passed The description is directly related to the changeset and accurately summarizes the new s390x platform support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: satyamg1620 <Satyam.Gupta.3@ibm.com>
@satyamg1620

Copy link
Copy Markdown
Author

@adamwathan @RobinMalfait Can you please review this PR

1 similar comment
@satyamg1620

Copy link
Copy Markdown
Author

@adamwathan @RobinMalfait Can you please review this PR

RobinMalfait added a commit that referenced this pull request Aug 4, 2026
Right now, we use Rust for `@tailwindcss/oxide` which has 2
responsibilities:

1. Traverse the file system and figure out which files need to be
scanned based on auto source detection and `@source` directives.
2. Given those files, extract possible Tailwind CSS classes which we
call candidates.

Since this is using native code, we use napi-rs to get native `.node`
files on a per platform / arch basis.

So far so good, however, if you are on an OS that doesn't have a
prebuilt binary, you will receive an error that might look like this:

```
Error: Cannot find native binding. npm has a bug related to optional dependencies (npm/cli#4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at Object.<anonymous> (/private/var/folders/1k/bdv8blv93xq7qgwjdwc9z88h0000gn/T/tailwind-integrationspYHIVP/node_modules/.pnpm/@tailwindcss+oxide@file+..+..+..+..+..+..+..+Users+robin+github.com+tailwindlabs+tailwi_47ae1688f61c719f66c73e2ff35e430f/node_modules/@tailwindcss/oxide/index.js:573:19)
    at Module._compile (node:internal/modules/cjs/loader:1829:14)
    at Object..js (node:internal/modules/cjs/loader:1969:10)
    at Module.load (node:internal/modules/cjs/loader:1552:32)
    at Module._load (node:internal/modules/cjs/loader:1354:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.require (node:internal/modules/cjs/loader:1575:12)
    at require (node:internal/modules/helpers:191:16)
    at file:///private/var/folders/1k/bdv8blv93xq7qgwjdwc9z88h0000gn/T/tailwind-integrationspYHIVP/index.mjs:5:19
    at ModuleJob.run (node:internal/modules/esm/module_job:437:25) {
  cause: Error: Cannot find module '@tailwindcss/oxide-darwin-arm64'
```

This means that we have to add support for these platforms, and there
are some open PRs related to this, which could be closed by this PR:

- #20327
- #20276
- #20201

Today we already have support for the big platforms out there:

- Windows arm64
- Windows x64
- macOS arm64
- macOS x64

But then it starts to get a bit out of hand once we start looking at
Linux based versions:

- Android arm eabi
- Android arm64
- Linux arm64 gnu
- Linux arm64 gnueabihf
- Linux arm64 musl
- Linux x64 gnu
- Linux x64 musl
- freebsd x64

... and then we have the pending list from the 3 PRs linked above.
Adding support for all of these is not the end of the world, but it gets
complex if we need to keep supporting more and more. Right now we rely
on a bunch of non-default napi-rs setup in CI just to support these
other platforms.

This PR solves that by using the `wasm32-wasi` build as a universal
fallback. The napi-rs generated loader already knows how to fall back to
`@tailwindcss/oxide-wasm32-wasi`, but that package declared `"cpu":
["wasm32"]`, so npm/pnpm never installed it on real hardware. Removing
that restriction means the package is installed everywhere, and the
loader picks it up whenever no native binding exists.

This PR also fixes a `UVWASI_EACCES` crash on sandboxed platforms
(OpenHarmony, Android): the generated wasm loader preopens `/`, which
those sandboxes deny, so the fallback failed to load on exactly the
platforms that need it (see [this
comment](#20276 (comment))).
We patch `@napi-rs/cli`'s codegen templates via `pnpm patch` to retry
with narrower preopens (`/` → cwd → none). On such platforms, scanning
is limited to files under the current working directory.

## Test plan

Added two integration tests:

1. Trick pnpm (via `supportedArchitectures`) into installing for a
platform we explicitly don't support, and assert `@tailwindcss/oxide`
loads the wasm binding and scans files from disk.
2. Simulate a sandbox that denies preopening `/`, and assert the wasm
binding still loads and scans.

[ci-all]
@RobinMalfait

Copy link
Copy Markdown
Member

Hey, thanks for the PR!

Instead of adding and maintaining prebuilt native binaries for every platform, we've made the wasm32-wasi build of @tailwindcss/oxide an automatic fallback in #20383. When no native binding matches your OS/CPU, your package manager now installs the wasm build alongside the other optional dependencies, and the loader picks it up automatically.

This is not yet released, but is available as part of the insiders version. You can already try it by using:

CLI:

npm install tailwindcss@insiders @tailwindcss/cli@insiders

PostCSS:

npm install tailwindcss@insiders @tailwindcss/postcss@insiders

Vite:

npm install tailwindcss@insiders @tailwindcss/vite@insiders

webpack:

npm install tailwindcss@insiders @tailwindcss/webpack@insiders

Could you give that a try on your platform and let us know how it goes? If it works well for you, we'd like to close this PR in favor of the wasm fallback since it covers every platform at once. Thanks again!

@satyamg1620

Copy link
Copy Markdown
Author

Could you give that a try on your platform and let us know how it goes? If it works well for you, we'd like to close this PR in favor of the wasm fallback since it covers every platform at once. Thanks again!

Thanks @RobinMalfait for the review. I will try the same on my platform and update here

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