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

unable to build with wasm32-wasi target #301

Open
ctaggart opened this issue Apr 18, 2021 · 0 comments
Open

unable to build with wasm32-wasi target #301

ctaggart opened this issue Apr 18, 2021 · 0 comments

Comments

@ctaggart
Copy link

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

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

No branches or pull requests

1 participant