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

WASM panicked at 'misaligned pointer dereference... #944

Closed
trevyn opened this issue Apr 8, 2023 · 6 comments · Fixed by ealmloff/sledgehammer_bindgen#3 or #959
Closed

WASM panicked at 'misaligned pointer dereference... #944

trevyn opened this issue Apr 8, 2023 · 6 comments · Fixed by ealmloff/sledgehammer_bindgen#3 or #959

Comments

@trevyn
Copy link
Contributor

trevyn commented Apr 8, 2023

Affects debug builds on Rust nightly, due to rust-lang/rust#98112

dioxus create + dioxus serve = console panicked at 'misaligned pointer dereference: address must be a multiple of 0x4 but is 0x113829', /Users/e/.cargo/git/checkouts/dioxus-1e619ce595d3799d/7c9295a/packages/interpreter/src/sledgehammer_bindings.rs:5:1

@gmorenz
Copy link
Contributor

gmorenz commented May 31, 2023

Note that this is about to hit stable in 1.70

rust-lang/blog.rust-lang.org#1110 (comment)

@dxps
Copy link
Contributor

dxps commented Jun 22, 2023

I'm currently getting it in the recently released stable 1.70. 🤔
So, I guess I'll have to use the latest (master, not release) version of Dioxus. Lemme see ...

@ealmloff
Copy link
Member

@dxps

The released version of Dioxus should have this fix. You may need to run cargo update to get the fix.

Sidenote:
The patch section is useful when updating a dependency along with the other libraries in your project that use it (like dioxus-hooks)

@dxps
Copy link
Contributor

dxps commented Jun 22, 2023

@Demonthos Thanks for the feedback, but which released version of Dioxus?
Currently I see that v0.3.2 exists.
cargo update shows these Dioxus related packages updates:

    Updating dioxus-hooks v0.3.0 -> v0.3.1
    Updating dioxus-interpreter-js v0.3.1 -> v0.3.3

And if I'm using cargo's [patch] feature, how that helps, please?

Concretely speaking, as stated here, I tried with:

dioxus = { git = "https://github.com/DioxusLabs/dioxus.git" }
dioxus-web = { git = "https://github.com/DioxusLabs/dioxus.git" }
dioxus-router = { git = "https://github.com/DioxusLabs/dioxus.git", features = [ "web" ] }

which would work. Now I'd either wait for dioxus-use-storage dependency to get updated or create a PR for it.

@ealmloff
Copy link
Member

The release that fixed this issue was https://crates.io/crates/sledgehammer_bindgen/0.2.2 which was bumped by https://crates.io/crates/dioxus-interpreter-js/0.3.3.

The patch section should be as simple as:

[patch]
dioxus = { git = "https://github.com/DioxusLabs/dioxus.git" }
dioxus-web = { git = "https://github.com/DioxusLabs/dioxus.git" }
dioxus-router = { git = "https://github.com/DioxusLabs/dioxus.git", features = [ "web" ] }

@dxps
Copy link
Contributor

dxps commented Jun 22, 2023

Right. Initially I was declaring these in as standard [dependencies].

I guess what solved the case meanwhile is the cargo update.
I also had to reinstall the cli from git: cargo install --git https://github.com/DioxusLabs/cli
otherwise the following error was thrown by dioxus serve:

[INFO] 👑 Build done.
[WARN] failed to parse `name` custom section Invalid name type (at offset 62727248)
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: 

it looks like the Rust project used to create this wasm file was linked against
version of wasm-bindgen that uses a different bindgen format than this binary:

  rust wasm file schema version: 0.2.87
     this binary schema version: 0.2.85

Currently the bindgen format is unstable enough that these two schema versions
must exactly match. You can accomplish this by either updating the wasm-bindgen
dependency or this binary.

You should be able to update the wasm-bindgen dependency with:

    cargo update -p wasm-bindgen

or you can update the binary with

    cargo install -f wasm-bindgen-cli

if this warning fails to go away though and you're not sure what to do feel free
to open an issue at https://github.com/rustwasm/wasm-bindgen/issues!
', src/builder.rs:133:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: 🚫 Serving project failed: Build Failed: Bindgen build failed! 
This is probably due to the Bindgen version, dioxus-cli using `0.2.81` Bindgen crate.
…/frontend on  main [!+] took 41s❯ 

I can confirm it's all working again! 🥳

As always, really appreciate your quick feedback @Demonthos! 🙏
I feel I don't have to struggle by myself with various something esoteric-like errors. 😊

dxps added a commit to dxps/fullstack-rust-axum-dioxus-rwa that referenced this issue Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants