Smithay/wayland-rs

Unable to compile my project for linux xorg using winit

mvvvv opened this issue · 4 comments

Since this morning I'm having this error:

mv@i56400:~/dvlt/abacaba/stereokit-rust$ cargo run --example main_pc
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.152
   Compiling proc-macro2 v1.0.76
   Compiling pkg-config v0.3.29
   Compiling once_cell v1.19.0
   Compiling rustix v0.38.30
   Compiling unicode-ident v1.0.12
   Compiling bitflags v2.6.0
   Compiling libloading v0.8.1
   Compiling log v0.4.20
   Compiling linux-raw-sys v0.4.13
   Compiling dlib v0.5.2
   Compiling cc v1.0.83
   Compiling wayland-sys v0.31.4
   Compiling quote v1.0.35
   Compiling downcast-rs v1.2.0
   Compiling memchr v2.7.1
   Compiling wayland-backend v0.3.6
   Compiling smallvec v1.13.1
   Compiling scoped-tls v1.0.1
   Compiling quick-xml v0.34.0
   Compiling wayland-client v0.31.5
   Compiling autocfg v1.1.0
   Compiling syn v2.0.48
   Compiling slab v0.4.9
   Compiling tracing-core v0.1.32
   Compiling wayland-scanner v0.31.4
   Compiling thiserror v1.0.56
   Compiling pin-project-lite v0.2.13
   Compiling tracing v0.1.40
   Compiling bitflags v1.3.2
   Compiling nix v0.26.4
   Compiling xcursor v0.3.5
   Compiling polling v3.3.2
   Compiling thiserror-impl v1.0.56
   Compiling xkeysym v0.2.0
   Compiling arrayref v0.3.7
   Compiling ttf-parser v0.20.0
   Compiling calloop v0.13.0
   Compiling bytemuck v1.14.0
   Compiling strict-num v0.1.1
   Compiling cursor-icon v1.1.0
   Compiling smithay-client-toolkit v0.19.2
   Compiling version_check v0.9.4
   Compiling wayland-protocols v0.32.3
   Compiling ahash v0.8.7
   Compiling calloop-wayland-source v0.3.0
   Compiling wayland-cursor v0.31.0
error[E0432]: unresolved import `nix::sys::stat`
   --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-cursor-0.31.0/src/lib.rs:58:22
    |
58  | use nix::sys::{mman, stat};
    |                      ^^^^ no `stat` in `sys`
    |
    = help: consider importing this struct instead:
            std::os::linux::raw::stat
note: found an item that was configured out
   --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.26.4/src/sys/mod.rs:152:13
    |
152 |     pub mod stat;
    |             ^^^^
    = note: the item is gated behind the `fs` feature

error[E0432]: unresolved import `nix::sys::memfd`
  --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-cursor-0.31.0/src/lib.rs:61:6
   |
61 | use {nix::sys::memfd, std::ffi::CStr};
   |      ^^^^^^^^^^^^^^^ no `memfd` in `sys`
   |
note: found an item that was configured out
  --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.26.4/src/sys/mod.rs:56:13
   |
56 |     pub mod memfd;
   |             ^^^^^
   = note: the item is gated behind the `fs` feature

error[E0433]: failed to resolve: could not find `OFlag` in `fcntl`
   --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-cursor-0.31.0/src/lib.rs:401:20
    |
401 |             fcntl::OFlag::O_CREAT
    |                    ^^^^^ could not find `OFlag` in `fcntl`

error[E0433]: failed to resolve: could not find `OFlag` in `fcntl`
   --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-cursor-0.31.0/src/lib.rs:402:26
    |
402 |                 | fcntl::OFlag::O_EXCL
    |                          ^^^^^ could not find `OFlag` in `fcntl`

error[E0433]: failed to resolve: could not find `OFlag` in `fcntl`
   --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-cursor-0.31.0/src/lib.rs:403:26
    |
403 |                 | fcntl::OFlag::O_RDWR
    |                          ^^^^^ could not find `OFlag` in `fcntl`

error[E0433]: failed to resolve: could not find `OFlag` in `fcntl`
   --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-cursor-0.31.0/src/lib.rs:404:26
    |
404 |                 | fcntl::OFlag::O_CLOEXEC,
    |                          ^^^^^ could not find `OFlag` in `fcntl`

error[E0425]: cannot find function `shm_open` in module `mman`
   --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-cursor-0.31.0/src/lib.rs:399:21
    |
399 |         match mman::shm_open(
    |                     ^^^^^^^^ not found in `mman`
    |
note: found an item that was configured out
   --> /home/mv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.26.4/src/sys/mman.rs:566:8
    |
566 | pub fn shm_open<P>(
    |        ^^^^^^^^
    = note: the item is gated behind the `fs` feature

Some errors have detailed explanations: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `wayland-cursor` (lib) due to 7 previous errors
warning: build failed, waiting for other jobs to finish...

The project concerned : https://github.com/mvvvv/StereoKit-rust

strangely, the other projects that rely on this one do not have the problem.

I don't see where is the line wayland-cursor-0.31.0/src/lib.rs:58:22 in your repository.

It looks like missing features flags in the specification of nix dependency in wayland-cursor, other project likely indirectly depend on nix and the features end up enabled anyway.

Yeah. I wish Cargo had a way to detect that sort of thing, since it's quite easy to inadvertently depend on feature flags enabled by another crate.

This should be fixed by a cargo update to the latest version of wayland-cursor.

Thanks