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

thread 'main' panicked at 'attempted to leave type std::mem::ManuallyDrop<xlib::Xlib> uninitialized, which is invalid' #5

Open
laszukdawid opened this issue Dec 28, 2021 · 1 comment

Comments

@laszukdawid
Copy link

I'm new to Rust development and thought that modifying snake would be a nice starting project.

Just cloned repo, downloaded dependencies, built it and tried to run. There wasn't any error on cargo run and cargo build --release, only a few formatting warnings. When trying to run produced binary, I'm getting the error below. Any chance you could help figure out the issue?

By the trace it seems the problem is with Xlib. Does it need to be in specific version? Is it even Ok for linux?

System: Ubuntu 20.04 (Linux meland 5.11.0-43-generic #47~20.04.2-Ubuntu SMP Mon Dec 13 11:06:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux)
Cargo: cargo 1.54.0 (5ae8d74b3 2021-06-22)

Backtrace:

kretyn@meland:~/projects/rsnake$ RUST_BACKTRACE=1 ./target/release/rsnake 
thread 'main' panicked at 'attempted to leave type `std::mem::ManuallyDrop<xlib::Xlib>` uninitialized, which is invalid', /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/mem/mod.rs:660:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:50:5
   3: x11_dl::xlib::Xlib::open
   4: winit::platform::platform::x11::xdisplay::XConnection::new
   5: std::sync::once::Once::call_once::{{closure}}
   6: std::sync::once::Once::call_inner
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/sync/once.rs:418:21
   7: winit::platform::platform::EventsLoop::new_x11
   8: winit::platform::platform::EventsLoop::new
   9: winit::EventsLoop::new
  10: glutin_window::GlutinWindow::new
  11: <glutin_window::GlutinWindow as window::BuildFromWindowSettings>::build_from_window_settings
  12: <piston_window::PistonWindow<W> as window::BuildFromWindowSettings>::build_from_window_settings
  13: rsnake::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
kretyn@meland:~/projects/rsnake$ 
@laszukdawid
Copy link
Author

I'm new to Rust and piston_window so I'm not really sure what is the problem specifically. My guess is Xlib had some API update and that is incompatible with older version of piston_window (this package uses 0.85.0). Updating to the newest version and fixing some code has fixed the issue. Here's the commit that introduces fix laszukdawid@5438ef5.

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

No branches or pull requests

1 participant