EstebanBorai / network-interface

Retrieve system's Network Interfaces on Linux, macOS and Windows on a standardized manner
https://crates.io/crates/network-interface
Apache License 2.0
61 stars 28 forks source link

failed to resolve: use of undeclared crate or module `libc` #41

Closed jabbate19 closed 11 months ago

jabbate19 commented 1 year ago

Running into issue on FreeBSD 12.3. If anyone knows of any solutions, please let me know!

error[E0433]: failed to resolve: use of undeclared crate or module `libc`
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/network-interface-1.0.1/src/target/getifaddrs.rs:25:18
   |
25 |         unsafe { libc::freeifaddrs(self.base) }
   |                  ^^^^ use of undeclared crate or module `libc`

error[E0433]: failed to resolve: use of undeclared crate or module `libc`
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/network-interface-1.0.1/src/target/getifaddrs.rs:31:20
   |
31 |     match unsafe { libc::getifaddrs(addr.as_mut_ptr()) } {
   |                    ^^^^ use of undeclared crate or module `libc`

error[E0433]: failed to resolve: use of undeclared crate or module `libc`
 --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/network-interface-1.0.1/src/target/getifaddrs.rs:5:16
  |
5 |     base: *mut libc::ifaddrs,
  |                ^^^^ use of undeclared crate or module `libc`

error[E0433]: failed to resolve: use of undeclared crate or module `libc`
 --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/network-interface-1.0.1/src/target/getifaddrs.rs:6:16
  |
6 |     next: *mut libc::ifaddrs,
  |                ^^^^ use of undeclared crate or module `libc`

error[E0433]: failed to resolve: use of undeclared crate or module `libc`
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/network-interface-1.0.1/src/target/getifaddrs.rs:10:17
   |
10 |     type Item = libc::ifaddrs;
   |                 ^^^^ use of undeclared crate or module `libc`

error[E0433]: failed to resolve: use of undeclared crate or module `libc`
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/network-interface-1.0.1/src/target/getifaddrs.rs:30:44
   |
30 |     let mut addr = mem::MaybeUninit::<*mut libc::ifaddrs>::uninit();
   |                                            ^^^^ use of undeclared crate or module `libc`

For more information about this error, try `rustc --explain E0433`.
error: could not compile `network-interface` (lib) due to 6 previous errors
EstebanBorai commented 1 year ago

Hi @jabbate19! Thanks for openning this issue!

This looks like a not supported target case in my opinion.

Can you send some details of your environment for debugging? Chip Arquitecture, OS, and other relevant details please?

EstebanBorai commented 11 months ago

I will close for now. Feel free to reopen if your issue persist!