blitz-research/monkey2

Exception with all emscripten codes.

Closed this issue · 2 comments

I always get the following exception in Chrome on macOS:

exception thrown: TypeError: Cannot read property 'length' of undefined,TypeError: Cannot read property 'length' of undefined
    at _emscripten_get_num_gamepads (http://localhost:60356/Progressbar_test.js:1:229273)
    at wasm-function[2754]:32
    at wasm-function[2765]:55
    at wasm-function[1354]:273
    at wasm-function[4017]:503
    at wasm-function[2933]:186
    at wasm-function[3192]:25
    at Object._main (http://localhost:60356/Progressbar_test.js:1:385209)
    at Object.callMain (http://localhost:60356/Progressbar_test.js:1:393058)
    at doRun (http://localhost:60356/Progressbar_test.js:1:393734)
Uncaught TypeError: Cannot read property 'length' of undefined
    at _emscripten_get_num_gamepads (Progressbar_test.js:1)
    at wasm-function[2754]:32
    at wasm-function[2765]:55
    at wasm-function[1354]:273
    at wasm-function[4017]:503
    at wasm-function[2933]:186
    at wasm-function[3192]:25
    at Object._main (Progressbar_test.js:1)
    at Object.callMain (Progressbar_test.js:1)
    at doRun (Progressbar_test.js:1)

Same exception with all sources I try to run.
For example Monkey2/modules/mojox/tests/Progressbar_test.monkey2

Emscripten is newest version, installed today.

/SDKs/emsdk/clang/e1.38.22_64bit
/SDKs/emsdk/node/8.9.1_64bit/bin
/SDKs/emsdk/emscripten/1.38.22

I get the same exception with 'wasm' and 'asmjs' target.

Actually there is another error before:

Progressbar_test.html:67 wasm streaming compile failed:
TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type.
Expected 'application/wasm'.

Here is a picture of the Chrome JavaScript console:
javascript_console

I am using mserver_macos from monkeycoder downloads section.

Upgraded emsdk from 1.38.22 to 1.38.31 and upgraded python from 2.7.10 to 2.7.16.

The emscripten target on macOS works now. Closing issue.

What I did in detail:

# Step 1:
#
# Upgrade emsdk
#
# old: emscripten + clang (1.38.22)
# new: emscripten + clang (1.38.31)
#
cd ~/SDKs/emsdk
./emsdk update
./emsdk update-tags
./emsdk install latest
./emsdk activate latest
. ./emsdk_env.sh
#
# Now I got:
#
# monkey2 build error: "emscripten required python 2.7.12 or above"


# Step 2:
#
# Upgrade Python from 2.7.10 to 2.7.16
#
brew reinstall python@2
pip install --upgrade pip setuptools
python --version

# Step 3:
#
# change "monkey2/bin/env_macos.txt" -> emscripten path
# to new path (1.38.22 -> 1.38.31)
#

cd ~/monkey/monkey2/bin

# Step 4:
#
# rebuild monkey2 emscripten libs
#
./mx2cc_macos makemods -clean -target=emscripten -config=release
./mx2cc_macos makemods -clean -target=emscripten -config=debug

# Step 5:
#
# run ted2go
#
./ted2_macos.app/Contents/MacOS/ted2