sunjay / turtle

Create Animated Drawings in Rust
http://turtle.rs
Mozilla Public License 2.0
562 stars 53 forks source link

Library libwayland-egl.so could not be loaded #94

Closed antmoth closed 5 years ago

antmoth commented 6 years ago

I was trying to work through the tutorial at turtle.rs. I wrote out and compiled the "draw a circle" tutorial and I received this error:

    Finished dev [unoptimized + debuginfo] target(s) in 0.15s          
     Running `target/debug/turtle-toys`                                
thread 'main' panicked at 'Library libwayland-egl.so could not be loaded.', libcore/option.rs:1000:5                                           
note: Run with `RUST_BACKTRACE=1` for a backtrace.                     

A couple of existing issues on other projects suggest that the solution is to update the versions of the dependencies that interact with wayland, which in this case I think would be piston_window. (The problem is likely that I have these installed, but not the exact filename it is looking for:

/usr/lib/libwayland-egl.so.1                                            
/usr/lib/libwayland-egl.so.1.0.0                                        
/usr/lib64/libwayland-egl.so.1                                          
/usr/lib64/libwayland-egl.so.1.0.0   

)

I did first check that I had all relevant libs installed, and tried symlinking the path as well.

sunjay commented 6 years ago

Hi! Thank you for reporting this! Sorry it isn't working on your platform. Could you provide more information about the system you're working on?

The output of rustc --version --verbose would be great as well. :)

sunjay commented 6 years ago

This issue also seems relevant. Let me know if anything helps!

https://github.com/tensor-programming/snake-tutorial/issues/1

antmoth commented 6 years ago

I am running Fedora 28. I believe I'm using Wayland. rustc --version --verbose:

rustc 1.30.0-nightly (d767ee116 2018-08-15)
binary: rustc
commit-hash: d767ee11616390d128853a06f5addb619e79213f
commit-date: 2018-08-15
host: x86_64-unknown-linux-gnu
release: 1.30.0-nightly
LLVM version: 7.0

I was honestly just going to try updating the dependency and see if that fixed it without breaking anything else, but figured I should file an issue as a first step.

antmoth commented 6 years ago

It looks like updating the dependency creates some effort, because piston_window added a new type Hat to the Button enum. I'm up for trying to add Hat if it ends up fixing the Wayland lib issue.

sunjay commented 6 years ago

That would be great! Thank you! Please let me know if you run into anything or get stuck.

I mentioned yesterday that there was this comment that might provide some hints about updating piston: https://github.com/sunjay/turtle/issues/67#issuecomment-403238201

Let me know if you need anymore information about anything.

Nice to meet you yesterday and thanks for helping out!

sunjay commented 6 years ago

Hi @estelendur! Is there anything I can do to help you resolve this? Have you had a chance to take a look?

Thanks! :smile:

antmoth commented 6 years ago

Hi! I'm sorry, I haven't had much time to code outside of work. I did get pointed to a way to fix the Wayland-specific breakage by adding an environment variable:

    // Disable Wayland support. It doesn't take advantage of window decorations provided by the
   // compositor which is annoying for windowed mode.
   env::set_var("WAYLAND_DISPLAY", "wayland-999");

I'm not sure if there's a good way to set this in the library?

antmoth commented 6 years ago

ack, learning github still and clicking the wrong buttons

sunjay commented 6 years ago

That's interesting! Could you try setting that in the code before we create the window? Does it solve the crash? What does the window end up looking like?

We create the window in the following code. You would need to add that line just before these ones.

https://github.com/sunjay/turtle/blob/05a5fa118b154c5504bfc9fb770081c2846dd80d/src/renderer.rs#L73-L86

Please include the comments you posted with that line of code and note that this is something we need to have until we upgrade to the latest piston and verify that it doesn't break on your platform. (please list your particular platform in the comment)

I am okay with this change if it solves the issue. Please open a PR if you find that it works. I'll test it locally here too to see if it breaks anything. We can always do a platform specific cfg to only do that when needed.

Do you forsee any problems that this might cause?

sunjay commented 5 years ago

Hi @estelendur! Sorry for taking so long to get around to this issue. Life has been busy!

I went and updated piston to the latest version. They seem to have made a lot of improvements. Could you test the latest master branch of turtle on your machine to see if it works?

  1. Pull the master branch of turtle: https://github.com/sunjay/turtle
  2. cargo run --example circle
  3. cargo run --example maze

Let me know if everything looks good. Thanks! :smile:

antmoth commented 5 years ago

I'm sorry I didn't get around to this either :( everything works great now!

sunjay commented 5 years ago

Awesome! I'm very glad to hear that it works! :tada:

I'm sorry I didn't get around to this either :(

No problem at all. Life is busy. :)