Skip to content

Uncaught WasmModule::Instantiate(): Import #0 module="env" function="abort" error: FFI is not an object #670

@tsangint

Description

@tsangint

I use emscripten and binaryen to compiled c/c++ to wasm file.

//get wast file
emcc hello.c -s "BINARYEN='/home/vagrant/emscripten/binaryen/'" -s "BINARYEN_METHOD='native-wasm'"

//get wasm file
wasm-as a.out.wast -o a.out.wasm
var xhr = new XMLHttpRequest();
xhr.open('GET', 'a.out.wasm', true);
xhr.responseType = 'arraybuffer';
xhr.onload = function() {
    myWasm = Wasm.instantiateModule(xhr.response);
}
xhr.send(null);

Then there is a error in my console.

But when I replace a.out.wasm to http://blog.mikaellundin.name/assets/posts/2016-06-19-creating-a-webassembly-binary-and-running-it-in-a-browser/out.wasm(a wasm file compile by other people), It's ok.
Is there anything wrong when I compile to wasm?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions