Probably 1.36.3 is too old - looks like it's emitting 0xa wasm and the browser expects the current 0xb version. If you use emscripten incoming (1.36.7 currently) it will emit 0xb.
On Thu, Aug 18, 2016 at 5:20 AM, awt <[email protected]> wrote: > Hi, > > I have a very simple helloworld program that I compiled to wasm using the > following command: > > emcc helloworld.cpp -s BINARYEN=1 -o helloworld.html > > These are my build steps: > 1. Build sdk-1.36.3-64bit from source on windows using VS2015 > 2. Make a manual fix to file.cpp in binaryen e.g. in wasm::read_file, > > template <typename T> > T wasm::read_file(const std::string &filename, bool binary, bool debug) { > if (debug) std::cerr << "Loading '" << filename << "'..." << std::endl; > std::ifstream infile; > auto flags = std::ifstream::in; > if (binary) flags |= std::ifstream::binary; > infile.open(filename, flags); > if (!infile.is_open()) { > std::cerr << "Failed opening '" << filename << "'" << std::endl; > exit(EXIT_FAILURE); > } > infile.seekg(0, std::ios::end); > std::streampos insize = infile.tellg(); > if (uint64_t(insize) >= std::numeric_limits<size_t>::max()) { > // Building a 32-bit executable where size_t == 32 bits, we are not > able to create strings larger than 2^32 bytes in length, so must abort here. > std::cerr << "Failed opening '" << filename << "': Input file too > large: " << insize << " bytes. Try rebuilding in 64-bit mode." << std::endl; > exit(EXIT_FAILURE); > } > T input(size_t(insize) + 1, '\0'); > infile.seekg(0); > infile.read(&input[0], insize); > return input; > } > > change the highlighted line to 'int flags = std::ifstream::in;' > > When I try to run it on Chrome Canary (Version 54.0.2831.0 canary > (64-bit)), I get the following error: > > helloworld.js:89594 Uncaught Wasm.instantiateModule(): Result = expected > version 0b 00 00 00, found 0a 00 00 00 @+4 > Module.asm @ helloworld.js:89594(anonymous function) @ helloworld.js:95297 > > On Firefox Nightly (51.0a1 (2016-08-09)), I see the following error: > > TypeError: wasm error: compile error at offset 8: failed to match binary > version helloworld.js:89594:18doNativeWasm/Module.asmhttp: > //localhost:8080/helloworld.js:89594:18<anonymous> > > Any advice to fix the above error would be much appreciated. Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
