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

Crate does not compile to WASM targets like wasm32-wasi #73

Open
CPerezz opened this issue Aug 22, 2024 · 0 comments
Open

Crate does not compile to WASM targets like wasm32-wasi #73

CPerezz opened this issue Aug 22, 2024 · 0 comments

Comments

@CPerezz
Copy link

CPerezz commented Aug 22, 2024

I'm not sure if it's only me. But none of master nor release-0.5 branches does actually compile to wasm (meaning a wasm-target ofc).

In particular, the specific issue happens when compiling wasm-wasix dependency. I thought it had to do with the fact that is actually using the default features.

All this only would work with target wasm32-wasi. The rest are directly not supported due to some of the dependencies not supporting any other wasm-target.

I got an error when compiling using: cargo build --no-default-features --features wasm --target wasm32-wasi

......
error[E0599]: the method `ok` exists for enum `Result<SockAddr, Error>`, but its trait bounds were not satisfied
   --> /path/to/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socket2-0.4.10/src/sockref.rs:144:58
    |
144 |             .field("peer_addr", &self.socket.peer_addr().ok())
    |                                                          ^^ method cannot be called on `Result<SockAddr, Error>` due to unsatisfied trait bounds
    |
   ::: /path/to/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socket2-0.4.10/src/sockaddr.rs:17:1
    |
17  | pub struct SockAddr {
    | ------------------- doesn't satisfy `SockAddr: Sized`
    |
    = note: the following trait bounds were not satisfied:
            `{type error}: Sized`
            which is required by `SockAddr: Sized`

Some errors have detailed explanations: E0061, E0308, E0412, E0422, E0425, E0432, E0433, E0583, E0599.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `socket2` (lib) due to 208 previous errors

This is a big deal specially for projects that depend on this crate to generate their witness inside WASM in the browser.

CPerezz added a commit to CPerezz/circom-compat that referenced this issue Aug 22, 2024
After forcing `wasmer-wasix` to use the `js` feature when the
`circom-compat/js` feature is enabled. As well as forcing `wasmer/js`
and otherwise, `wasmer/default`. The crate can now successfully compile
to wasm.

Resolves: arkworks-rs#73
CPerezz added a commit to CPerezz/circom-compat that referenced this issue Aug 22, 2024
After forcing `wasmer-wasix` to use the `js` feature when the
`circom-compat/js` feature is enabled. As well as forcing `wasmer/js`
and otherwise, `wasmer/default`. The crate can now successfully compile
to wasm.

Resolves: arkworks-rs#73
mmagician pushed a commit that referenced this issue Aug 23, 2024
After forcing `wasmer-wasix` to use the `js` feature when the
`circom-compat/js` feature is enabled. As well as forcing `wasmer/js`
and otherwise, `wasmer/default`. The crate can now successfully compile
to wasm.

Resolves: #73
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