slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.94k stars 568 forks source link

vscode LSP panic in winit with WSL: `(libXcursor.so.1: cannot open shared object file: No such file or directory)` #4331

Closed MrDwarf7 closed 8 months ago

MrDwarf7 commented 8 months ago

Yes, you're welcome, thank you. 🦀

Step 1. Create Slint project from rust-slint-template

Step 2 (Optional). Cry a little bit because there's not a simpler way to get Slint support in Neovim via Arch.

Step 3. Use VsCode due to native extension support, open Ui folder and observe the beauty of correct syntactical highlighting.

Step 4. Compile a binary using cargo build --release --target "x86_64-pc-windows-gnu" Open compiled Windows 11 64bit .exe from within the WSL distro (Crossing the Windows/WSL barrier). Close compiled.

Step 5. Realize the text is tiny on your giant Samsung Neo G9 monitor and head over to the Ui file to add a font-size with 20.

Step 6. Get an error because you're a newbie to Rust language and haven't yet read the Slint document because you're too eager to play around and consider that Ui can't be that hard if you've spent the last 10 months choking on JavaScript.

Step 7. Using the Vs-Code Neovim plugin, and a hand-crafted variety of highly personalized key bindings unique to only my experience - Hit Ctrl+K to attempt to replicate hovering with a mouse and see what the error is. (Silently hoping it's not "Can't define null on undefined").

Step 8. Not profit. Slint crashes and prompts me to open an issue, which I do.

Step 9. Begin having an existential crisis as I've caught up to the story in real time, and I paste in the crash log from my terminal in VsCode, the inferior editor. It reads:

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.4/src/platform_impl/linux/mod.rs:787:62:
called `Result::unwrap()` on an `Err` value: LibraryOpenError(OpenError { kind: Library, detail: "opening library failed (libXcursor.so.1: cannot open shared object file: No such file or directory); opening library failed (libXcursor.so: cannot open shared object file: No such file or directory)" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Info  - 3:18:18 AM] Connection to server got closed. Server will restart.
true
The Slint Language Server crashed. This is a bug.
Please open an issue on https://github.com/slint-ui/slint/issues 

Step 10. Complete the convoluted and (hopefully amusing) re-count of my tragic experience leading up to a Rust-related LSP crash.

Observe! I present the offending code block. The stock slint rust template with a slightly syntactically incorrect piece of code.

import { Button, VerticalBox } from "std-widgets.slint";
export component AppWindow inherits Window {
    in-out property<int> counter: 42;

    callback request-increase-value();

    VerticalBox {
        Text {
            font-size: "16";
            text: "Counter: \{root.counter}";
        }
        Button {
            text: "Increase value";
            clicked => {
                root.request-increase-value();
            }
        }
    }
}

Using AUR package, Named: mingw-w64-rust

Remaining details from

yay -Si  mingw-w64-rust

Repository : aur Name : mingw-w64-rust Version : 1.75.0-1 Description : Systems programming language focused on safety, speed and concurrency (mingw-w64) URL : https://www.rust-lang.org Licenses : Apache custom MIT Groups : None Provides : None Depends On : gcc-libs curl libgit2 mingw-w64-gcc>=10.1.0 Optional Deps : mingw-w64-wine Make Deps : gdb ninja libffi perl python nodejs procps-ng cmake Check Deps : None Conflicts With : None Replaces : None AUR URL : https://aur.archlinux.org/packages/mingw-w64-rust First Submitted : Wed 14 Feb 2018 03:00:51 AM AEDT Keywords : mingw-w64 rust Last Modified : Mon 01 Jan 2024 03:06:08 PM AEDT Maintainer : pingplug Popularity : 0.000000 Votes : 3 Out-of-date : No

ogoffart commented 8 months ago

Step 2 (Optional). Cry a little bit because there's not a simpler way to get Slint support in Neovim via Arch.

Not a neovim user myself, but did you try the steps explained here: https://github.com/slint-ui/slint/tree/master/editors#neovim

LibraryOpenError(OpenError { kind: Library, detail: "opening library failed (libXcursor.so.1: cannot open shared object file: No such file or directory); opening library failed (libXcursor.so: cannot open shared object file: No such file or directory)" })

This is a panic in winit (the library Slint uses to handle windows) and it says it can't open a required shared library. Arguably, winit should try to report the user better than panicking. But the fix here is to install the libXcursor library.

ogoffart commented 8 months ago

Similar to https://github.com/slint-ui/slint/issues/4185, the panic should be fixed in winit now, and if it remains a panic in Slint, it is #204