kripken / box2d.js

Port of Box2D to JavaScript using Emscripten
1.32k stars 196 forks source link

box2d.wasm.html test faild with emsdk@1.38.31 build #106

Closed wqtian closed 5 years ago

wqtian commented 5 years ago

Hi there, I am trying to compile this project into a WASM module with the latest emsdk@1.38.31. I got this:

error: undefined symbol: _ZTI15b2ContactFilter

so I fix that error according to the message suggests

warning: To disable errors for undefined symbols use-s ERROR_ON_UNDEFINED_SYMBOLS=0``

and I got the target js / wasm / html file successfully.

While I moved the target files to box2d.js/demo/webgl folder and test it with Chrome, it run failed, reporting the following error messages:

LinkError: WebAssembly.instantiate(): Import #63 module="env" function="__ZTI15b2ContactFilter" error: global import must be a number or WebAssembly.Global object

But I test the original target files which provide by this box2d.js project, it works well.

Any hints on how to resolve this ? @kripken

wqtian commented 5 years ago

How can I compile this project successfully without

                `-s ERROR_ON_UNDEFINED_SYMBOLS=0`

as the original Makefile doesn't has this compiler options.

In other words, which emsdk version can build workable target wasm and js file, like original target files that provided by box2d.js ? and where can i download it? @kripken

kripken commented 5 years ago

Using llvm-nm can show the symbols in each file, so you can debug the input files to emcc to see if that symbol is in fact missing. But maybe ContactFilter just isn't in the makefile, or something like that?