heim-rs / heim

Cross-platform async library for system information fetching 🦀
https://heim-rs.github.io/
Apache License 2.0
902 stars 95 forks source link

Building fails on FreeBSD #362

Closed kellytk closed 2 years ago

kellytk commented 2 years ago

I'm attempting to get Vector running on FreeBSD and heim is the current blocker.

Environment

FreeBSD 13.1 Rust 1.62.1 installed via rustup git clone --recursive https://github.com/heim-rs/heim.git

Building

From heim's directory, RUST_BACKTRACE=1 cargo build outputs:

   Compiling heim-cpu v0.1.0-rc.1 (/usr/home/testing/tmp/repos/heim/heim-cpu)
   Compiling heim-sensors v0.1.0-rc.1 (/usr/home/testing/tmp/repos/heim/heim-sensors)
   Compiling heim-memory v0.1.0-rc.1 (/usr/home/testing/tmp/repos/heim/heim-memory)
   Compiling heim-net v0.1.0-rc.1 (/usr/home/testing/tmp/repos/heim/heim-net)
   Compiling heim-virt v0.1.0-rc.1 (/usr/home/testing/tmp/repos/heim/heim-virt)
   Compiling heim-host v0.1.0-rc.1 (/usr/home/testing/tmp/repos/heim/heim-host)
   Compiling heim-disk v0.1.0-rc.1 (/usr/home/testing/tmp/repos/heim/heim-disk)
error: Unsupported target OS
  --> heim-sensors/src/sys/mod.rs:15:9
   |
15 |         compile_error!("Unsupported target OS");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Unsupported target OS
  --> heim-cpu/src/sys/mod.rs:20:9
   |
20 |         compile_error!("Unsupported target OS");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Unsupported target OS
  --> heim-virt/src/sys/mod.rs:15:9
   |
15 |         compile_error!("Unsupported target OS");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0433]: failed to resolve: use of undeclared crate or module `libc`
 --> heim-cpu/src/sys/unix.rs:5:20
  |
5 |     let mut data: [libc::c_double; 3] = [0.0, 0.0, 0.0];
  |                    ^^^^ use of undeclared crate or module `libc`

error: Unsupported OS!
  --> heim-memory/src/sys/mod.rs:18:9
   |
18 |         compile_error!("Unsupported OS!");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0425]: cannot find function `temperatures` in module `sys`
  --> heim-sensors/src/temperatures.rs:66:10
   |
66 |     sys::temperatures()
   |          ^^^^^^^^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::temperatures;
   |
help: if you import `temperatures`, refer to it directly
   |
66 -     sys::temperatures()
66 +     temperatures()
   |

error: Unsupported OS
  --> heim-host/src/sys/mod.rs:25:9
   |
25 |         compile_error!("Unsupported OS");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0433]: failed to resolve: use of undeclared crate or module `libc`
 --> heim-cpu/src/sys/unix.rs:6:27
  |
6 |     let result = unsafe { libc::getloadavg(data.as_mut_ptr(), 3) };
  |                           ^^^^ use of undeclared crate or module `libc`

error: Unsupported OS
  --> heim-disk/src/sys/mod.rs:22:9
   |
22 |         compile_error!("Unsupported OS");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0425]: cannot find function `detect` in module `self::sys`
   --> heim-virt/src/lib.rs:178:16
    |
178 |     self::sys::detect().await
    |                ^^^^^^ not found in `self::sys`

error[E0425]: cannot find function `logical_count` in module `sys`
 --> heim-cpu/src/count.rs:7:10
  |
7 |     sys::logical_count().await
  |          ^^^^^^^^^^^^^ not found in `sys`
  |
help: consider importing this function
  |
1 | use crate::logical_count;
  |
help: if you import `logical_count`, refer to it directly
  |
7 -     sys::logical_count().await
7 +     logical_count().await
  |

error[E0425]: cannot find function `physical_count` in module `sys`
  --> heim-cpu/src/count.rs:16:10
   |
16 |     sys::physical_count().await
   |          ^^^^^^^^^^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::physical_count;
   |
help: if you import `physical_count`, refer to it directly
   |
16 -     sys::physical_count().await
16 +     physical_count().await
   |

error[E0412]: cannot find type `CpuFrequency` in module `sys`
 --> heim-cpu/src/freq.rs:9:30
  |
9 | pub struct CpuFrequency(sys::CpuFrequency);
  |                              ^^^^^^^^^^^^ not found in `sys`
  |
help: consider importing this struct
  |
1 | use crate::CpuFrequency;
  |
help: if you import `CpuFrequency`, refer to it directly
  |
9 - pub struct CpuFrequency(sys::CpuFrequency);
9 + pub struct CpuFrequency(CpuFrequency);
  |

error[E0412]: cannot find type `CpuFrequency` in module `sys`
  --> heim-cpu/src/freq.rs:11:26
   |
11 | wrap!(CpuFrequency, sys::CpuFrequency);
   |                          ^^^^^^^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::CpuFrequency;
   |
help: if you import `CpuFrequency`, refer to it directly
   |
11 - wrap!(CpuFrequency, sys::CpuFrequency);
11 + wrap!(CpuFrequency, CpuFrequency);
   |

error[E0425]: cannot find function `frequency` in module `sys`
  --> heim-cpu/src/freq.rs:63:10
   |
63 |     sys::frequency().await.map(Into::into)
   |          ^^^^^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::frequency;
   |
help: if you import `frequency`, refer to it directly
   |
63 -     sys::frequency().await.map(Into::into)
63 +     frequency().await.map(Into::into)
   |

error[E0412]: cannot find type `CpuStats` in module `sys`
  --> heim-cpu/src/stats.rs:10:26
   |
10 | pub struct CpuStats(sys::CpuStats);
   |                          ^^^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::CpuStats;
   |
help: if you import `CpuStats`, refer to it directly
   |
10 - pub struct CpuStats(sys::CpuStats);
10 + pub struct CpuStats(CpuStats);
   |

error[E0412]: cannot find type `CpuStats` in module `sys`
  --> heim-cpu/src/stats.rs:12:22
   |
12 | wrap!(CpuStats, sys::CpuStats);
   |                      ^^^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::CpuStats;
   |
help: if you import `CpuStats`, refer to it directly
   |
12 - wrap!(CpuStats, sys::CpuStats);
12 + wrap!(CpuStats, CpuStats);
   |

error[E0425]: cannot find function `stats` in module `sys`
  --> heim-cpu/src/stats.rs:39:10
   |
39 |     sys::stats().await.map(Into::into)
   |          ^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::stats;
   |
help: if you import `stats`, refer to it directly
   |
39 -     sys::stats().await.map(Into::into)
39 +     stats().await.map(Into::into)
   |

error[E0412]: cannot find type `CpuTime` in module `sys`
  --> heim-cpu/src/times.rs:16:25
   |
16 | pub struct CpuTime(sys::CpuTime);
   |                         ^^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::CpuTime;
   |
help: if you import `CpuTime`, refer to it directly
   |
16 - pub struct CpuTime(sys::CpuTime);
16 + pub struct CpuTime(CpuTime);
   |

error[E0412]: cannot find type `CpuTime` in module `sys`
  --> heim-cpu/src/times.rs:18:21
   |
18 | wrap!(CpuTime, sys::CpuTime);
   |                     ^^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::CpuTime;
   |
help: if you import `CpuTime`, refer to it directly
   |
18 - wrap!(CpuTime, sys::CpuTime);
18 + wrap!(CpuTime, CpuTime);
   |

error[E0425]: cannot find function `time` in module `sys`
  --> heim-cpu/src/times.rs:55:10
   |
55 |     sys::time().await.map(Into::into)
   |          ^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::time;
   |
help: if you import `time`, refer to it directly
   |
55 -     sys::time().await.map(Into::into)
55 +     time().await.map(Into::into)
   |

error[E0425]: cannot find function `times` in module `sys`
  --> heim-cpu/src/times.rs:62:22
   |
62 |     let inner = sys::times().await?;
   |                      ^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::times;
   |
help: if you import `times`, refer to it directly
   |
62 -     let inner = sys::times().await?;
62 +     let inner = times().await?;
   |

error[E0412]: cannot find type `Memory` in module `sys`
  --> heim-memory/src/memory.rs:14:24
   |
14 | pub struct Memory(sys::Memory);
   |                        ^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::Memory;
   |
help: if you import `Memory`, refer to it directly
   |
14 - pub struct Memory(sys::Memory);
14 + pub struct Memory(Memory);
   |

error[E0412]: cannot find type `Memory` in module `sys`
  --> heim-memory/src/memory.rs:16:20
   |
16 | wrap!(Memory, sys::Memory);
   |                    ^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::Memory;
   |
help: if you import `Memory`, refer to it directly
   |
16 - wrap!(Memory, sys::Memory);
16 + wrap!(Memory, Memory);
   |

error[E0425]: cannot find function `memory` in module `sys`
  --> heim-memory/src/memory.rs:51:10
   |
51 |     sys::memory().await.map(Into::into)
   |          ^^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::memory;
   |
help: if you import `memory`, refer to it directly
   |
51 -     sys::memory().await.map(Into::into)
51 +     memory().await.map(Into::into)
   |

error[E0412]: cannot find type `Swap` in module `sys`
  --> heim-memory/src/swap.rs:14:22
   |
14 | pub struct Swap(sys::Swap);
   |                      ^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::Swap;
   |
help: if you import `Swap`, refer to it directly
   |
14 - pub struct Swap(sys::Swap);
14 + pub struct Swap(Swap);
   |

error[E0412]: cannot find type `Swap` in module `sys`
  --> heim-memory/src/swap.rs:16:18
   |
16 | wrap!(Swap, sys::Swap);
   |                  ^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::Swap;
   |
help: if you import `Swap`, refer to it directly
   |
16 - wrap!(Swap, sys::Swap);
16 + wrap!(Swap, Swap);
   |

error[E0425]: cannot find function `swap` in module `sys`
  --> heim-memory/src/swap.rs:49:10
   |
49 |     sys::swap().await.map(Into::into)
   |          ^^^^ not found in `sys`
   |
help: consider importing one of these items
   |
1  | use core::mem::swap;
   |
1  | use core::ptr::swap;
   |
1  | use crate::swap;
   |
1  | use std::mem::swap;
   |
     and 1 other candidate
help: if you import `swap`, refer to it directly
   |
49 -     sys::swap().await.map(Into::into)
49 +     swap().await.map(Into::into)
   |

error[E0425]: cannot find function `boot_time` in module `sys`
 --> heim-host/src/boot_time.rs:9:10
  |
9 |     sys::boot_time().await
  |          ^^^^^^^^^ not found in `sys`
  |
help: consider importing this function
  |
1 | use crate::boot_time;
  |
help: if you import `boot_time`, refer to it directly
  |
9 -     sys::boot_time().await
9 +     boot_time().await
  |

error[E0412]: cannot find type `IoCounters` in module `sys`
 --> heim-net/src/counters.rs:9:28
  |
9 | pub struct IoCounters(sys::IoCounters);
  |                            ^^^^^^^^^^ not found in `sys`
  |
help: consider importing this struct
  |
1 | use crate::IoCounters;
  |
help: if you import `IoCounters`, refer to it directly
  |
9 - pub struct IoCounters(sys::IoCounters);
9 + pub struct IoCounters(IoCounters);
  |

error[E0425]: cannot find function `uptime` in module `sys`
 --> heim-host/src/uptime.rs:9:10
  |
9 |     sys::uptime().await
  |          ^^^^^^ not found in `sys`
  |
help: consider importing this function
  |
1 | use crate::uptime;
  |
help: if you import `uptime`, refer to it directly
  |
9 -     sys::uptime().await
9 +     uptime().await
  |

error[E0412]: cannot find type `IoCounters` in module `sys`
  --> heim-net/src/counters.rs:11:24
   |
11 | wrap!(IoCounters, sys::IoCounters);
   |                        ^^^^^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::IoCounters;
   |
help: if you import `IoCounters`, refer to it directly
   |
11 - wrap!(IoCounters, sys::IoCounters);
11 + wrap!(IoCounters, IoCounters);
   |

error[E0412]: cannot find type `User` in module `sys`
  --> heim-host/src/users.rs:11:22
   |
11 | pub struct User(sys::User);
   |                      ^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::User;
   |
help: if you import `User`, refer to it directly
   |
11 - pub struct User(sys::User);
11 + pub struct User(User);
   |

error[E0425]: cannot find function `io_counters` in module `sys`
  --> heim-net/src/counters.rs:84:22
   |
84 |     let inner = sys::io_counters().await?;
   |                      ^^^^^^^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::io_counters;
   |
help: if you import `io_counters`, refer to it directly
   |
84 -     let inner = sys::io_counters().await?;
84 +     let inner = io_counters().await?;
   |

error[E0412]: cannot find type `User` in module `sys`
  --> heim-host/src/users.rs:13:18
   |
13 | wrap!(User, sys::User);
   |                  ^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::User;
   |
help: if you import `User`, refer to it directly
   |
13 - wrap!(User, sys::User);
13 + wrap!(User, User);
   |

error[E0425]: cannot find function `users` in module `sys`
  --> heim-host/src/users.rs:39:22
   |
39 |     let inner = sys::users().await?;
   |                      ^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::users;
   |
help: if you import `users`, refer to it directly
   |
39 -     let inner = sys::users().await?;
39 +     let inner = users().await?;
   |

For more information about this error, try `rustc --explain E0425`.
error[E0425]: cannot find value `ST_MANDLOCK` in crate `libc`
  --> heim-disk/src/os/unix/usage.rs:12:32
   |
12 |         const MANDLOCK = libc::ST_MANDLOCK;
   |                                ^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `ST_NOATIME` in crate `libc`
   --> heim-disk/src/os/unix/usage.rs:20:31
    |
20  |         const NOATIME = libc::ST_NOATIME;
    |                               ^^^^^^^^^^ help: a constant with a similar name exists: `MNT_NOATIME`
    |
   ::: /home/testing/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.127/src/unix/bsd/freebsdlike/mod.rs:629:1
    |
629 | pub const MNT_NOATIME: ::c_int = 0x10000000;
    | ------------------------------ similarly named constant `MNT_NOATIME` defined here

error[E0425]: cannot find value `ST_NODEV` in crate `libc`
  --> heim-disk/src/os/unix/usage.rs:28:29
   |
28 |         const NODEV = libc::ST_NODEV;
   |                             ^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `ST_NODIRATIME` in crate `libc`
  --> heim-disk/src/os/unix/usage.rs:36:34
   |
36 |         const NODIRATIME = libc::ST_NODIRATIME;
   |                                  ^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `ST_NOEXEC` in crate `libc`
   --> heim-disk/src/os/unix/usage.rs:44:30
    |
44  |         const NOEXEC = libc::ST_NOEXEC;
    |                              ^^^^^^^^^ help: a constant with a similar name exists: `MNT_NOEXEC`
    |
   ::: /home/testing/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.127/src/unix/bsd/mod.rs:344:1
    |
344 | pub const MNT_NOEXEC: ::c_int = 0x00000004;
    | ----------------------------- similarly named constant `MNT_NOEXEC` defined here

error[E0425]: cannot find value `ST_RELATIME` in crate `libc`
  --> heim-disk/src/os/unix/usage.rs:59:32
   |
59 |         const RELATIME = libc::ST_RELATIME;
   |                                ^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `ST_SYNCHRONOUS` in crate `libc`
   --> heim-disk/src/os/unix/usage.rs:68:35
    |
68  |         const SYNCHRONOUS = libc::ST_SYNCHRONOUS;
    |                                   ^^^^^^^^^^^^^^ help: a constant with a similar name exists: `MNT_SYNCHRONOUS`
    |
   ::: /home/testing/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.127/src/unix/bsd/mod.rs:343:1
    |
343 | pub const MNT_SYNCHRONOUS: ::c_int = 0x00000002;
    | ---------------------------------- similarly named constant `MNT_SYNCHRONOUS` defined here

error[E0412]: cannot find type `IoCounters` in module `sys`
  --> heim-disk/src/counters.rs:20:28
   |
20 | pub struct IoCounters(sys::IoCounters);
   |                            ^^^^^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::IoCounters;
   |
help: if you import `IoCounters`, refer to it directly
   |
20 - pub struct IoCounters(sys::IoCounters);
20 + pub struct IoCounters(IoCounters);
   |

error: could not compile `heim-sensors` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0412]: cannot find type `IoCounters` in module `sys`
  --> heim-disk/src/counters.rs:22:24
   |
22 | wrap!(IoCounters, sys::IoCounters);
   |                        ^^^^^^^^^^ not found in `sys`
   |
help: consider importing this struct
   |
1  | use crate::IoCounters;
   |
help: if you import `IoCounters`, refer to it directly
   |
22 - wrap!(IoCounters, sys::IoCounters);
22 + wrap!(IoCounters, IoCounters);
   |

error[E0425]: cannot find function `io_counters` in module `sys`
  --> heim-disk/src/counters.rs:72:22
   |
72 |     let inner = sys::io_counters().await?;
   |                      ^^^^^^^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::io_counters;
   |
help: if you import `io_counters`, refer to it directly
   |
72 -     let inner = sys::io_counters().await?;
72 +     let inner = io_counters().await?;
   |

error[E0425]: cannot find function `io_counters_physical` in module `sys`
  --> heim-disk/src/counters.rs:81:22
   |
81 |     let inner = sys::io_counters_physical().await?;
   |                      ^^^^^^^^^^^^^^^^^^^^ not found in `sys`
   |
help: consider importing this function
   |
1  | use crate::io_counters_physical;
   |
help: if you import `io_counters_physical`, refer to it directly
   |
81 -     let inner = sys::io_counters_physical().await?;
81 +     let inner = io_counters_physical().await?;
   |

error: could not compile `heim-virt` due to 2 previous errors
Some errors have detailed explanations: E0412, E0425.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `heim-memory` due to 7 previous errors
error: could not compile `heim-host` due to 6 previous errors
Some errors have detailed explanations: E0412, E0425, E0433.
error: could not compile `heim-cpu` due to 15 previous errors
error: could not compile `heim-net` due to 3 previous errors
error[E0308]: mismatched types
  --> heim-disk/src/sys/unix/partitions.rs:60:20
   |
60 |             flags: stat.f_flags,
   |                    ^^^^^^^^^^^^ expected `u32`, found `u64`

Some errors have detailed explanations: E0308, E0412, E0425.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `heim-disk` due to 13 previous errors