BananaBread icon indicating copy to clipboard operation
BananaBread copied to clipboard

Build & run errors with latest wasm tools

Open aardappel opened this issue 6 years ago • 7 comments

I'm sure this has something to do with me using tools from https://wasm-stat.us/waterfall, but wanted to report it anyway just in case any of these problems are worth fixing:

First, I got:

ERROR:root:We cannot build the native system library in "/usr/local/google/home/wvo/.emscripten_ports/binaryen/binaryen-version_39" when under the influence of emmake/emconfigure. To avoid this, create system dirs beforehand, so they are not auto-built on demand. For example, for binaryen, do "python embuilder.py build binaryen" 

Thanks to the helpful error message that was quick to fix, but I wasn't expecting this when running make.

Second, I had to add -DEMSCRIPTEN=1 to the Makefile to make it build. Not sure where this normally comes from.

Then when running, it manages to init most of the engine, when it gets to:

Uncaught TypeError: BananaBread.setPlayerModelInfo is not a function
at Object.Module.setPlayerModels (http://localhost:6931/game/setup_low.js:4:15)
at eval (eval at _emscripten_run_script (http://localhost:6931/bb.js:13402:2), <anonymous>:1:26)
at _emscripten_run_script (http://localhost:6931/bb.js:13402:2)
at _ZL5main3Pv (wasm-function[3512]:487)
at dynCall_vi (wasm-function[4126]:5)
at Object.Module.dynCall_vi (http://localhost:6931/bb.js:15027:37)
at Object.func (http://localhost:6931/bb.js:8931:24)
at Browser_mainLoop_runner (http://localhost:6931/bb.js:4612:12)                                                                                               

There's also still quite a few warnings that may have popped up because of the recent clang, and some messages saying it can't find SDL_Image and similar, but that doesn't appear to prevent it from building.

aardappel avatar Dec 21 '17 23:12 aardappel

Thanks to the helpful error message that was quick to fix, but I wasn't expecting this when running make.

I blame that one on the Cube2 build system running ENet's configure step during make ;)

Second, I had to add -DEMSCRIPTEN=1 to the Makefile to make it build. Not sure where this normally comes from.

I think we used to define that, and still do for compatibility's sake in the asm.js backend. Anyhow, the we should use the proper __EMSCRIPTEN__ define instead. I fixed that now.

I do see a runtime failure though, so something seems to have broken here.

kripken avatar Dec 21 '17 23:12 kripken

Hey, maybe @lsalzman could fix that then :P

aardappel avatar Dec 22 '17 00:12 aardappel

You missed some, e.g. engine/main.cpp:604

aardappel avatar Dec 22 '17 00:12 aardappel

Thanks, fixed. Also fixed some options that needed updating after recent emscripten changes. It now works in -O2, but not -Os (which uses the new metadce stuff, which apparently has a bug).

kripken avatar Dec 22 '17 00:12 kripken

Ok, I figured out the JSDCE bug, fix is in https://github.com/kripken/emscripten/pull/5965 . That replaces the previous PR, which was not correct.

With the later PR in emscripten, everything looks ok, at least using the default asm2wasm path. Does it work with the wasm backend too?

kripken avatar Dec 22 '17 01:12 kripken

With Emscripten and BananaBread from today, building now works fine, running still gives TypeError: Module.FS_createPath is not a function.

aardappel avatar Dec 28 '17 19:12 aardappel

Ah, that's a recent filesystem emulation change on emscripten. Fixed on master now.

kripken avatar Dec 29 '17 05:12 kripken