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

Does notr build on OSX #1

Closed
Bartcardi opened this issue Jun 11, 2020 · 7 comments
Closed

Does notr build on OSX #1

Bartcardi opened this issue Jun 11, 2020 · 7 comments
Assignees
Labels
portability Something doesn't work on all platforms

Comments

@Bartcardi
Copy link

Hi,

Your tool looks very promosing, so I wanted to give it a go on Mac. Unfortunately I get build errors. Mainly about unresolved PosixFadviseAdvice.

short trace

error[E0433]: failed to resolve: use of undeclared type or module `PosixFadviseAdvice`

If have zero RUST skills but if you have some advice I would gladly help you out.

@pkolaczk
Copy link
Owner

Thank you for your report. Unfortunately I don't have a Mac, so my ability to verify on Mac is limited. However, can you paste the full output of the compiler? Maybe with your help we could figure this out.

@Bartcardi
Copy link
Author

Bartcardi commented Jun 11, 2020

Of course! Here goes:

Shell output

~/.cargo/bin/cargo build --release                                                                                                                                                                   (127)
    Updating crates.io index
    Updating git repository `https://github.com/pkolaczk/rust-pcre2.git`
    Updating git submodule `https://github.com/BurntSushi/pcre2-mirror`
  Downloaded arrayvec v0.4.12
  Downloaded autocfg v1.0.0
  Downloaded atty v0.2.14
  Downloaded bstr v0.2.13
  Downloaded cfg-if v0.1.10
  Downloaded console v0.11.3
  Downloaded crossbeam-utils v0.7.2
  Downloaded crossbeam-queue v0.2.3
  Downloaded crossbeam-epoch v0.8.2
  Downloaded itoa v0.4.5
  Downloaded indoc v0.3.5
  Downloaded memoffset v0.5.4
  Downloaded nodrop v0.1.14
  Downloaded pkg-config v0.3.17
  Downloaded number_prefix v0.3.0
  Downloaded quote v1.0.7
  Downloaded rayon-core v1.7.0
  Downloaded proc-macro2 v1.0.18
  Downloaded smallvec v1.4.0
  Downloaded thread_local v1.0.1
  Downloaded void v1.0.2
  Downloaded version_check v0.9.2
  Downloaded termios v0.3.2
  Downloaded syn-mid v0.5.0
  Downloaded indicatif v0.14.0
  Downloaded ahash v0.3.8
  Downloaded rand v0.4.6
  Downloaded regex-automata v0.1.9
  Downloaded unicode-segmentation v1.6.0
  Downloaded aho-corasick v0.7.10
  Downloaded unindent v0.1.5
  Downloaded nom v5.1.1
  Downloaded regex v1.3.9
  Downloaded syn v1.0.31
  Downloaded rayon v1.3.0
  Downloaded regex-syntax v0.6.18
  Downloaded csv v1.1.3
  Downloaded libc v0.2.71
  Downloaded lexical-core v0.6.2
  Downloaded nix v0.17.0
  Downloaded serde_json v1.0.55
  Downloaded serde v1.0.111
  Downloaded xoroshiro128 v0.3.0
  Downloaded atomic-counter v1.0.1
  Downloaded dashmap v3.11.4
  Downloaded indoc-impl v0.3.5
  Downloaded itertools v0.9.0
  Downloaded static_assertions v0.3.4
  Downloaded terminal_size v0.1.12
  Downloaded vec_map v0.8.2
  Downloaded unicode-width v0.1.7
  Downloaded structopt-derive v0.4.7
  Downloaded structopt v0.3.14
  Downloaded sys-info v0.6.1
  Downloaded serde_derive v1.0.111
  Downloaded semver-parser v0.7.0
  Downloaded semver v0.9.0
  Downloaded fasthash v0.4.0
  Downloaded seahash v3.0.7
  Downloaded scopeguard v1.1.0
  Downloaded ryu v1.0.5
  Downloaded rustc_version v0.2.3
  Downloaded proc-macro-hack v0.5.16
  Downloaded bitflags v1.2.1
  Downloaded proc-macro-error-attr v1.0.2
  Downloaded proc-macro-error v1.0.2
  Downloaded num_cpus v1.13.0
  Downloaded num-traits v0.2.11
  Downloaded memchr v2.3.3
  Downloaded maybe-uninit v2.0.0
  Downloaded log v0.4.8
  Downloaded getrandom v0.1.14
  Downloaded gcc v0.3.55
  Downloaded either v1.5.3
  Downloaded csv-core v0.1.10
  Downloaded crossbeam-deque v0.7.3
  Downloaded const-random-macro v0.1.8
  Downloaded const-random v0.1.8
  Downloaded clap v2.33.1
  Downloaded bytesize v1.0.1
  Downloaded cc v1.0.54
  Downloaded byteorder v1.3.4
  Downloaded fasthash-sys v0.3.2
  Downloaded 83 crates (6.1 MB) in 1.78s
   Compiling libc v0.2.71
   Compiling cfg-if v0.1.10
   Compiling autocfg v1.0.0
   Compiling proc-macro2 v1.0.18
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.31
   Compiling lazy_static v1.4.0
   Compiling version_check v0.9.2
   Compiling memchr v2.3.3
   Compiling maybe-uninit v2.0.0
   Compiling cc v1.0.54
   Compiling getrandom v0.1.14
   Compiling semver-parser v0.7.0
   Compiling ryu v1.0.5
   Compiling proc-macro-hack v0.5.16
   Compiling byteorder v1.3.4
   Compiling serde v1.0.111
   Compiling scopeguard v1.1.0
   Compiling bitflags v1.2.1
   Compiling unicode-width v0.1.7
   Compiling arrayvec v0.4.12
   Compiling rayon-core v1.7.0
   Compiling pkg-config v0.3.17
   Compiling gcc v0.3.55
   Compiling log v0.4.8
   Compiling either v1.5.3
   Compiling nodrop v0.1.14
   Compiling regex-syntax v0.6.18
   Compiling unicode-segmentation v1.6.0
   Compiling serde_json v1.0.55
   Compiling unindent v0.1.5
   Compiling itoa v0.4.5
   Compiling static_assertions v0.3.4
   Compiling vec_map v0.8.2
   Compiling nix v0.17.0
   Compiling strsim v0.8.0
   Compiling ansi_term v0.11.0
   Compiling void v1.0.2
   Compiling number_prefix v0.3.0
   Compiling seahash v3.0.7
   Compiling atomic-counter v1.0.1
   Compiling smallvec v1.4.0
   Compiling bytesize v1.0.1
   Compiling thread_local v1.0.1
   Compiling crossbeam-utils v0.7.2
   Compiling memoffset v0.5.4
   Compiling crossbeam-epoch v0.8.2
   Compiling num-traits v0.2.11
   Compiling semver v0.9.0
   Compiling proc-macro-error-attr v1.0.2
   Compiling proc-macro-error v1.0.2
   Compiling nom v5.1.1
   Compiling textwrap v0.11.0
   Compiling itertools v0.9.0
   Compiling heck v0.3.1
   Compiling rustc_version v0.2.3
   Compiling aho-corasick v0.7.10
   Compiling csv-core v0.1.10
   Compiling quote v1.0.7
   Compiling num_cpus v1.13.0
   Compiling rand v0.4.6
   Compiling terminal_size v0.1.12
   Compiling atty v0.2.14
   Compiling termios v0.3.2
   Compiling fasthash-sys v0.3.2
   Compiling regex-automata v0.1.9
   Compiling pcre2-sys v0.2.2 (https://github.com/pkolaczk/rust-pcre2.git#e15c59ac)
   Compiling sys-info v0.6.1
   Compiling lexical-core v0.6.2
   Compiling const-random-macro v0.1.8
   Compiling clap v2.33.1
   Compiling regex v1.3.9
   Compiling crossbeam-queue v0.2.3
   Compiling xoroshiro128 v0.3.0
   Compiling crossbeam-deque v0.7.3
   Compiling const-random v0.1.8
   Compiling console v0.11.3
   Compiling ahash v0.3.8
   Compiling syn-mid v0.5.0
   Compiling pcre2 v0.2.3 (https://github.com/pkolaczk/rust-pcre2.git#e15c59ac)
   Compiling rayon v1.3.0
   Compiling dashmap v3.11.4
   Compiling fasthash v0.4.0
   Compiling indicatif v0.14.0
   Compiling serde_derive v1.0.111
   Compiling indoc-impl v0.3.5
   Compiling indoc v0.3.5
   Compiling structopt-derive v0.4.7
   Compiling structopt v0.3.14
   Compiling bstr v0.2.13
   Compiling csv v1.1.3
   Compiling fclones v0.1.1 (/Users/bjoosten/Projects/fclones)
error[E0433]: failed to resolve: use of undeclared type or module `PosixFadviseAdvice`
   --> src/files.rs:331:39
    |
331 |             Caching::Random => advise(PosixFadviseAdvice::POSIX_FADV_RANDOM),
    |                                       ^^^^^^^^^^^^^^^^^^ use of undeclared type or module `PosixFadviseAdvice`

error[E0433]: failed to resolve: use of undeclared type or module `PosixFadviseAdvice`
   --> src/files.rs:332:43
    |
332 |             Caching::Sequential => advise(PosixFadviseAdvice::POSIX_FADV_SEQUENTIAL),
    |                                           ^^^^^^^^^^^^^^^^^^ use of undeclared type or module `PosixFadviseAdvice`

error[E0433]: failed to resolve: use of undeclared type or module `PosixFadviseAdvice`
   --> src/files.rs:341:36
    |
341 |         fadvise(file, offset, len, PosixFadviseAdvice::POSIX_FADV_DONTNEED);
    |                                    ^^^^^^^^^^^^^^^^^^ use of undeclared type or module `PosixFadviseAdvice`

error[E0412]: cannot find type `PosixFadviseAdvice` in this scope
   --> src/files.rs:313:64
    |
313 | fn fadvise(file: &File, offset: FilePos, len: FileLen, advice: PosixFadviseAdvice) {
    |                                                                ^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `posix_fadvise` in this scope
   --> src/files.rs:314:13
    |
314 |     let _ = posix_fadvise(file.as_raw_fd(),
    |             ^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `PosixFadviseAdvice` in this scope
   --> src/files.rs:326:31
    |
326 |         let advise = |advice: PosixFadviseAdvice| {
    |                               ^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `O_NOATIME` in crate `libc`
    --> src/files.rs:393:41
     |
393  |         noatime_opts.custom_flags(libc::O_NOATIME);
     |                                         ^^^^^^^^^ help: a constant with a similar name exists: `MNT_NOATIME`
     |
    ::: /Users/bjoosten/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.71/src/unix/bsd/apple/mod.rs:3071:1
     |
3071 | pub const MNT_NOATIME: ::c_int = 0x10000000;
     | -------------------------------------------- similarly named constant `MNT_NOATIME` defined here

warning: unused import: `nix::fcntl::*`
  --> src/files.rs:20:5
   |
20 | use nix::fcntl::*;
   |     ^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

error: aborting due to 7 previous errors; 1 warning emitted

Some errors have detailed explanations: E0412, E0425, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `fclones`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

pkolaczk added a commit that referenced this issue Jun 11, 2020
@pkolaczk
Copy link
Owner

Can you test on this branch: mac_posix_fadvise?

@Bartcardi
Copy link
Author

Bartcardi commented Jun 11, 2020

Done. Unfortunately, I think it's mainly the same errors but now on different lines due to your fix.

Shell output

~/.cargo/bin/cargo build --release
    Updating crates.io index
    Updating git repository `https://github.com/pkolaczk/rust-pcre2.git`
   Compiling libc v0.2.71
   Compiling autocfg v1.0.0
   Compiling cfg-if v0.1.10
   Compiling proc-macro2 v1.0.18
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.31
   Compiling lazy_static v1.4.0
   Compiling version_check v0.9.2
   Compiling memchr v2.3.3
   Compiling maybe-uninit v2.0.0
   Compiling cc v1.0.54
   Compiling getrandom v0.1.14
   Compiling ryu v1.0.5
   Compiling proc-macro-hack v0.5.16
   Compiling semver-parser v0.7.0
   Compiling serde v1.0.111
   Compiling byteorder v1.3.4
   Compiling bitflags v1.2.1
   Compiling unicode-width v0.1.7
   Compiling scopeguard v1.1.0
   Compiling rayon-core v1.7.0
   Compiling gcc v0.3.55
   Compiling pkg-config v0.3.17
   Compiling arrayvec v0.4.12
   Compiling either v1.5.3
   Compiling nodrop v0.1.14
   Compiling log v0.4.8
   Compiling regex-syntax v0.6.18
   Compiling unicode-segmentation v1.6.0
   Compiling vec_map v0.8.2
   Compiling static_assertions v0.3.4
   Compiling serde_json v1.0.55
   Compiling ansi_term v0.11.0
   Compiling itoa v0.4.5
   Compiling strsim v0.8.0
   Compiling unindent v0.1.5
   Compiling nix v0.17.0
   Compiling number_prefix v0.3.0
   Compiling seahash v3.0.7
   Compiling void v1.0.2
   Compiling atomic-counter v1.0.1
   Compiling smallvec v1.4.0
   Compiling bytesize v1.0.1
   Compiling thread_local v1.0.1
   Compiling textwrap v0.11.0
   Compiling crossbeam-utils v0.7.2
   Compiling memoffset v0.5.4
   Compiling crossbeam-epoch v0.8.2
   Compiling num-traits v0.2.11
   Compiling itertools v0.9.0
   Compiling proc-macro-error-attr v1.0.2
   Compiling proc-macro-error v1.0.2
   Compiling nom v5.1.1
   Compiling heck v0.3.1
   Compiling semver v0.9.0
   Compiling rustc_version v0.2.3
   Compiling aho-corasick v0.7.10
   Compiling csv-core v0.1.10
   Compiling quote v1.0.7
   Compiling fasthash-sys v0.3.2
   Compiling regex-automata v0.1.9
   Compiling num_cpus v1.13.0
   Compiling rand v0.4.6
   Compiling atty v0.2.14
   Compiling termios v0.3.2
   Compiling terminal_size v0.1.12
   Compiling pcre2-sys v0.2.2 (https://github.com/pkolaczk/rust-pcre2.git#e15c59ac)
   Compiling sys-info v0.6.1
   Compiling lexical-core v0.6.2
   Compiling regex v1.3.9
   Compiling crossbeam-queue v0.2.3
   Compiling const-random-macro v0.1.8
   Compiling clap v2.33.1
   Compiling xoroshiro128 v0.3.0
   Compiling crossbeam-deque v0.7.3
   Compiling console v0.11.3
   Compiling const-random v0.1.8
   Compiling ahash v0.3.8
   Compiling syn-mid v0.5.0
   Compiling pcre2 v0.2.3 (https://github.com/pkolaczk/rust-pcre2.git#e15c59ac)
   Compiling rayon v1.3.0
   Compiling dashmap v3.11.4
   Compiling fasthash v0.4.0
   Compiling indicatif v0.14.0
   Compiling serde_derive v1.0.111
   Compiling indoc-impl v0.3.5
   Compiling indoc v0.3.5
   Compiling structopt-derive v0.4.7
   Compiling structopt v0.3.14
   Compiling bstr v0.2.13
   Compiling csv v1.1.3
   Compiling fclones v0.1.1 (/Users/bjoosten/Projects/fclones)
error[E0433]: failed to resolve: use of undeclared type or module `PosixFadviseAdvice`
   --> src/files.rs:343:39
    |
343 |             Caching::Random => advise(PosixFadviseAdvice::POSIX_FADV_RANDOM),
    |                                       ^^^^^^^^^^^^^^^^^^ use of undeclared type or module `PosixFadviseAdvice`

error[E0433]: failed to resolve: use of undeclared type or module `PosixFadviseAdvice`
   --> src/files.rs:344:43
    |
344 |             Caching::Sequential => advise(PosixFadviseAdvice::POSIX_FADV_SEQUENTIAL),
    |                                           ^^^^^^^^^^^^^^^^^^ use of undeclared type or module `PosixFadviseAdvice`

error[E0433]: failed to resolve: use of undeclared type or module `PosixFadviseAdvice`
   --> src/files.rs:360:36
    |
360 |         fadvise(file, offset, len, PosixFadviseAdvice::POSIX_FADV_DONTNEED);
    |                                    ^^^^^^^^^^^^^^^^^^ use of undeclared type or module `PosixFadviseAdvice`

error[E0412]: cannot find type `PosixFadviseAdvice` in this scope
   --> src/files.rs:338:31
    |
338 |         let advise = |advice: PosixFadviseAdvice| {
    |                               ^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `fadvise` in this scope
   --> src/files.rs:339:13
    |
339 |             fadvise(file, offset, len, advice)
    |             ^^^^^^^ help: a local variable with a similar name exists: `advice`

error[E0425]: cannot find function `fadvise` in this scope
   --> src/files.rs:360:9
    |
360 |         fadvise(file, offset, len, PosixFadviseAdvice::POSIX_FADV_DONTNEED);
    |         ^^^^^^^ not found in this scope

error[E0425]: cannot find value `O_NOATIME` in crate `libc`
    --> src/files.rs:412:41
     |
412  |         noatime_opts.custom_flags(libc::O_NOATIME);
     |                                         ^^^^^^^^^ help: a constant with a similar name exists: `MNT_NOATIME`
     |
    ::: /Users/bjoosten/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.71/src/unix/bsd/apple/mod.rs:3071:1
     |
3071 | pub const MNT_NOATIME: ::c_int = 0x10000000;
     | -------------------------------------------- similarly named constant `MNT_NOATIME` defined here

warning: unused import: `std::os::unix::io::*`
  --> src/files.rs:15:5
   |
15 | use std::os::unix::io::*;
   |     ^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: unused import: `nix::fcntl::*`
   --> src/files.rs:337:13
    |
337 |         use nix::fcntl::*;
    |             ^^^^^^^^^^^^^

warning: unused import: `nix::fcntl::*`
   --> src/files.rs:359:13
    |
359 |         use nix::fcntl::*;
    |             ^^^^^^^^^^^^^

error: aborting due to 7 previous errors; 3 warnings emitted

Some errors have detailed explanations: E0412, E0425, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `fclones`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
```</p></details>

@pkolaczk
Copy link
Owner

Huh, I think I misunderstood how !cfg macro works... Please try now.

@Bartcardi
Copy link
Author

Yes it works perfectly now. Thank you!

pkolaczk added a commit that referenced this issue Jun 11, 2020
pkolaczk added a commit that referenced this issue Jun 11, 2020
Don't use posix_fadvise on Mac Fixes #1.
@pkolaczk
Copy link
Owner

Thank you! Merged.

@pkolaczk pkolaczk added the portability Something doesn't work on all platforms label Jun 16, 2020
@pkolaczk pkolaczk self-assigned this Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
portability Something doesn't work on all platforms
Projects
None yet
Development

No branches or pull requests

2 participants