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

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

Open
Bronzdragon opened this issue Aug 18, 2023 · 2 comments
Open

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

Bronzdragon opened this issue Aug 18, 2023 · 2 comments

Comments

@Bronzdragon
Copy link

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.

@sanbox-irl
Copy link
Member

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?

@Bronzdragon
Copy link
Author

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",
] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants