wasm-pack icon indicating copy to clipboard operation
wasm-pack copied to clipboard

locals exceed maximum error with wasm-pack on big match

Open Tpt opened this issue 3 years ago • 3 comments

🐛 Bug description

Compiling oxigraph JS with wasm-pack fails with the following error:

error: failed to parse input file as wasm

Caused by:
    locals exceed maximum (at offset 10564186)

Here is a failing CI build and a working CI build from earlier the same day Both builds use wasm-pack 1.9.1 and Rust 1.50 stable.

This error is caused by the big match introduced in quick-xml 0.21.

🤔 Expected Behavior

Proper compilation

👟 Steps to reproduce

git clone https://github.com/oxigraph/oxigraph
cd oxigraph/js
wasm-pack build --dev --target nodejs 

🌍 Your environment

Include the relevant details of your environment. wasm-pack version: 0.9.1 rustc version: 1.50

Tpt avatar Feb 23 '21 17:02 Tpt

I have the same problem, is there a quick fix patch

oovm avatar Mar 05 '22 07:03 oovm

It seems that too many temporary variables are generated, the limit is at: https://github.com/bytecodealliance/wasm-tools/blob/b5c3d98e40590512a3b12470ef358d5c7b983b15/crates/wasmparser/src/limits.rs#L29

Maybe this upper limit is fully considered, which too many variables caused by excessive inline.

oovm avatar Mar 14 '22 03:03 oovm