Commit 26a3616
Fix rust and wasm target check for sdk (#1771)
### What
Replace `#[cfg(target_family = "wasm")]` with `CARGO_CFG_TARGET_FAMILY`
and `CARGO_CFG_TARGET_OS` environment variable checks in `build.rs`.
Update the error message to recommend `wasm32v1-none` as an alternative
target available since Rust 1.84.
### Why
`#[cfg(...)]` in `build.rs` evaluates against the build script's host
target, not the compilation target. During cross-compilation from a
non-wasm host, the condition is always false, so the Rust 1.82+ check
never fires and contracts compile silently producing Wasm binaries with
unsupported `reference-types` and `multi-value` features. This has
created some confusiong in the community recently when folks were trying
to build for wasm32-unknown-unknown.
We should also now promote wasm32v1-none. That's the target most folks
should be using.
Close #1770
Co-authored-by: mootz12 <38118608+mootz12@users.noreply.github.com>1 parent 7847eae commit 26a3616
1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
0 commit comments