feat(wasm-builder): add support for new wasm32v1-none target#7008
feat(wasm-builder): add support for new wasm32v1-none target#7008bkchr merged 26 commits intoparitytech:masterfrom StackOverflowExcept1on:wasm32v1-none
wasm32v1-none target#7008Conversation
|
Review required! Latest push from author must always be reviewed |
|
How do I pass CI checks like SemVer and other? |
|
Ping @bkchr It seems the CI won't trigger. |
|
@StackOverflowExcept1on https://github.com/paritytech/polkadot-sdk/actions/runs/12674781431/job/35324397805?pr=7008 This required CI failed, could you fix it? |
|
@jasl @bkchr I'll fix that in the next 30 minutes. Also wondering if we'll have to update the runners tomorrow, since the new version 1.84 will be stable tomorrow. I mean that the |
Head branch was pushed to by a user without write access
I'm not Parity staff, so I don't know... |
|
Actually I realized something, @StackOverflowExcept1on can we change the pr to make the new target optional? So, it should still accept the |
|
@bkchr For now, do you want to use an environment variable like |
|
Several required CI checks fail. Maybe the latest patch has trouble |
|
@jasl I think it's some kind of problem with std hitting wasmv1-none (it doesn't support it). It may have happened after recent merge of master. |
with paritytech/polkadot-sdk#7008 and NixOS/nixpkgs#383875 we can now build the runtimes again using a stable rust compiler and no hacks. tests are also working.
with paritytech/polkadot-sdk#7008 and NixOS#383875 we can now build the runtimes again using a stable rust compiler and no hacks. tests are also working again.
with paritytech/polkadot-sdk#7008 and NixOS/nixpkgs#383875 we can now build the runtimes again using a stable rust compiler and no hacks. tests are also working.
Additionally drops wasm-unknown-unknown depedency in favor of `wasm32v1-none` to align with polkadot-sdk feature: feat(wasm-builder): add support for new `wasm32v1-none` target polkadot-sdk PR: [#7008](paritytech/polkadot-sdk#7008) Resolves [#5777](paritytech/polkadot-sdk#5777) Previously `wasm-builder` used hacks such as `-Zbuild-std` (required `rust-src` component) and `RUSTC_BOOTSTRAP=1` to build WASM runtime without WASM features: `sign-ext`, `multivalue` and `reference-types`, but since Rust 1.84 (will be stable on 9 January, 2025) the situation has improved as there is new [`wasm32v1-none`](https://doc.rust-lang.org/beta/rustc/platform-support/wasm32v1-none.html) target that disables all "post-MVP" WASM features except `mutable-globals`. Wasm builder requires the following prerequisites for building the WASM binary: - Rust >= 1.68 and Rust < 1.84: - `wasm32-unknown-unknown` target - `rust-src` component - Rust >= 1.84: - `wasm32v1-none` target - no more `-Zbuild-std` and `RUSTC_BOOTSTRAP=1` hacks and `rust-src` component requirements! Jira: - SYS-4677 - SYS-4551
Additionally drops wasm-unknown-unknown depedency in favor of `wasm32v1-none` to align with polkadot-sdk feature: feat(wasm-builder): add support for new `wasm32v1-none` target polkadot-sdk PR: [#7008](paritytech/polkadot-sdk#7008) Resolves [#5777](paritytech/polkadot-sdk#5777) Previously `wasm-builder` used hacks such as `-Zbuild-std` (required `rust-src` component) and `RUSTC_BOOTSTRAP=1` to build WASM runtime without WASM features: `sign-ext`, `multivalue` and `reference-types`, but since Rust 1.84 (will be stable on 9 January, 2025) the situation has improved as there is new [`wasm32v1-none`](https://doc.rust-lang.org/beta/rustc/platform-support/wasm32v1-none.html) target that disables all "post-MVP" WASM features except `mutable-globals`. Wasm builder requires the following prerequisites for building the WASM binary: - Rust >= 1.68 and Rust < 1.84: - `wasm32-unknown-unknown` target - `rust-src` component - Rust >= 1.84: - `wasm32v1-none` target - no more `-Zbuild-std` and `RUSTC_BOOTSTRAP=1` hacks and `rust-src` component requirements! Jira: - SYS-4677 - SYS-4551
Additionally, drops wasm-unknown-unknown dependency in favour of `wasm32v1-none` to align with polkadot-sdk feature: feat(wasm-builder): add support for new `wasm32v1-none` target polkadot-sdk PR: [#7008](paritytech/polkadot-sdk#7008) Resolves [#5777](paritytech/polkadot-sdk#5777) Previously `wasm-builder` used hacks such as `-Zbuild-std` (required `rust-src` component) and `RUSTC_BOOTSTRAP=1` to build WASM runtime without WASM features: `sign-ext`, `multivalue` and `reference-types`, but since Rust 1.84 (will be stable on 9 January, 2025) the situation has improved as there is new [`wasm32v1-none`](https://doc.rust-lang.org/beta/rustc/platform-support/wasm32v1-none.html) target that disables all "post-MVP" WASM features except `mutable-globals`. Wasm builder requires the following prerequisites for building the WASM binary: - Rust >= 1.68 and Rust < 1.84: - `wasm32-unknown-unknown` target - `rust-src` component - Rust >= 1.84: - `wasm32v1-none` target - no more `-Zbuild-std` and `RUSTC_BOOTSTRAP=1` hacks and `rust-src` component requirements! Jira: - SYS-4677 - SYS-4551
Changes toolchain and CI to use Rust 1.87.0 Additionally, drops wasm-unknown-unknown dependency in favour of `wasm32v1-none` to align with polkadot-sdk feature: feat(wasm-builder): add support for new `wasm32v1-none` target polkadot-sdk PR: [#7008](paritytech/polkadot-sdk#7008) Resolves [#5777](paritytech/polkadot-sdk#5777) Previously `wasm-builder` used hacks such as `-Zbuild-std` (required `rust-src` component) and `RUSTC_BOOTSTRAP=1` to build WASM runtime without WASM features: `sign-ext`, `multivalue` and `reference-types`, but since Rust 1.84 (will be stable on 9 January, 2025) the situation has improved as there is new [`wasm32v1-none`](https://doc.rust-lang.org/beta/rustc/platform-support/wasm32v1-none.html) target that disables all "post-MVP" WASM features except `mutable-globals`. Wasm builder requires the following prerequisites for building the WASM binary: - Rust >= 1.68 and Rust < 1.84: - `wasm32-unknown-unknown` target - `rust-src` component - Rust >= 1.84: - `wasm32v1-none` target - no more `-Zbuild-std` and `RUSTC_BOOTSTRAP=1` hacks and `rust-src` component requirements! Jira: - SYS-4677 - SYS-4551
Changes toolchain and CI to use Rust 1.87.0 Additionally, drops wasm-unknown-unknown dependency in favour of `wasm32v1-none` to align with polkadot-sdk feature: feat(wasm-builder): add support for new `wasm32v1-none` target polkadot-sdk PR: [#7008](paritytech/polkadot-sdk#7008) Resolves [#5777](paritytech/polkadot-sdk#5777) Previously `wasm-builder` used hacks such as `-Zbuild-std` (required `rust-src` component) and `RUSTC_BOOTSTRAP=1` to build WASM runtime without WASM features: `sign-ext`, `multivalue` and `reference-types`, but since Rust 1.84 (will be stable on 9 January, 2025) the situation has improved as there is new [`wasm32v1-none`](https://doc.rust-lang.org/beta/rustc/platform-support/wasm32v1-none.html) target that disables all "post-MVP" WASM features except `mutable-globals`. Wasm builder requires the following prerequisites for building the WASM binary: - Rust >= 1.68 and Rust < 1.84: - `wasm32-unknown-unknown` target - `rust-src` component - Rust >= 1.84: - `wasm32v1-none` target - no more `-Zbuild-std` and `RUSTC_BOOTSTRAP=1` hacks and `rust-src` component requirements! Jira: - SYS-4677 - SYS-4551
Changes toolchain and CI to use Rust 1.87.0 Additionally, drops wasm-unknown-unknown dependency in favour of `wasm32v1-none` to align with polkadot-sdk feature: feat(wasm-builder): add support for new `wasm32v1-none` target polkadot-sdk PR: [#7008](paritytech/polkadot-sdk#7008) Resolves [#5777](paritytech/polkadot-sdk#5777) Previously `wasm-builder` used hacks such as `-Zbuild-std` (required `rust-src` component) and `RUSTC_BOOTSTRAP=1` to build WASM runtime without WASM features: `sign-ext`, `multivalue` and `reference-types`, but since Rust 1.84 (will be stable on 9 January, 2025) the situation has improved as there is new [`wasm32v1-none`](https://doc.rust-lang.org/beta/rustc/platform-support/wasm32v1-none.html) target that disables all "post-MVP" WASM features except `mutable-globals`. Wasm builder requires the following prerequisites for building the WASM binary: - Rust >= 1.68 and Rust < 1.84: - `wasm32-unknown-unknown` target - `rust-src` component - Rust >= 1.84: - `wasm32v1-none` target - no more `-Zbuild-std` and `RUSTC_BOOTSTRAP=1` hacks and `rust-src` component requirements! Jira: - SYS-4677 - SYS-4551
Description
Resolves #5777
Previously
wasm-builderused hacks such as-Zbuild-std(requiredrust-srccomponent) andRUSTC_BOOTSTRAP=1to build WASM runtime without WASM features:sign-ext,multivalueandreference-types, but since Rust 1.84 (will be stable on 9 January, 2025) the situation has improved as there is newwasm32v1-nonetarget that disables all "post-MVP" WASM features exceptmutable-globals.Previously, your
rust-toolchain.tomllooked like this:It should now be updated to something like this:
To build the runtime:
Integration
If you are using Rust 1.84 and above, then install the
wasm32v1-nonetarget instead ofwasm32-unknown-unknownas shown above. You can also remove the unnecessaryrust-srccomponent.Also note the slight differences in conditional compilation:
wasm32-unknown-unknown:#[cfg(all(target_family = "wasm", target_os = "unknown"))]wasm32v1-none:#[cfg(all(target_family = "wasm", target_os = "none"))]Avoid using
target_os = "unknown"in#[cfg(...)]or#[cfg_attr(...)]and instead usetarget_family = "wasm"ortarget_arch = "wasm32"in the runtime code.Review Notes
Wasm builder requires the following prerequisites for building the WASM binary:
wasm32-unknown-unknowntargetrust-srccomponentwasm32v1-nonetarget-Zbuild-stdandRUSTC_BOOTSTRAP=1hacks andrust-srccomponent requirements!