armory3d / armory

3D Engine with Blender Integration
https://armory3d.org/engine
zlib License
3.07k stars 315 forks source link

emscripten and wasm #738

Open Mishurin opened 6 years ago

Mishurin commented 6 years ago

Hi guys,

I am trying to use emsdk to make wasm from module file (example provided here for C http://armory3d.org/manual/#/code/wasm)

However I am getting this during compilation: warning: unresolved symbol: get_object warning: unresolved symbol: set_transform warning: unresolved symbol: notify_on_update

I am wondering how online wasm studio able to compile it properly. I also tried this #include "wasm_api.h" and local copy of api definition. The same results.

emscripten: 1.37.14

A cube in browser indeed didn't move with this error in console: LinkError: import object field 'DYNAMICTOP_PTR' is not a Number

Any guesses/suggestions?

Thank you.

ad1862 commented 6 years ago

Same problem. Module compiled by emsdk not work.

console:

Trace: LinkError: WebAssembly Instantiation: Import #0 module="env" function="memory" error: memory import must be a WebAssembly.Memory object at new $hxClasses.iron.data.Wasm (krom.js:6217:18) at krom.js:854:17 at kha_Assets.loadBlobFromPath.fileName (krom.js:4337:4) at Function.kha_LoaderImpl.loadBlobFromDescription (krom.js:14998:2) at Function.kha_Assets.loadBlobFromPath (krom.js:14063:17) at Function.iron_data_Data.getBlob (krom.js:4324:13) at new $hxClasses.armory.trait.internal.WasmScript (krom.js:853:17) at Function.Type.createInstance (krom.js:301:10) at Function.iron_Scene.createTraitClassInstance (krom.js:3010:14) at Function.iron_Scene.createTraits (krom.js:2937:31)