bjnord

bjnord

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

First Post!

bjnord

bjnord

@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 }

Popular Prag Prog topics Top

belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
New
Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New
jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New
swlaschin
The book has the same “Problem space/Solution space” diagram on page 18 as is on page 17. The correct Problem/Solution space diagrams ar...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
Charles
In general, the book isn’t yet updated for Phoenix version 1.6. On page 18 of the book, the authors indicate that an auto generated of ro...
New
oaklandgit
Hi, I completed chapter 6 but am getting the following error when running: thread 'main' panicked at 'Failed to load texture: IoError(O...
New
Keton
When running the program in chapter 8, “Implementing Combat”, the printout Health before attack was never printed so I assumed something ...
New

Other popular topics Top

Devtalk
Reading something? Working on something? Planning something? Changing jobs even!? If you’re up for sharing, please let us know what you’...
1017 16927 374
New
Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
New
brentjanderson
Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
New
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New

Latest in PragProg

View all threads ❯