Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement MacOS support #4

Open
adriangalilea opened this issue Aug 21, 2024 · 1 comment
Open

Implement MacOS support #4

adriangalilea opened this issue Aug 21, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@adriangalilea
Copy link

I tried to install it on mac and got:

cargo install disktest
    Updating crates.io index
  Downloaded disktest v1.14.0
  Downloaded 1 crate (13.6 KB) in 0.78s
  Installing disktest v1.14.0
    Updating crates.io index
     Locking 82 packages to latest compatible versions
      Adding linux-raw-sys v0.4.14 (latest: v0.6.5)
      Adding wasi v0.11.0+wasi-snapshot-preview1 (latest: v0.13.2+wasi-0.2.1)
      Adding windows-core v0.52.0 (latest: v0.58.0)
      Adding windows-sys v0.52.0 (latest: v0.59.0)
  Downloaded anstream v0.6.15
  Downloaded anstyle v1.0.8
  Downloaded anstyle-query v1.1.1
  Downloaded anstyle-parse v0.2.5
  Downloaded colorchoice v1.0.2
  Downloaded is_terminal_polyfill v1.70.1
  Downloaded clap_lex v0.7.2
  Downloaded ppv-lite86 v0.2.20
  Downloaded core-foundation-sys v0.8.7
  Downloaded zerocopy-derive v0.7.35
  Downloaded spin v0.9.8
  Downloaded tempfile v3.12.0
  Downloaded clap_builder v4.5.15
  Downloaded syn v2.0.75
  Downloaded zerocopy v0.7.35
  Downloaded clap v4.5.16
  Downloaded libc v0.2.158
  Downloaded cc v1.1.13
  Downloaded ring v0.17.8
  Downloaded movavg v2.3.0
  Downloaded disktest-lib v1.0.0
  Downloaded disktest-rawio v1.0.0
  Downloaded 22 crates (6.0 MB) in 0.73s (largest was `ring` at 4.2 MB)
   Compiling libc v0.2.158
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.12
   Compiling autocfg v1.3.0
   Compiling cfg-if v1.0.0
   Compiling byteorder v1.5.0
   Compiling utf8parse v0.2.2
   Compiling shlex v1.3.0
   Compiling anstyle v1.0.8
   Compiling anstyle-query v1.1.1
   Compiling anstyle-parse v0.2.5
   Compiling colorchoice v1.0.2
   Compiling rustix v0.38.34
   Compiling cc v1.1.13
   Compiling is_terminal_polyfill v1.70.1
   Compiling anyhow v1.0.86
   Compiling clap_lex v0.7.2
   Compiling anstream v0.6.15
   Compiling bitflags v2.6.0
   Compiling core-foundation-sys v0.8.7
   Compiling num-traits v0.2.19
   Compiling movavg v2.3.0
   Compiling signal-hook v0.3.17
   Compiling strsim v0.11.1
   Compiling clap_builder v4.5.15
   Compiling ring v0.17.8
   Compiling iana-time-zone v0.1.60
   Compiling fastrand v2.1.0
   Compiling once_cell v1.19.0
   Compiling untrusted v0.9.0
   Compiling spin v0.9.8
   Compiling clap v4.5.16
   Compiling chrono v0.4.38
   Compiling quote v1.0.36
   Compiling getrandom v0.2.15
   Compiling errno v0.3.9
   Compiling rand_core v0.6.4
   Compiling syn v2.0.75
   Compiling signal-hook-registry v1.4.2
   Compiling disktest-rawio v1.0.0
error[E0432]: unresolved import `libc::POSIX_FADV_DONTNEED`
  --> /Users/adrian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/disktest-rawio-1.0.0/src/linux.rs:14:26
   |
14 | use libc::{c_int, off_t, POSIX_FADV_DONTNEED, S_IFBLK, S_IFCHR, S_IFMT};
   |                          ^^^^^^^^^^^^^^^^^^^
   |                          |
   |                          no `POSIX_FADV_DONTNEED` in the root
   |                          help: a similar name exists in the module: `POSIX_MADV_DONTNEED`

error[E0425]: cannot find value `BLKPBSZGET` in crate `libc`
  --> /Users/adrian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/disktest-rawio-1.0.0/src/linux.rs:96:27
   |
96 |                     libc::BLKPBSZGET, // get physical sector size.
   |                           ^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `posix_fadvise` in crate `libc`
   --> /Users/adrian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/disktest-rawio-1.0.0/src/linux.rs:148:19
    |
148 |             libc::posix_fadvise(
    |                   ^^^^^^^^^^^^^ help: a function with a similar name exists: `posix_madvise`
    |
   ::: /Users/adrian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.158/src/unix/bsd/mod.rs:675:5
    |
675 |     pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
    |     ------------------------------------------------------------------------------------ similarly named function `posix_madvise` defined here

error[E0308]: mismatched types
  --> /Users/adrian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/disktest-rawio-1.0.0/src/linux.rs:74:43
   |
74 |             let mode_ifmt = meta.mode() & S_IFMT;
   |                                           ^^^^^^ expected `u32`, found `u16`

error[E0277]: no implementation for `u32 & u16`
  --> /Users/adrian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/disktest-rawio-1.0.0/src/linux.rs:74:41
   |
74 |             let mode_ifmt = meta.mode() & S_IFMT;
   |                                         ^ no implementation for `u32 & u16`
   |
   = help: the trait `BitAnd<u16>` is not implemented for `u32`
   = help: the following other types implement trait `BitAnd<Rhs>`:
             <&'a u32 as BitAnd<u32>>
             <&u32 as BitAnd<&u32>>
             <u32 as BitAnd<&u32>>
             <u32 as BitAnd>

error[E0308]: mismatched types
  --> /Users/adrian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/disktest-rawio-1.0.0/src/linux.rs:75:29
   |
75 |             if mode_ifmt == S_IFBLK {
   |                ---------    ^^^^^^^ expected `u32`, found `u16`
   |                |
   |                expected because this is `u32`
   |
help: you can convert a `u16` to a `u32`
   |
75 |             if mode_ifmt == S_IFBLK.into() {
   |                                    +++++++

error[E0308]: mismatched types
  --> /Users/adrian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/disktest-rawio-1.0.0/src/linux.rs:78:29
   |
78 |             if mode_ifmt == S_IFCHR {
   |                ---------    ^^^^^^^ expected `u32`, found `u16`
   |                |
   |                expected because this is `u32`
   |
help: you can convert a `u16` to a `u32`
   |
78 |             if mode_ifmt == S_IFCHR.into() {
   |                                    +++++++

Some errors have detailed explanations: E0277, E0308, E0425, E0432.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `disktest-rawio` (lib) due to 7 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `disktest v1.14.0`, intermediate artifacts can be found at `/var/folders/lr/p37vprfd3hg2dlym5br0jx3r0000gn/T/cargo-installLJ1Yat`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
@mbuesch mbuesch added enhancement New feature or request help wanted Extra attention is needed labels Aug 21, 2024
@mbuesch
Copy link
Owner

mbuesch commented Aug 21, 2024

Hi, thanks for your question!

Disktest is currently only supported on Linux and Windows.
Mainly, just because that are the operating systems I work with.

The OS interface is abtracted in the disktest-rawio crate. That's most likely the only place that needs changes for MacOS.

If you are interested, please feel free to prepare a Pull Request.
If you decide to do that, please ensure to thoroughly test it, though, because I can't test it.
I am interested to merge MacOS support as a second class OS (only compile-tested in CI before release).

@mbuesch mbuesch changed the title Mac support? Implement MacOS support Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants