imgui-winit-support does not build on Linux systems.
Description
When a new project is started, and the imgui-winit-support crate is added, the project fails to build.
To Reproduce
- Create a new project. E.g.
cargo new example; cd example - Add the crate
cargo add imgui-winit-support - 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.
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?
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",
] }
Going to close this as we've since updated winit (and then winit updated...again)