Skip to content

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Jul 16, 2025

Summary

Add wasm32-wasip2 to DEFAULT_EXTRA_TARGET_TRIPLES following the same pattern as wasm32-wasip1. This ensures WASI Preview 2 toolchains are generated out-of-the-box alongside Preview 1, providing consistency for users working with both WASI versions.

Changes

  • Target Triple Registration: Add wasm32-wasip2 to DEFAULT_EXTRA_TARGET_TRIPLES in rust/private/repository_utils.bzl

This addresses the feedback from @cameron-martin to include wasm32-wasip2 in the default extra target triples for automatic toolchain generation.

@avrabe avrabe force-pushed the wasi-p2-support-pr branch 7 times, most recently from 7249b22 to d834ab8 Compare July 22, 2025 17:27
@cameron-martin
Copy link
Contributor

cameron-martin commented Jul 23, 2025

This looks very useful, thanks.

I'm not sure what the policy for this repo regarding how focused changes are but this looks like at least 3 distinct things are included here:

  • Adding features section to README.
  • Fixing some issues with cross-compilation toolchains (some changes to the allocator library and tracking some extra input files).
  • Adding wasip2 support.

@cameron-martin
Copy link
Contributor

Maybe you could add wasm32-wasip2 to DEFAULT_EXTRA_TARGET_TRIPLES, considering wasm32-wasip1 is there already? This way the wasip2 toolchains are generated out-of-the-box.

@avrabe
Copy link
Contributor Author

avrabe commented Jul 24, 2025

Thanks for the feedback @cameron-martin! You're absolutely right about this covering multiple areas - I'm still learning the contribution patterns here so really appreciate the guidance.

For the DEFAULT_EXTRA_TARGET_TRIPLES suggestion, that makes perfect sense for consistency. I'll add that.

Regarding splitting this up - I'm totally open to that if it would be better for the project. I was trying to get all the WASI P2 pieces working together but I realize that might not align with how changes are typically structured here. Would you recommend breaking it into separate PRs? Happy to follow whatever approach works best.

Thanks for taking the time to review - still getting familiar with the codebase so feedback like this is really helpful.

@avrabe avrabe force-pushed the wasi-p2-support-pr branch 2 times, most recently from ef700fc to 28f4d92 Compare July 28, 2025 09:37
@cameron-martin
Copy link
Contributor

Would you recommend breaking it into separate PRs?

That'll be a question for @illicitonion and @UebelAndre. I was just suggesting it may be easier to review that way.

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, thanks!

@UebelAndre
Copy link
Collaborator

looks like there are formatting issues though.

@avrabe avrabe force-pushed the wasi-p2-support-pr branch from 28f4d92 to 06eea3e Compare July 30, 2025 13:43
- Add WASI version constraint settings and platform configurations for wasip2
- Add support for wasm32-wasip2 and wasm32-wasip1-threads targets
- Fix WASI toolchain and allocator library issues for cross-compilation
- Add comprehensive unit tests and documentation for WASI platform functionality
@avrabe avrabe force-pushed the wasi-p2-support-pr branch from 06eea3e to 0d583ae Compare July 30, 2025 13:51
@avrabe
Copy link
Contributor Author

avrabe commented Jul 30, 2025

Thanks @UebelAndre for catching the formatting issues! I've now fixed all the buildifier and clang-format issues that were causing the CI to fail.

All pre-commit hooks are now passing and the code-format-checks should be green.

@UebelAndre UebelAndre added this pull request to the merge queue Jul 30, 2025
Merged via the queue into bazelbuild:main with commit 7d7d3ac Jul 30, 2025
3 checks passed
@hlopko
Copy link
Member

hlopko commented Jul 31, 2025

Howdy, I think by default we should use https://github.com/bazelbuild/platforms for constrant_settings & values. Is there a reason not to do it here?

cc @krasimirgg

@cameron-martin
Copy link
Contributor

@platforms doesn't include a way to distinguish between wasip1 and wasip2 afaik.

@avrabe
Copy link
Contributor Author

avrabe commented Jul 31, 2025

Thanks for the heads-up! I wasn’t aware that bazelbuild/platforms is the default place for these constraints — that makes sense in hindsight. After looking into it, I saw there’s already an open issue about adding support for wasip1 and wasip2 (bazelbuild/platforms#123), so I went ahead and submitted a patch there to help move things forward.

Happy to follow up once that’s merged so we can align fully. Appreciate the pointer!

@hlopko
Copy link
Member

hlopko commented Aug 1, 2025

Thanks so much for a quick response!! ❤️

Copy link

@juankyc juankyc left a comment

Choose a reason for hiding this comment

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

Pendiente

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.

5 participants