wasmi-labs / wasmi

WebAssembly (Wasm) interpreter.
https://wasmi-labs.github.io/wasmi/
Apache License 2.0
1.56k stars 281 forks source link

Failed to install `wasmi_cli`: `raw mutable pointers are not allowed in statics` (Rust 1.77.1) #1091

Closed MagicalTux closed 3 months ago

MagicalTux commented 3 months ago

I tried to run cargo install wasmi_cli to test this lib but got the following:

error[E0658]: raw mutable pointers are not allowed in statics
   --> /home/magicaltux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmi-0.33.0/src/engine/executor/cache.rs:273:37
    |
273 |     unsafe { NonNull::new_unchecked(ptr::addr_of_mut!(ZERO_CELL)) }
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
    = note: this error originates in the macro `ptr::addr_of_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0658`.
error: could not compile `wasmi` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Robbepop commented 3 months ago

Whlith which Rust compiler version did you try.to install Wasmi? I have never seen this error before during development. Maybe Wasmi CI should be extended to cover certain missing specs.

MagicalTux commented 3 months ago

After some testing this seems to be linked to rustc version

By default I was using rustc 1.77.1 (7cf61ebde 2024-03-27) (gentoo) but upgrading to 1.79.0 allowed me to compile wasmi_cli successfully

Robbepop commented 3 months ago

Thanks a lot for the response and the bug report. I will have to see why this occurs in v1.77.1 to eventually close this issue.

Robbepop commented 3 months ago

Failure in Rust 1.77.1 (and previous versions) occurs while Rust 1.78 compiles fine is due to this change: https://github.com/rust-lang/rust/pull/117614/

I was not aware how new this change actually was. Since Wasmi is pinned to Rust 1.77 we probably want to address this to keep Wasmi compilable with Rust 1.77.