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

Slint demo can not work on WSL2 #3344

Closed
zrz4066 opened this issue Aug 25, 2023 · 4 comments
Closed

Slint demo can not work on WSL2 #3344

zrz4066 opened this issue Aug 25, 2023 · 4 comments
Labels
a:backend-winit Winit backend (mS,mO) bug Something isn't working

Comments

@zrz4066
Copy link

zrz4066 commented Aug 25, 2023

Created by cargo generate --git https://github.com/slint-ui/slint-rust-template --name myguitest

it can't work well after cargo run, the following are the error message
ice@DESKTOP-OH5PBNG:~/rust/myguitest$ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.21s
Running target/debug/myguitest
Error: Other("Winit backend failed to find a suitable renderer. Last failure was: Cannot create OpenGL context: [a1] GLXBadFBConfig")

ice@DESKTOP-OH5PBNG:~/rust/myguitest$ neofetch
.-/+oossssoo+/-. ice@DESKTOP-OH5PBNG
:+ssssssssssssssssss+: -------------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 20.04.6 LTS on Windows 10 x86_64
.ossssssssssssssssssdMMMNysssso. Kernel: 5.10.16.3-microsoft-standard-WSL2
/ssssssssssshdmmNNmmyNMMMMhssssss/ Uptime: 15 mins
+ssssssssshmydMMMMMMMNddddyssssssss+ Packages: 1254
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Shell: bash 5.0.17
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Resolution: 1904x1001
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ WM: Xfwm4
ossyNMMMNyMMhsssssssssssssshmmmhssssssso WM Theme: Default
ossyNMMMNyMMhsssssssssssssshmmmhssssssso Theme: Adwaita [GTK3]
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Icons: Adwaita [GTK3]
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Terminal: /dev/pts/1
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ CPU: Intel i5-8265U (8) @ 1.800GHz
+sssssssssdmydMMMMMMMMddddyssssssss+ GPU: Microsoft Corporation Device 008e
/ssssssssssshdmNNNNmyNMMMMhssssss/ Memory: 242MiB / 12542MiB
.ossssssssssssssssssdMMMNysssso.
-+sssssssssssssssssyyyssss+-
:+ssssssssssssssssss+:
.-/+oossssoo+/-.

@tronical tronical added bug Something isn't working a:backend-winit Winit backend (mS,mO) labels Aug 25, 2023
@tronical
Copy link
Member

You're running Xfwm4 under WSL. As far as I can tell, Xfwm4 only acts as X11 window manager (and compositor), but not as wayland compositor. That means Slint will try to connect via GLX, which also doesn't work (I suppose that part is WSL related).

At the moment WSL only works with software rendering or Wayland, but not GLX.

However, Slint should fall back to software rendering if the GLX setup fails. That seems like a bug to me.

Meanwhile, does it work if you set the SLINT_BACKEND environment variable to the value winit-software?

@tronical
Copy link
Member

tronical commented Aug 25, 2023

#2907 should have fixed this, but apparently this isn't working under WSL.

@ogoffart
Copy link
Member

the renderer-winit-software feature wasn't enabled by default in the last release (1.1.1). But it will be in the next release (1.2).

@tronical
Copy link
Member

Thanks, that explains it. @zrz4066 then your workaround is to edit Cargo.toml and change the line that says

slint = "1.0"

to read

slint = { version = "1.0", features = ["renderer-winit-software"] }

and this will not be needed anymore in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:backend-winit Winit backend (mS,mO) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants