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

Wayland support? #98

Open
ghost opened this issue Dec 27, 2020 · 12 comments
Open

Wayland support? #98

ghost opened this issue Dec 27, 2020 · 12 comments
Labels
type:question Further information is requested

Comments

@ghost
Copy link

ghost commented Dec 27, 2020

Hi there!

First of all, thank you for developing RX. I've been using it for a while now and like it very much.

I am using Sway which uses Wayland instead of X11. I know there is xorg-server-xwayland package available but would like to ask whether Wayland will be natively supported or not?
When I try to run RX, it gives me this error:

thread 'main' panicked at 'GLFW Error: X11: Failed to open display :0', /home/makkusu/.cargo/registry/src/github.com-1ecc6299db9ec823/glfw-0.34.0/src/lib.rs:422:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I suppose the program complains about X11 missing from the system.
Unfortunately, I am not an experienced developer at all, therefore I cannot implement support for Wayland by myself and create a pull request right now.

Kind regards,
Makkusu

@cloudhead
Copy link
Owner

Hey, glad you are enjoying Rx! The underlying library I use to create the graphics context has experimental Wayland support, so it should be possible. I'm looking into it now.

@cloudhead cloudhead added the type:question Further information is requested label Dec 27, 2020
@cloudhead
Copy link
Owner

Hey, it looks like a few people are using Rx on Wayland already. How are you running Rx? From source or from the AppImage? I think if you have glfw-wayland installed, then it should work with wayland, unless the AppImage bundled the X11 version in (need to check).

@ghost
Copy link
Author

ghost commented Dec 27, 2020

Hi there!

I run Rx from command line with "rx &". For installation I've used package from AUR. Tried both ordinary rx package and rx-bin, none of them seems to work without X11. I have installed glfw-wayland package as well but it doesn't solve the problem. The previously mentioned error pops up.
I suppose my Wayland setup might be misconfigured in some ways, therefore I will continue investigating the issue.

Just in case some technical information regarding software I use:

  • Manjaro Linux
  • Sway WM

@cloudhead
Copy link
Owner

I think it may be that people are running x11 within wayland 🤔, ie. non-natively.

To run it natively, from my understanding, would require building glfw-rs (https://github.com/PistonDevelopers/glfw-rs) with wayland support.

One thing you could try though is to build rx from source, using rust (perhaps via the rustup package). You simply need to run cargo install --path . then.

@ghost
Copy link
Author

ghost commented Jan 1, 2021

Thanks! I will give it a try this evening.
To my assumption, package from AUR might be somewhat built for X11 only(I suppose), therefore it does not recognize Wayland at all. 🤔

@ghost
Copy link
Author

ghost commented Mar 24, 2021

Hi there!

It's been a while since I tried rx. I've switched the system but the base remains the same: Wayland. I encountered yet another problem with compilation process:

error: failed to run custom build command for `glfw-sys v3.3.2`

Caused by:
  process didn't exit successfully: `/home/makkusu/Temporary/rx/target/release/build/glfw-sys-174ae65fb7f8337d/build-script-build` (exit code: 101)
  --- stdout
  running: "cmake" "/home/makkusu/.cargo/registry/src/github.com-1ecc6299db9ec823/glfw-sys-3.3.2/." "-DGLFW_BUILD_EXAMPLES=OFF" "-DGLFW_BUILD_TESTS=OFF" "-DGLFW_BUILD_DOCS=OFF" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_PREFIX=/home/makkusu/Temporary/rx/target/release/build/glfw-sys-19cb04e37a8af78d/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Release"
  -- Using X11 for window creation
  -- Configuring incomplete, errors occurred!
  See also "/home/makkusu/Temporary/rx/target/release/build/glfw-sys-19cb04e37a8af78d/out/build/CMakeFiles/CMakeOutput.log".

  --- stderr
  CMake Error at /usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
    Could NOT find X11 (missing: X11_X11_INCLUDE_PATH X11_X11_LIB)
  Call Stack (most recent call first):
    /usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
    /usr/share/cmake-3.19/Modules/FindX11.cmake:437 (find_package_handle_standard_args)
    CMakeLists.txt:196 (find_package)


  thread 'main' panicked at '
  command did not execute successfully, got: exit code: 1

  build script failed, must exit now', /home/makkusu/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.45/src/lib.rs:894:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `rx v0.4.0 (/home/makkusu/Temporary/rx)`, intermediate artifacts can be found at `/home/makkusu/Temporary/rx/target`

I can clearly see the core of the problem:

-- Using X11 for window creation

It looks like glfw-sys package uses X11 by default or there is a custom setting which enabled X11 by default.
Is there any way to specify whether the dependency should use Wayland or X11? 🤔

@ghost
Copy link
Author

ghost commented Mar 24, 2021

I found that Wayland can be enabled through this command when building glfw (Taken from this issue)

cmake -DGLFW_USE_WAYLAND=ON ..

Is there any way to specify that variable in Cargo.toml or Cargo.lock?

@cloudhead
Copy link
Owner

Could you try installing GLFW via your distribution's package manager and then trying to build again? I'm wondering if it might be able to pickup the installed glfw that way instead of building it.

@i509VCB
Copy link

i509VCB commented Apr 3, 2022

One alternative that could be considered is using winit instead of glfw.

Winit has out of the box Wayland support and will work with OpenGL.

@cloudhead
Copy link
Owner

One alternative that could be considered is using winit instead of glfw.

Winit has out of the box Wayland support and will work with OpenGL.

Yeah, I'd be down to explore this again. Rx used to run on winit, but I switched to glfw due to bugs and limitations in winit. This was a few years ago though, so maybe the situation has changed.

@hendursaga
Copy link

I'm using the Sway window manager without XWayland support perfectly fine. I'm on Debian Stable, too, so it works even with "outdated" packages, too.

@cloudhead
Copy link
Owner

This landed a while ago, so we'll be able to support it officially: PistonDevelopers/glfw-rs@66c263b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants