imgui-rs icon indicating copy to clipboard operation
imgui-rs copied to clipboard

imgui-winit-support does not build on Linux systems.

Open Bronzdragon opened this issue 2 years ago • 2 comments

Description When a new project is started, and the imgui-winit-support crate is added, the project fails to build.

To Reproduce

  1. Create a new project. E.g. cargo new example; cd example
  2. Add the crate cargo add imgui-winit-support
  3. Build project. cargo build.

Expected behavior I expect the project to build without errors.

Output

$ cargo build
   Compiling smallvec v1.11.0
   Compiling winit v0.27.5
error: Please select a feature to build for unix: `x11`, `wayland`
  --> /home/walter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.27.5/src/platform_impl/linux/mod.rs:10:1
   |
10 | compile_error!("Please select a feature to build for unix: `x11`, `wayland`");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ...

There are additional errors after this, but I don't believe they're relevant. I've attached it here: compilation_output.txt

Please describe your environment

  • imgui-rs v 0.11.0
  • Fedora Linux 38
  • rustc 1.71.1 (eb26296b5 2023-08-03)

Other information The imgui-winit-support crate specifies that the default features should not be used. On Linux, this includes both X11 and Wayland support. I believe this is why imgui-rs won't build on Linux.

Bronzdragon avatar Aug 18 '23 06:08 Bronzdragon

I'm a gamedev windows monkey, so i'm not totally certain of the Linux windowing landscape. This is a large oversight in my knowledge.

We do seem to be running and testing just fine on CI though -- any hints why that might be different?

sanbox-irl avatar Sep 18 '23 13:09 sanbox-irl

It took me a while to figure out, but imgui-winit-support isn't using the latest winit version.

On Linux, you must build winit with the x11 or wayland feature (depending on which protocol you use). To specify flags you need to match versions (otherwise it builds/uses two separate winit versions). This threw me for a loop for a long time.

I don't see how these features are selected, but if you don't specify them, imgui-rs won't build.

winit = { version = "0.27.5", features = [
    "x11",
    "wayland",
] }

Bronzdragon avatar Sep 21 '23 05:09 Bronzdragon

Going to close this as we've since updated winit (and then winit updated...again)

sanbox-irl avatar May 21 '24 13:05 sanbox-irl