I have successfully compiled CPython 2.7 with Emscripten to a good enough 
state that I can run basic Python computations and prints. However I am 
encountering an unusual issue when performing a more advanced Python 
computation.

Consider the following Python code:
*    import pydoc*
*    pydoc.help()*

Running that code inside the Emscripten-compiled CPython interpreter 
results in at least 24 different Python modules being imported as a side 
effect. Some of these Python modules are implemented by *.so files that are 
dynamically loaded from the web server via synchronous XHR and passed to 
C's *dlopen*.

In particular when CPython tries to load the *token.py* module (or perhaps 
the unknown module after it), I receive what appears to be an internal 
Emscripten error:
*    Error in loading dynamic library: TypeError: 
Runtime.alignFunctionTables is not a function*

I've traced this error down to *emscripten-master/src/library.js*:
*  dlopen: function(filename, flag) {*
*      ...*
*      try {*
*        var lib_module = eval(lib_data)(*
*          Runtime.alignFunctionTables(),*
*          Module*
*        );*
*      } catch (e) {*
*#if ASSERTIONS*
*        Module.printErr('Error in loading dynamic library: ' + e);*
*#endif*
*        DLFCN.errorMsg = 'Could not evaluate dynamic lib: ' + filename;*
*        return 0;*
*      }*
*      ...*

I'm wondering if this kind of error might be related to all of the compile 
options I am using. For reference I'm compiling with:
*$ emcc -O0 python.bc -s INVOKE_RUN=0 --pre-js fs.js -s 
EXPORTED_FUNCTIONS=... -s ASSERTIONS=2 -s SAFE_HEAP=1 -s 
ALIASING_FUNCTION_POINTERS=0 -s EMULATE_FUNCTION_POINTER_CASTS=1 -o 
dist/python.js*

Any insight as to what "Runtime.alignFunctionTables is not a function" 
could be caused by?

- David

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to