Hands-on Rust: Chapter 3: Can't get first hello to run

Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance running Amazon Linux 2 (their customized version of RHEL 7) and Rust 1.67.1

I’m using the exact code from FirstGameFlappyAscii/hello_bterm. If I compile and run that as-is, it blows up because I don’t have Wayland/X11/etc. on this box:

 Running `target/debug/flappy`
 thread 'main' panicked at 'Failed to initialize any backend! Wayland status: NoCompositorListening X11 status: XOpenDisplayFailed', /home/bjn/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/mod.rs:719:9

The GitHub - amethyst/bracket-lib: The Roguelike Toolkit (RLTK), implemented for Rust. section on “Feature flags” says to disable default features and enable a different back-end. So first I tried this:

 $ grep feature Cargo.toml
 bracket-lib = { version = "~0.8.1", default-features = false, features = ["crossterm"] }

…but that failed with this:

 Running `target/debug/flappy`
 thread 'main' panicked at 'index out of bounds: the len is 5628 but the index is 6566', /home/bjn/.cargo/registry/src/github.com-1ecc6299db9ec823/bracket-terminal-0.8.7/src/hal/crossterm_be/main_loop.rs:229:25

And then I tried this:

 $ grep feature Cargo.toml
 bracket-lib = { version = "~0.8.1", default-features = false, features = ["curses"] }

…but that failed with this:

 Compiling bracket-terminal v0.8.7
 error[E0609]: no field `fitscreen` on type `curses::InitHints`
 --> /home/bjn/.cargo/registry/src/github.com-1ecc6299db9ec823/bracket-terminal-0.8.7/src/initializer.rs:455:29
 |
 455 |         self.platform_hints.fitscreen = fitscreen;
 |                             ^^^^^^^^^ help: a field with a similar name exists: `fullscreen`

Help? Thanks! Brent

@herbert

Eventually I discovered I can get it to work by locking bracket-lib to 0.8.1 (looks like something has changed between that and the latest 0.8.7). The Cargo.toml that works for me now has:

[dependencies]
bracket-lib = { version = "=0.8.1", default-features = false, features = ["crossterm"] }
bracket-terminal = { version = "=0.8.1", default-features = false }