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

Can this library run in WASM? #23

Closed
amaury1093 opened this issue Jun 10, 2020 · 2 comments · Fixed by #69
Closed

Can this library run in WASM? #23

amaury1093 opened this issue Jun 10, 2020 · 2 comments · Fixed by #69

Comments

@amaury1093
Copy link
Contributor

I'm looking to deploy my code to Cloudfare workers, and it uses this library. I was wondering, do you plan to support WASM as build target?

I just tried now, and had a small error, due to the hostname dependency (maybe others?).

error: Unsupported target OS! Create an issue: https://github.com/svartalf/hostname/issues/new
  --> /Users/amaurymartiny/.cargo/registry/src/github.com-1ecc6299db9ec823/hostname-0.3.1/src/lib.rs:81:9
   |
81 |         compile_error!("Unsupported target OS! Create an issue: https://github.com/svartalf/hostname/issues/new");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0433]: failed to resolve: use of undeclared type or module `sys`
   --> /Users/amaurymartiny/.cargo/registry/src/github.com-1ecc6299db9ec823/hostname-0.3.1/src/lib.rs:105:5
    |
105 |     sys::get()
    |     ^^^ use of undeclared type or module `sys`

error: aborting due to 2 previous errors

We could return localhost in wasm.

@link2xt
Copy link
Collaborator

link2xt commented Dec 3, 2024

I opened a PR #66 to remove hostname dependency. There is still a problem with some tokio features in dev-dependencies, but otherwise it should compile to wasm32-wasip2.

@link2xt link2xt mentioned this issue Dec 3, 2024
Merged
@link2xt
Copy link
Collaborator

link2xt commented Dec 3, 2024

CI now checks wasm32-wasip2 target.

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

Successfully merging a pull request may close this issue.

2 participants