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

Compile problem with wasm32 using bracket-terminal 0.8.7 #301

Open
webbiscuit opened this issue Oct 5, 2022 · 11 comments
Open

Compile problem with wasm32 using bracket-terminal 0.8.7 #301

webbiscuit opened this issue Oct 5, 2022 · 11 comments

Comments

@webbiscuit
Copy link

I'm pulling bracket-terminal into my project as a dependency and compiling for wasm:

 rustup target add wasm32-unknown-unknown
 cargo install wasm-bindgen-cli
 cargo build --release --target wasm32-unknown-unknown

I'm seeing the new errors:

error[E0432]: unresolved imports `glow::NativeFramebuffer`, `glow::NativeTexture`
 --> /home/dan/.cargo/registry/src/github.com-1ecc6299db9ec823/bracket-terminal-0.8.7/src/hal/gl_common/framebuffer.rs:3:24
  |
3 | use glow::{HasContext, NativeFramebuffer, NativeTexture};
  |                        ^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^ no `NativeTexture` in the root
  |                        |
  |                        no `NativeFramebuffer` in the root

   Compiling async-executor v1.4.1
error[E0609]: no field `fitscreen` on type `hal::wasm::InitHints`
   --> /home/dan/.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`
@thebracket
Copy link
Collaborator

Oops! I'll try and get that fixed, probably tomorrow. It looks like I missed a type alias.

@jimmykiang
Copy link

Oops! I'll try and get that fixed, probably tomorrow. It looks like I missed a type alias.

Hi, at least could you please point out which was the prior version of bracket lib that was working to generate the wasm files following the instructions from you website?

@thebracket
Copy link
Collaborator

You can change your dependency in Cargo.toml to read bracket-lib = "=0.8.1" and it should work. I'm working on a fix for this version now.

@thebracket
Copy link
Collaborator

I have a few other fixes to roll up before I release 0.8.8. In the interim, you can use the latest version with WASM by using the following as your dependency:

bracket-lib = { git = "https://github.com/amethyst/bracket-lib.git" }

It compiles now; when I've had some more coffee, I'll do a full integration test.

@webbiscuit
Copy link
Author

Thanks! I can confirm the latest unreleased version works.
@jimmykiang - the last released version that works is 0.8.5

@JonnieCache
Copy link

just confirming that my hello world example fails for me in the way described in this ticket on 0.8.7, (when following the wasm guide in the rust roguelike tutorial) but still works for me when I pin brackets-lib to master.

@bbarker
Copy link

bbarker commented May 12, 2023

If you want to pin the most recent buildable commit (according to git's CI), you can do this :

bracket-lib = { git = "https://github.com/amethyst/bracket-lib.git", rev = "851f6f08675444fb6fa088b9e67bee9fd75554c6", features = ["serde"] }

@VKUnicorn
Copy link

VKUnicorn commented Jan 7, 2024

In case you came here trying to compile Chapter 1 from "Roguelike Tutorial" you need to add
rltk = { git = "https://github.com/amethyst/bracket-lib" }
(not bracket-lib) as described here amethyst/rustrogueliketutorial#201 (comment)

@iwyatt
Copy link

iwyatt commented Jan 23, 2024

Thanks for posting the solution to the wasm build!

I was following the directions on running wasm on https://hands-on-rust.com/2021/11/06/run-your-rust-games-in-a-browser-hands-on-rust-bonus-content/ after finishing Hands-on Rust (Fantastic book, btw!) and luckily found this github issue with a fix.

Putting bracket-lib = { git = "https://github.com/amethyst/bracket-lib.git" } in my .toml worked for me to compile. There was a little confusion as the output files were going in to .wasm_help instead of wasm_help and slash vs backslash on the copied commands, but after I sorted that out, the Dungeon Crawler was running in my browser with a local python web server I ran using python3 -m http.server. I'm very excited about the possibility to self-host little proof of concept games.

Edit: got it working and hosted it on GitHub Pages. I published it to my website, and wrote a blog post about it. Thanks again for this wonderful tutorial!

@NaughtyDog6000
Copy link

@thebracket
is there any plans to release a newer version (at least the patch for wasm) so that people dont have to rely on a link to the GH repo and instead can use cargo add as you would expect. If not could you add a warning to readme / docs to state the last version that compiles wasm correctly?

@thebracket
Copy link
Collaborator

thebracket commented Feb 5, 2024 via email

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

8 participants