Hanks10100 / wasm-examples

WebAssembly Examples
227 stars 58 forks source link

最新版本,编译成wasm报错 #5

Closed jsOcean closed 5 years ago

jsOcean commented 5 years ago

(index):30 Uncaught (in promise) LinkError: WebAssembly.Instance(): Import #0 module="env" function="__memory_base" error: global import must be a number or WebAssembly.Global object 这个是报错信息 emcc math.c -Os -s WASM=1 -s SIDE_MODULE=1 -o math.wasm 这是我运行的命令

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.36 clang version 6.0.1 (Cswircachegitchromium.googlesource.com-external-github.com-emscripten--core-emscripten--fastcomp--clang 98df4be387dde3e3918fa5bbb5fc43e1a0e1daac) (Cswircachegitchromium.googlesource.com-external-github.com-emscripten--core-emscripten--fastcomp 1b4148f39a69c7fc62edadd85e4122b68694dfb7) (emscripten 1.38.31 : 1.38.31) Target: x86_64-pc-windows-msvc Thread model: posix InstalledDir: D:\emsdk\fastcomp\fastcomp\bin shared:INFO: (Emscripten: Running sanity checks) 这个是我的emcc 版本

求大神指点

jsOcean commented 5 years ago

运行你生成的wasm文件,不会报错,运行正常

Hanks10100 commented 5 years ago

Fixed by dad3d379dc501c60bfed24b8846ddaf5f0ff8d63