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

Screeps code doesn't run - CompileError: WebAssembly.Module() [...] Invalid Opcode (enable with --experimental-wasm-se) @+70767 #42

Closed
Octaeon opened this issue Jun 11, 2023 · 1 comment

Comments

@Octaeon
Copy link

Octaeon commented Jun 11, 2023

To be honest, Web Assembly honestly seems like black magic to me and I hoped I wouldn't have to mess with it and just code in Rust, but as it stands, I couldn't even get the example code from https://github.com/rustyscreeps/screeps-starter-rust to work. The error messages vary between ticks for some reason, but the stack trace always ends at the code
const wasmModule = new WebAssembly.Module(bytes);

I googled a bit and it seems like the problem is that WebAssembly can't parse the binary data. As per the error message, I tried to add --experimental-wasm-se to the extra_options = [] in [build] in screeps.toml, but when doing that, the code isn't even compiled when running the command cargo screeps deploy.

For the reference, here is the entire error message from screeps:

caught exception: CompileError: WebAssembly.Module(): Compiling wasm function #55:core::num::flt2dec::strategy::grisu::format_exa... failed: Invalid opcode (enable with --experimental-wasm-se) @+43788
at screeps-starter-rust:410:20
at screeps-starter-rust:416:3
at Object.exports.evalCode (:15851:76)
at Object.requireFn (:46524:28)
at Object.module.exports.loop (main:28:27)
at __mainLoop:1:52
at __mainLoop:2:3
at Object.exports.evalCode (:15851:76)
at Object.exports.run (:46474:24)

I haven't changed anything in the code itself or the configuration, apart from changing the name of the destination directory from default to rust-screeps to compare the differences between my new and old code.

@LeonMatthes
Copy link

I'm not a developer of cargo-screeps, but encountered the same issue.
See rustyscreeps/screeps-game-api#391 for a workaround.

@shanemadden shanemadden closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2024
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

3 participants