slint icon indicating copy to clipboard operation
slint copied to clipboard

LinuxKMS: better error message than "Error presenting fb: permission denied"

Open jasper-clarke opened this issue 1 year ago • 3 comments

I was originally having troubles in issue #3412 but resolved it by setting up Nix-ld.

However now when i press the Show Preview code lense the slint server crashes.

Using Skia Software renderer
Rendering at 1920x1080
thread 'main' panicked at tools/lsp/preview/native.rs:83:40:
called `Result::unwrap()` on an `Err` value: OtherError("Error presenting fb: permission denied")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Info  - 9:52:00 AM] Connection to server got closed. Server will restart.
true
The Slint Language Server crashed. This is a bug.

jasper-clarke avatar Feb 14 '24 22:02 jasper-clarke

Looks like the next missing dependency: The preview needs a few more things to run than the "normal" LSP:-/

Try running ldd on the slint-lsp binary in your extension directory: Does it report anything missing?

hunger avatar Feb 15 '24 09:02 hunger

Ldd outputs the below:

ldd slint-lsp-x86_64-unknown-linux-gnu

	linux-vdso.so.1 (0x00007ffcc15f5000)
	libxkbcommon.so.0 => not found
	libudev.so.1 => not found
	libinput.so.10 => not found
	libgbm.so.1 => not found
	libstdc++.so.6 => not found
	libfontconfig.so.1 => not found
	libfreetype.so.6 => not found
	libdl.so.2 => /nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib/libdl.so.2 (0x00007ff60e03c000)
	libgcc_s.so.1 => /nix/store/f5my15qww10swmf66ns13l24yp6j5dmq-xgcc-13.2.0-libgcc/lib/libgcc_s.so.1 (0x00007ff60e017000)
	libpthread.so.0 => /nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib/libpthread.so.0 (0x00007ff60e012000)
	libm.so.6 => /nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib/libm.so.6 (0x00007ff60df2e000)
	libc.so.6 => /nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib/libc.so.6 (0x00007ff60bc17000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib64/ld-linux-x86-64.so.2 (0x00007ff60e045000)

What does not make sense is i have all those not found dependencies outlined in nix-ld and i can use sudo find and locate all those .so files

jasper-clarke avatar Feb 15 '24 09:02 jasper-clarke

Thanks for reporting the problem

We have two problem:

  1. the lsp is panicking because we unwrap the error from slint::run_event_loop instead of properly reporting it as an error and maybe use a fallback. This is tracked in https://github.com/slint-ui/slint/issues/204

  2. You have a problem that you can't connect to the display. This error comes from the linuxkms backend. The linuxkms is used because the winit backend failled to initialize, probably because the X11 DISPLAY or equivalent wayland env variable were not properly set. And you probably don't want anyway that linuxkms backend takes your whole screen

Since the LSP Preview bug is already tracked by #204, the actual problem seems to be a configuration problem.

I'm just going to keep this bug open because I think the linuxkms error is less than ideal.

  • It should ideally error out before, while creating the backend, so that the backend selector can fallback or display all the backend's errors. I don't know it that's possible thougyh
  • It should tell more info than just "Error presenting fb: permission denied". Permission denied to what? What is it even trying to do.

ogoffart avatar Feb 15 '24 09:02 ogoffart