ipfs-rust/netsim-embed

cargo check error on mac

Closed this issue · 2 comments

  • run cargo check on mac

  • Darwin MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64

error[E0425]: cannot find value `IFF_NO_PI` in crate `libc`
    --> machine/src/iface.rs:163:67
     |
163  |             req.ifr_ifru.ifru_flags = libc::IFF_UP as i16 | libc::IFF_NO_PI as i16;
     |                                                                   ^^^^^^^^^ help: a constant with a similar name exists: `IFF_NOARP`
     |
    ::: /Users/huangzheng/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.112/src/unix/bsd/apple/mod.rs:3569:1
     |
3569 | pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
     | ---------------------------- similarly named constant `IFF_NOARP` defined here

error[E0412]: cannot find type `rtentry` in crate `libc`
   --> machine/src/iface.rs:288:36
    |
288 |             let mut rtentry: libc::rtentry = mem::zeroed();
    |                                    ^^^^^^^ not found in `libc`

error[E0425]: cannot find value `SIOCADDRT` in crate `libc`
   --> machine/src/iface.rs:317:60
    |
317 |             if let Err(err) = errno!(libc::ioctl(fd, libc::SIOCADDRT, &rtentry)) {
    |                                                            ^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `unshare` in crate `libc`
 --> machine/src/namespace.rs:9:27
  |
9 |     unsafe { errno!(libc::unshare(libc::CLONE_NEWUSER))? };
  |                           ^^^^^^^ not found in `libc`

error[E0425]: cannot find value `CLONE_NEWUSER` in crate `libc`
 --> machine/src/namespace.rs:9:41
  |
9 |     unsafe { errno!(libc::unshare(libc::CLONE_NEWUSER))? };
  |                                         ^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `SYS_gettid` in crate `libc`
  --> machine/src/namespace.rs:35:50
   |
35 |             let tid = errno!(libc::syscall(libc::SYS_gettid))?;
   |                                                  ^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `unshare` in crate `libc`
  --> machine/src/namespace.rs:42:26
   |
42 |             errno!(libc::unshare(libc::CLONE_NEWNET | libc::CLONE_NEWUTS))?;
   |                          ^^^^^^^ not found in `libc`

error[E0425]: cannot find value `CLONE_NEWNET` in crate `libc`
  --> machine/src/namespace.rs:42:40
   |
42 |             errno!(libc::unshare(libc::CLONE_NEWNET | libc::CLONE_NEWUTS))?;
   |                                        ^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `CLONE_NEWUTS` in crate `libc`
  --> machine/src/namespace.rs:42:61
   |
42 |             errno!(libc::unshare(libc::CLONE_NEWNET | libc::CLONE_NEWUTS))?;
   |                                                             ^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `setns` in crate `libc`
  --> machine/src/namespace.rs:50:26
   |
50 |             errno!(libc::setns(fd.as_raw_fd(), libc::CLONE_NEWNET))?;
   |                          ^^^^^ not found in `libc`

error[E0425]: cannot find value `CLONE_NEWNET` in crate `libc`
  --> machine/src/namespace.rs:50:54
   |
50 |             errno!(libc::setns(fd.as_raw_fd(), libc::CLONE_NEWNET))?;
   |                                                      ^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `ETH_FRAME_LEN` in crate `libc`
   --> machine/src/lib.rs:294:45
    |
294 |                     let mut buf = [0; libc::ETH_FRAME_LEN as usize];
    |                                             ^^^^^^^^^^^^^ not found in `libc`

error[E0308]: mismatched types
  --> machine/src/namespace.rs:36:28
   |
36 |             Ok(Self { pid, tid })
   |                            ^^^ expected `i64`, found `i32`

close due to it Looks like that netsim no use in macos.
error source : cargo doc -Zunstable-options -Zrustdoc-scrape-examples=all --open --document-private-items
maybe I need use something like --target

But maybe #[cfg(xx)] should be added anyway