gfx icon indicating copy to clipboard operation
gfx copied to clipboard

build error on Solaris: no variant or associated item named `Xcb` found for enum `RawWindowHandle`

Open psumbera opened this issue 4 years ago • 8 comments

   Compiling gfx-backend-vulkan v0.6.5 (/builds/psumbera/VULKAN/gfx/src/backend/vulkan)
error[E0599]: no variant or associated item named `Xcb` found for enum `RawWindowHandle` in the current scope
   --> src/backend/vulkan/src/lib.rs:594:30
    |
594 |             RawWindowHandle::Xcb(handle)
    |                              ^^^ variant or associated item not found in `RawWindowHandle`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: could not compile `gfx-backend-vulkan`

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

Seems to be caused by:

https://github.com/gfx-rs/gfx/commit/a498b475003c03319d9d79ce2eae0c1d3f1e9813

Following seems to fix the issue:

diff --git a/src/backend/vulkan/src/lib.rs b/src/backend/vulkan/src/lib.rs
index c5f27e73..cd378eb3 100644
--- a/src/backend/vulkan/src/lib.rs
+++ b/src/backend/vulkan/src/lib.rs
@@ -586,6 +586,7 @@ impl hal::Instance<Backend> for Instance {
                 Ok(self.create_surface_from_xlib(handle.display as *mut _, handle.window))
             }
             #[cfg(all(
+                feature = "xcb",
                 unix,
                 not(target_os = "android"),
                 not(target_os = "macos"),

psumbera avatar Dec 21 '20 15:12 psumbera

We no longer have the "xcb" feature, so we can't follow your suggested fix.

However, what we should do is just mirroring RawWindowHandle feature flags when checking for Xlib. See https://github.com/rust-windowing/raw-window-handle/blob/73a41ea28907b0f261816136b1b3f39cfdd791f3/src/lib.rs#L121-L125

kvark avatar Dec 21 '20 15:12 kvark

Started the discussion about BSD configs on the rust-internals forum...

kvark avatar Dec 21 '20 16:12 kvark

Ok. Shall I wait with submitting following fix?

index c5f27e73..22afacbe 100644
--- a/src/backend/vulkan/src/lib.rs
+++ b/src/backend/vulkan/src/lib.rs
@@ -589,7 +589,8 @@ impl hal::Instance<Backend> for Instance {
                 unix,
                 not(target_os = "android"),
                 not(target_os = "macos"),
-                not(target_os = "ios")
+                not(target_os = "ios"),
+                not(target_os = "solaris"),
             ))]
             RawWindowHandle::Xcb(handle)
                 if self

psumbera avatar Dec 21 '20 17:12 psumbera

if you can instead make a PR with the configuration used by RawWindowHandle code, that would be great!

kvark avatar Dec 21 '20 17:12 kvark

if you can instead make a PR with the configuration used by RawWindowHandle code, that would be great!

Sorry I think I'm still missing what change I should prepare. Can you please more elaborate what and where I should put.

psumbera avatar Dec 21 '20 17:12 psumbera

I believe the match arms for RWH in gfx-rs have to be gated the same way as they are in RWH definition itself, see the link I provided earlier. For Xcb in particular, this would be:

        cfg(any(
            target_os = "linux",
            target_os = "dragonfly",
            target_os = "freebsd",
            target_os = "netbsd",
            target_os = "openbsd"
        ))

kvark avatar Dec 21 '20 18:12 kvark

There is actually one year old pull request for that. Can you please have look at it?

https://github.com/rust-windowing/raw-window-handle/pull/44

psumbera avatar Dec 22 '20 12:12 psumbera

Thank you! Let's see how they respond now that you pinged them.

kvark avatar Dec 22 '20 14:12 kvark

@psumbera: Is this still an issue we should resolve here?

ErichDonGubler avatar Jun 20 '23 21:06 ErichDonGubler

No, we can close the issue now.

psumbera avatar Jun 21 '23 07:06 psumbera