andrew-d / interfaces-rs

Library to work with network interfaces in Rust.
https://andrew-d.github.io/interfaces-rs/interfaces/index.html
52 stars 19 forks source link

File not found `sys/ioctl.h` on Windows #30

Open Michael-F-Bryan opened 1 year ago

Michael-F-Bryan commented 1 year ago

In wasmerio/wasmer's CI, we've seen some build failures on Windows (link) where the build script is trying to access a header file that doesn't exist.

We're using interfaces v0.0.9 with default features.

error: failed to run custom build command for `interfaces v0.0.9`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `D:\a\wasmer\wasmer\target\release\build\interfaces-10cfbade80767794\build-script-build` (exit code: 1)
  --- stdout
  TARGET = Some("x86_64-pc-windows-msvc")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-pc-windows-msvc")
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-msvc
  CC_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_msvc
  CC_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  DEBUG = Some("false")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-W4" "-FoD:\\a\\wasmer\\wasmer\\target\\release\\build\\interfaces-32e0d97e2c065431\\out\\a9a87[299](https://github.com/wasmerio/wasmer/actions/runs/5935918550/job/16095269578#step:20:300)11c1686c-constants.o" "-c" "D:\\a\\wasmer\\wasmer\\target\\release\\build\\interfaces-32e0d97e2c065431\\out\\constants.c"
  constants.c
  D:\a\wasmer\wasmer\target\release\build\interfaces-32e0d97e2c065431\out\constants.c(4): fatal error C1083: Cannot open include file: 'sys/ioctl.h': No such file or directory
  exit code: 2

  --- stderr

  error occurred: Command "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.[301](https://github.com/wasmerio/wasmer/actions/runs/5935918550/job/16095269578#step:20:302)33\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-W4" "-FoD:\\a\\wasmer\\wasmer\\target\\release\\build\\interfaces-32e0d97e2c065431\\out\\a9a8729911c1686c-constants.o" "-c" "D:\\a\\wasmer\\wasmer\\target\\release\\build\\interfaces-32e0d97e2c065431\\out\\constants.c" with args "cl.exe" did not execute successfully (status code exit code: 2).
Tnze commented 1 year ago

Same problem.

Llorx commented 11 months ago

Same problem. Bump.

JoshLambda commented 11 months ago

Same problem

dalance commented 11 months ago

Currently Windows is not supported. I added README about it.

Llorx commented 11 months ago

Soooo only unix-alike systems. Weird "cross-platform manner" you have there xD

dalance commented 11 months ago

I'm not the original author, but I guess that the author intended that "cross-platform" means Linux, *BSD, macOS, Android, and so on. So I don't think that the expression is inappropriate.

Of course, if anyone contribute to add Windows support, I'll merge it.

Tnze commented 11 months ago

Agree

JoshLambda commented 11 months ago

As a workaround, it's possible to replace this crate with the crate get_if_addrs which supports Windows, Linux, and macOS.