Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): support compile to wasi target #22870

Merged
merged 52 commits into from
Jul 5, 2024
Merged

Conversation

Brooooooklyn
Copy link
Contributor

@Brooooooklyn Brooooooklyn commented Apr 18, 2024

This pull request is trying to add wasm32-wasi target support for the nx/native

To test the build, you can run the following commands:

  • rustup target add wasm32-wasip1-threads
  • pnpm exec napi build --release --platform --package-json-path packages/nx/package.json --manifest-path packages/nx/Cargo.toml --js ./native-bindings.js -o packages/nx/src/native --target wasm32-wasip1-threads

And the wasm file will be built at packages/nx/src/native/nx.wasm32-wasi.wasm

Blocked by:

The pseudo_terminal mod is excluded on the wasm32 targets, which is as expected.

The watch mod is excluded because of the upstream watchexec deps introduced by ignore-files don't support the wasi target at this moment (but we can improve it).

Related Issues

Fixes #21860
Fixes #23821

Copy link

vercel bot commented Apr 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2024 4:10pm

@Brooooooklyn Brooooooklyn changed the title Wasm feat(core): support compile to wasi target Apr 18, 2024
@Brooooooklyn
Copy link
Contributor Author

After spending several hours reviewing the source code of watchexec, a dependency of nx watch feature, I believe it might be quite challenging to successfully compile the nx watch module's functionality into wasi. This is because it heavily utilizes tokio::signal::unix::signal and stdio interfaces, which lack corresponding system calls in wasi-preview1 (currently, Node.js only supports wasi-preview1). Future versions like wasi-preview2 might offer support, but it will also require waiting for underlying dependencies such as tokio to incorporate support.

Copy link

Failed to publish a PR release of this pull request, triggered by @FrozenPandaz.
See the failed workflow run at: https://github.com/nrwl/nx/actions/runs/9500930772

Copy link

github-actions bot commented Jul 5, 2024

🐳 We have a release for that!

This PR has a release associated with it. You can try it out using this command:

npx [email protected] my-workspace

Or just copy this version and use it in your own command:

0.0.0-pr-22870-1e85c39
Release details 📑
Published version 0.0.0-pr-22870-1e85c39
Triggered by @FrozenPandaz
Branch wasm
Commit 1e85c39
Workflow run 9810353892

To request a new release for this pull request, mention someone from the Nx team or the @nrwl/nx-pipelines-reviewers.

Copy link

github-actions bot commented Jul 5, 2024

🐳 We have a release for that!

This PR has a release associated with it. You can try it out using this command:

npx [email protected] my-workspace

Or just copy this version and use it in your own command:

0.0.0-pr-22870-dcac42e
Release details 📑
Published version 0.0.0-pr-22870-dcac42e
Triggered by @FrozenPandaz
Branch wasm
Commit dcac42e
Workflow run 9810985850

To request a new release for this pull request, mention someone from the Nx team or the @nrwl/nx-pipelines-reviewers.

packages/nx/src/native/utils/atomics/default.rs Outdated Show resolved Hide resolved
packages/nx/src/native/utils/atomics/wasm.rs Outdated Show resolved Hide resolved
@FrozenPandaz FrozenPandaz marked this pull request as ready for review July 5, 2024 17:00
Copy link
Collaborator

@FrozenPandaz FrozenPandaz 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 so much @Brooooooklyn! Did a lot of refining here and it's working well!

@FrozenPandaz FrozenPandaz merged commit 981eb30 into nrwl:master Jul 5, 2024
6 checks passed
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nx is not supported on ppc64le (power architecture) Add native module support for loong64
4 participants