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

target wasm & wasi too #37

Closed
ctaggart opened this issue Oct 14, 2020 · 7 comments
Closed

target wasm & wasi too #37

ctaggart opened this issue Oct 14, 2020 · 7 comments
Labels
Azure.Core The azure_core crate wasi WebAssemblySystemInterface support

Comments

@ctaggart
Copy link
Contributor

I think it is an important use case to be able to target wasm & wasi with these crates. We will need to add these targets to CI:

rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasi

I'm hoping we can get the right features in place to support this. An important part of this is being able to use a different http client like reqwest instead of hyper. The http client abstraction is #36.

@ctaggart
Copy link
Contributor Author

tokio does not yet work with WebAssembly tokio-rs/tokio#1597. reqwest is tokio based. surf has a wasm-client feature, but I was not able to get this to compile for wasi because of dependencies http-rs/surf#301:

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))
}

@radu-matei
Copy link

Hi!
I've been working towards compiling this (or rather parts of this) library to wasm32-wasi so the SDK can be used from WASI modules. It is built on top of the experimental HTTP library for WASI (and Wasmtime).

Here is the very early fork , currently with support only for the blob storage SDK, with a samples repo here.

I'll update this issue as I work on it, but as everything is experimental, I don't expect to propose a PR here anytime soon. This is in case interested people want to follow the work.

Thanks!

@radu-matei
Copy link

And here is how we are using the SDK from within WASI modules - https://github.com/deislabs/wagi-azure-samples

@ctaggart
Copy link
Contributor Author

ctaggart commented May 4, 2021

@radu-matei, this looks amazing! I look forward to trying it out once I have time.

@ctaggart
Copy link
Contributor Author

@radu-matei, thanks for the blog post!
Using Azure services from WebAssembly modules
https://deislabs.io/posts/using-azure-services-wasi/

@thangchung
Copy link

That's cool. Just have a look at the repo at https://github.com/deislabs/wagi-azure-samples. But there are a lot of works to make it runs well with other Rust libs out there, almost based on tokio-rs which couldn't run on WASM right now

@cataggar cataggar added Azure.Core The azure_core crate wasi WebAssemblySystemInterface support labels Oct 26, 2021
@cataggar
Copy link
Member

cataggar commented Jul 20, 2022

#939 adds a wasm target, which was the goal of this issue. There is more work to be done to support it, but it is progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core The azure_core crate wasi WebAssemblySystemInterface support
Projects
None yet
Development

No branches or pull requests

4 participants