meh / rust-tun

TUN device creation and handling.
340 stars 133 forks source link

Build error on windows #60

Closed rubenh2905 closed 10 months ago

rubenh2905 commented 1 year ago

i'm on windows 10 and i'm using following toolchain

> rustup show
Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\ASUS\.rustup

installed toolchains
--------------------

stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc (default)

installed targets for active toolchain
--------------------------------------

x86_64-pc-windows-msvc
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl

active toolchain
----------------

stable-x86_64-pc-windows-msvc (default)
rustc 1.69.0 (84c898d65 2023-04-16)

the error is

> cargo check
    Checking tun v0.5.5
error[E0433]: failed to resolve: could not find `unix` in `os`
  --> C:\Users\ASUS\.cargo\registry\src\github.com-1ecc6299db9ec823\tun-0.5.5\src\configuration.rs:16:14
   |
16 | use std::os::unix::io::RawFd;
   |              ^^^^ could not find `unix` in `os`

error[E0432]: unresolved import `crate::platform::create`
  --> C:\Users\ASUS\.cargo\registry\src\github.com-1ecc6299db9ec823\tun-0.5.5\src\lib.rs:28:9
   |
28 | pub use crate::platform::create;
   |         ^^^^^^^^^^^^^^^^^^^^^^^ no `create` in `platform`

error[E0412]: cannot find type `Configuration` in module `platform`
  --> C:\Users\ASUS\.cargo\registry\src\github.com-1ecc6299db9ec823\tun-0.5.5\src\configuration.rs:38:36
   |
38 |     pub(crate) platform: platform::Configuration,
   |                                    ^^^^^^^^^^^^^ not found in `platform`
   |
help: consider importing this struct
   |
15 | use crate::Configuration;
   |
help: if you import `Configuration`, refer to it directly
   |
38 -     pub(crate) platform: platform::Configuration,
38 +     pub(crate) platform: Configuration,
   |

error[E0412]: cannot find type `Configuration` in module `platform`
  --> C:\Users\ASUS\.cargo\registry\src\github.com-1ecc6299db9ec823\tun-0.5.5\src\configuration.rs:55:34
   |
55 |         F: FnOnce(&mut platform::Configuration),
   |                                  ^^^^^^^^^^^^^ not found in `platform`
   |
help: consider importing this struct
   |
15 | use crate::Configuration;
   |
help: if you import `Configuration`, refer to it directly
   |
55 -         F: FnOnce(&mut platform::Configuration),
55 +         F: FnOnce(&mut Configuration),
   |

error[E0618]: expected function, found `F`
  --> C:\Users\ASUS\.cargo\registry\src\github.com-1ecc6299db9ec823\tun-0.5.5\src\configuration.rs:57:9
   |
53 |     pub fn platform<F>(&mut self, f: F) -> &mut Self
   |                                   - `f` has type `F`
...
57 |         f(&mut self.platform);
   |         ^--------------------
   |         |
   |         call expression requires function

Some errors have detailed explanations: E0412, E0432, E0433, E0618.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `tun` due to 5 previous errors

and the Cargo.toml file

[package]
name = "rust-test-3"
version = "0.1.0"
edition = "2021"

[dependencies]
tun = "0.5.5"
M0dEx commented 1 year ago

That's because Windows is not supported by this library at the moment.

See #27 for details.