unable to build with wasm32-wasi target
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.5k
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Description
I'm seeing if I can use surf with wasi. Unfortunately, the dependencies appear not to be correct, even with
[dependencies]
async-executor = "*"
futures-lite = "*"
surf = { version = "*", default-features = false, features = ["wasm-client"] }
I get a dependency on socket2
cargo tree --invert socket2 --target wasm32-wasi
socket2 v0.4.0
└── async-io v1.4.0
├── async-global-executor v2.0.2
│ └── async-std v1.9.0
│ ├── http-types v2.11.0
│ │ ├── http-client v6.3.5
│ │ │ └── surf v2.2.0
│ │ │ └── try_wasi_async v0.1.0 (C:\Users\cataggar\rs\try_wasi_async)
│ │ └── surf v2.2.0 (*)
│ └── surf v2.2.0 (*)
└── async-std v1.9.0 (*)
Test app is:
use async_executor::{Executor, Task};
use futures_lite::future;
use surf::Result;
fn main() -> Result<()> {
let ex = Executor::new();
let task: Task<Result<()>> = ex.spawn(async {
let ip = surf::get("http://ip.jsontest.com/").await?.body_string().await?;
println!("ip {}", &ip);
Ok(())
});
future::block_on(ex.run(task))
}
Which I've pushed here: https://github.com/ctaggart/try_wasi_async
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided wasm32-wasi test app and run cargo tree --invert socket2 --target wasm32-wasi to trace the async-std, async-io, and socket2 dependency path. Inspect Surf's default-features = false and wasm-client configuration; done means the test app can build for wasm32-wasi without an incompatible socket2 dependency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100