kripken / BananaBread

BananaBread is a C++ 3D game engine that runs on the web using JavaScript+WebGL+HTML
1.38k stars 346 forks source link

Build & run errors with latest wasm tools #69

Open aardappel opened 6 years ago

aardappel commented 6 years ago

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.

kripken commented 6 years ago

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.

aardappel commented 6 years ago

Hey, maybe @lsalzman could fix that then :P

aardappel commented 6 years ago

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

kripken commented 6 years ago

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 commented 6 years ago

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?

aardappel commented 6 years ago

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

kripken commented 6 years ago

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