Skip to content

Can't compile package to wasm #89

@AchalaSB

Description

@AchalaSB

Hi,
Getting error while compiling package to webassembly using wasm32-unknown-uknown

cargo build --target wasm32-unknown-unknown
   Compiling net2 v0.2.33
   Compiling byteorder v1.3.2
   Compiling arrayvec v0.4.11
   Compiling rand v0.5.6
   Compiling log v0.4.8
   Compiling openssl-sys v0.9.48
   Compiling tokio-executor v0.1.8
   Compiling crunchy v0.2.2
error[E0432]: unresolved import `sys`
  --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/tcp.rs:18:5
   |
18 | use sys::c;
   |     ^^^ maybe a missing `extern crate sys;`?

error[E0432]: unresolved import `sys`
  --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/udp.rs:18:5
   |
18 | use sys::c;
   |     ^^^ maybe a missing `extern crate sys;`?

   Compiling bitflags v1.1.0
error[E0432]: unresolved import `sys`
  --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/socket.rs:22:5
   |
22 | use sys;
   |     ^^^ no `sys` in the root

error[E0432]: unresolved import `sys`
  --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/socket.rs:23:5
   |
23 | use sys::c;
   |     ^^^ maybe a missing `extern crate sys;`?

error[E0432]: unresolved import `sys`
  --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:19:5
   |
19 | use sys;
   |     ^^^ no `sys` in the root

error[E0432]: unresolved import `sys`
  --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:20:5
   |
20 | use sys::c;
   |     ^^^ maybe a missing `extern crate sys;`?

error: failed to run custom build command for `openssl-sys v0.9.48`
 --------
error[E0599]: no method named `as_sock` found for type `&tcp::TcpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1428:22
     |
1428 |         set_opt(self.as_sock(), SOL_SOCKET, SO_REUSEADDR,
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error[E0599]: no method named `as_sock` found for type `&tcp::TcpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1434:22
     |
1434 |         get_opt(self.as_sock(), SOL_SOCKET, SO_REUSEADDR).map(int2bool)
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error[E0599]: no method named `as_sock` found for type `&tcp::TcpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1443:22
     |
1443 |         get_opt(self.as_sock(), SOL_SOCKET, SO_ERROR).map(int2err)
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error[E0599]: no method named `as_sock` found for type `&tcp::TcpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1448:22
     |
1448 |         set_opt(self.as_sock(), SOL_SOCKET, SO_LINGER, dur2linger(dur))
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error[E0599]: no method named `as_sock` found for type `&tcp::TcpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1453:22
     |
1453 |         get_opt(self.as_sock(), SOL_SOCKET, SO_LINGER).map(linger2dur)
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error[E0599]: no method named `as_sock` found for type `&udp::UdpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1464:22
     |
1464 |         set_opt(self.as_sock(), IPPROTO_IP, IP_TTL, ttl as c_int)
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error[E0599]: no method named `as_sock` found for type `&udp::UdpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1474:22
     |
1474 |         set_opt(self.as_sock(), v(IPPROTO_IPV6), IPV6_V6ONLY, only_v6 as c_int)
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error[E0599]: no method named `as_sock` found for type `&udp::UdpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1484:22
     |
1484 |         set_opt(self.as_sock(), SOL_SOCKET, SO_REUSEADDR,
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error[E0599]: no method named `as_sock` found for type `&udp::UdpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1490:22
     |
1490 |         get_opt(self.as_sock(), SOL_SOCKET, SO_REUSEADDR).map(int2bool)
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error[E0599]: no method named `as_sock` found for type `&udp::UdpBuilder` in the current scope
    --> /home/achala/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.33/src/ext.rs:1499:22
     |
1499 |         get_opt(self.as_sock(), SOL_SOCKET, SO_ERROR).map(int2err)
     |                      ^^^^^^^
     |
     = help: items from traits can only be used if the trait is implemented and in scope
     = note: the following trait defines an item `as_sock`, perhaps you need to implement it:
             candidate #1: `ext::AsSock`

error: aborting due to 317 previous errors

Some errors have detailed explanations: E0046, E0412, E0422, E0425, E0432, E0599.
For more information about an error, try `rustc --explain E0046`.
error: Could not compile `net2`.
warning: build failed, waiting for other jobs to finish...
error: build failed

How can I solve this error? @alexcrichton can you help me on this
TIA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions