Skip to content

add warning messages when wayland fails to load due to shared libraries#503

Open
Adjective-Object wants to merge 2 commits intonot-fl3:masterfrom
Adjective-Object:eprint-on-load-fail
Open

add warning messages when wayland fails to load due to shared libraries#503
Adjective-Object wants to merge 2 commits intonot-fl3:masterfrom
Adjective-Object:eprint-on-load-fail

Conversation

@Adjective-Object
Copy link
Contributor

While trying to debug why macroquad was failing to run in a container, I ran into a variation of this issue, which turned out to just be that I was missing libwayland-egl in the container.

This would have been more straightforward to debug if miniquad printed the reason it failed to initialize when it fails, which it does in a few other scenarios.

This change adds eprintln! warnings when a required library is missing

@Adjective-Object
Copy link
Contributor Author

For reference I wasn't able to fully test this -- it looks like there's some unrelated failing tests in cargo test?
image

let client = LibWaylandClient::try_load()?;
let egl = LibWaylandEgl::try_load()?;
let xkb = LibXkbCommon::try_load()?;
let client = eprint_iferr("libwayland-client", LibWaylandClient::try_load())?;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe try_load could return a better message instead of handling this here?

Copy link
Contributor Author

@Adjective-Object Adjective-Object Dec 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for sure, I can handle the errors in the try_load() fns

@Adjective-Object
Copy link
Contributor Author

Verified that the latest round of changes i pushed still works by running within a docker container with missing dependencies:

warning: `game` (bin "cool_game") generated 2 warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.62s
     Running `target/debug/cool_game`
failed loading libwayland-egl: failed opening library libwayland-egl.so.1
Failed to initialize through wayland! Trying X11 instead
Authorization required, but no authorization protocol specified

thread 'main' panicked at /workspaces/miniquad/src/native/linux_x11.rs:585:13:
XOpenDisplay() failed!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants