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 target wasm #200

Closed
Milerius opened this issue Jan 17, 2021 · 1 comment
Closed

Unable to target wasm #200

Milerius opened this issue Jan 17, 2021 · 1 comment

Comments

@Milerius
Copy link

with the command: cargo +nightly build --target=wasm32-unknown-unknown --verbose

i got:

    Updating crates.io index
  Downloaded libc v0.2.82
  Downloaded 1 crate (516.0 KB) in 0.44s
   Compiling socket2 v0.4.0-alpha.2 (/Users/romanszterg/Documents/socket2)
     Running `rustc --crate-name socket2 --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=0dfc95db795d5f06 -C extra-filename=-0dfc95db795d5f06 --out-dir /Users/romanszterg/Documents/socket2/target/wasm32-unknown-unknown/debug/deps --target wasm32-unknown-unknown -C incremental=/Users/romanszterg/Documents/socket2/target/wasm32-unknown-unknown/debug/incremental -L dependency=/Users/romanszterg/Documents/socket2/target/wasm32-unknown-unknown/debug/deps -L dependency=/Users/romanszterg/Documents/socket2/target/debug/deps`
error[E0432]: unresolved import `crate::sys`
 --> src/sockaddr.rs:5:12
  |
5 | use crate::sys::{
  |            ^^^
  |            |
  |            unresolved import
  |            help: a similar path exists: `crate::socket::io::sys`

error[E0432]: unresolved imports `crate::sys`, `crate::sys`
  --> src/socket.rs:21:12
   |
21 | use crate::sys::{self, c_int, getsockopt, setsockopt, Bool};
   |            ^^^   ^^^^ no `sys` in the root
   |            |
   |            unresolved import
   |            help: a similar path exists: `crate::socket::io::sys`

error[E0432]: unresolved import `sys`
   --> src/lib.rs:129:5
    |
129 | use sys::c_int;
    |     ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: unresolved import
   --> src/sockaddr.rs:114:29
    |
114 |             let ip = crate::sys::from_in_addr(addr.sin_addr);
    |                             ^^^
    |                             |
    |                             unresolved import
    |                             help: a similar path exists: `crate::socket::io::sys`

error[E0433]: failed to resolve: unresolved import
   --> src/sockaddr.rs:121:29
    |
121 |             let ip = crate::sys::from_in6_addr(addr.sin6_addr);
    |                             ^^^
    |                             |
    |                             unresolved import
    |                             help: a similar path exists: `crate::socket::io::sys`

error[E0433]: failed to resolve: unresolved import
   --> src/sockaddr.rs:172:30
    |
172 |             sin_addr: crate::sys::to_in_addr(&addr.ip()),
    |                              ^^^
    |                              |
    |                              unresolved import
    |                              help: a similar path exists: `crate::socket::io::sys`

error[E0433]: failed to resolve: unresolved import
   --> src/sockaddr.rs:207:31
    |
207 |             sin6_addr: crate::sys::to_in6_addr(addr.ip()),
    |                               ^^^
    |                               |
    |                               unresolved import
    |                               help: a similar path exists: `crate::socket::io::sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:149:37
    |
149 |     pub const IPV4: Domain = Domain(sys::AF_INET);
    |                                     ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:152:37
    |
152 |     pub const IPV6: Domain = Domain(sys::AF_INET6);
    |                                     ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:191:35
    |
191 |     pub const STREAM: Type = Type(sys::SOCK_STREAM);
    |                                   ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:196:34
    |
196 |     pub const DGRAM: Type = Type(sys::SOCK_DGRAM);
    |                                  ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:231:43
    |
231 |     pub const ICMPV4: Protocol = Protocol(sys::IPPROTO_ICMP);
    |                                           ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:234:43
    |
234 |     pub const ICMPV6: Protocol = Protocol(sys::IPPROTO_ICMPV6);
    |                                           ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:237:40
    |
237 |     pub const TCP: Protocol = Protocol(sys::IPPROTO_TCP);
    |                                        ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:240:40
    |
240 |     pub const UDP: Protocol = Protocol(sys::IPPROTO_UDP);
    |                                        ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:272:18
    |
272 |         self.0 & sys::MSG_TRUNC != 0
    |                  ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:280:33
    |
280 | pub struct MaybeUninitSlice<'a>(sys::MaybeUninitSlice<'a>);
    |                                 ^^^ use of undeclared crate or module `sys`

error[E0433]: failed to resolve: use of undeclared crate or module `sys`
   --> src/lib.rs:299:31
    |
299 |         MaybeUninitSlice(sys::MaybeUninitSlice::new(buf))
    |                               ^^^^^^^^^^^^^^^^ not found in `sys`
    |
help: consider importing this struct
    |
62  | use crate::socket::MaybeUninitSlice;
    |

warning: unused macro definition
  --> src/lib.rs:73:1
   |
73 | / macro_rules! impl_debug {
74 | |     (
75 | |         // Type name for which to implement `fmt::Debug`.
76 | |         $type: path,
...  |
97 | |     };
98 | | }
   | |_^
   |
   = note: `#[warn(unused_macros)]` on by default

error[E0308]: mismatched types
    --> src/socket.rs:1446:23
     |
1446 | from!(net::TcpStream, Socket);
     |                       ^^^^^^ expected struct `Socket`, found `()`
     |
    ::: src/lib.rs:104:16
     |
104  |             fn from(socket: $from) -> $for {
     |                ---- implicitly returns `()` as its body has no tail or `return` expression

error[E0308]: mismatched types
    --> src/socket.rs:1447:25
     |
1447 | from!(net::TcpListener, Socket);
     |                         ^^^^^^ expected struct `Socket`, found `()`
     |
    ::: src/lib.rs:104:16
     |
104  |             fn from(socket: $from) -> $for {
     |                ---- implicitly returns `()` as its body has no tail or `return` expression

error[E0308]: mismatched types
    --> src/socket.rs:1448:23
     |
1448 | from!(net::UdpSocket, Socket);
     |                       ^^^^^^ expected struct `Socket`, found `()`
     |
    ::: src/lib.rs:104:16
     |
104  |             fn from(socket: $from) -> $for {
     |                ---- implicitly returns `()` as its body has no tail or `return` expression

error[E0308]: mismatched types
    --> src/socket.rs:1449:15
     |
1449 | from!(Socket, net::TcpStream);
     |               ^^^^^^^^^^^^^^ expected struct `TcpStream`, found `()`
     |
    ::: src/lib.rs:104:16
     |
104  |             fn from(socket: $from) -> $for {
     |                ---- implicitly returns `()` as its body has no tail or `return` expression

error[E0308]: mismatched types
    --> src/socket.rs:1450:15
     |
1450 | from!(Socket, net::TcpListener);
     |               ^^^^^^^^^^^^^^^^ expected struct `TcpListener`, found `()`
     |
    ::: src/lib.rs:104:16
     |
104  |             fn from(socket: $from) -> $for {
     |                ---- implicitly returns `()` as its body has no tail or `return` expression

error[E0308]: mismatched types
    --> src/socket.rs:1451:15
     |
1451 | from!(Socket, net::UdpSocket);
     |               ^^^^^^^^^^^^^^ expected struct `UdpSocket`, found `()`
     |
    ::: src/lib.rs:104:16
     |
104  |             fn from(socket: $from) -> $for {
     |                ---- implicitly returns `()` as its body has no tail or `return` expression

error[E0061]: this function takes 4 arguments but 3 arguments were supplied
   --> src/sockaddr.rs:123:33
    |
123 |             Some(SocketAddr::V6(SocketAddrV6::new(
    |                                 ^^^^^^^^^^^^^^^^^ expected 4 arguments
124 |                 ip,
    |                 --
125 |                 port,
    |                 ----
126 |                 addr.sin6_flowinfo,
    |                 ------------------ supplied 3 arguments

error: aborting due to 25 previous errors; 1 warning emitted

Some errors have detailed explanations: E0061, E0308, E0432, E0433.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `socket2`

Caused by:
  process didn't exit successfully: `rustc --crate-name socket2 --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=0dfc95db795d5f06 -C extra-filename=-0dfc95db795d5f06 --out-dir /Users/romanszterg/Documents/socket2/target/wasm32-unknown-unknown/debug/deps --target wasm32-unknown-unknown -C incremental=/Users/romanszterg/Documents/socket2/target/wasm32-unknown-unknown/debug/incremental -L dependency=/Users/romanszterg/Documents/socket2/target/wasm32-unknown-unknown/debug/deps -L dependency=/Users/romanszterg/Documents/socket2/target/debug/deps` (exit code: 1)

Did i miss something ?

@Thomasdezeeuw
Copy link
Collaborator

Wasm is not supported as it doesn't implement sockets.

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

2 participants