Jiang Xuan
Jiang Xuan

Reputation: 98

: wasm validation error: at offset 8: binary version 0x1 does not match expected version 0xd index.html:31:24

When I compile C code to wasm using emcc, I get this error information in firefox javascript console:

: wasm validation error: at offset 8: binary version 0x1 does not match expected version 0xd  index.html:31:24

I don't know what lead to this error. Could you please explain it to me?

Upvotes: 2

Views: 1493

Answers (2)

Mihai Manole
Mihai Manole

Reputation: 195

I met the reversed problem and I fixed very fast in JS: After file fetching I got the buffer to whom I did:

new Int32Array(buffer​,4,4)[0]=1 //or 13 in your case

This solution is only for this​ transition which changes​ only the version number but not the structure.

Upvotes: 0

JF Bastien
JF Bastien

Reputation: 6873

I answered your question on github already, reposting here.


I am China boy is not good at english, please don't keep in mind if i said something wrong.

Your language is perfectly fine, no need to apologize! Many of us are also non-native English speakers 😄


I believe the problem you're running into is that WebAssembly is moving to version 1. Older toolchains and browsers expected version 0xD as a pre-release thing. They now expect version 0x1.

You're therefore hitting the transition period between pre-release and initial-release. Your browser is behind the toolchain you're using.

Can you specify which browser version you're using, and which toolchain version you're using? Not just "developer edition" but the exact release information.

The problem will resolve itself as everything gets updated to the released version. This is an unfortunate side-effect of the initial release.

binaryen was updated to 0x1 in this commit. From this you can work back which binaryen version you have. Emscripten brought that version into its incoming branch with this commit. You'll need to use its incoming branch at least after this commit to get 0x1 binaries, which is labeled as 1.37.3. earlier Emscripten will produce 0xD binaries.

Browsers will update the same way. If Firefox developer edition expects 0xD then try Nightly. In this transitional case it may be easier to change toolchains or browser version to match.

Upvotes: 1

Related Questions