I am trying to generate javascript from python using cython and emscripten.
hello.py
:
print 'Hello world.'
Then I compile this to c using cython
>>> cython --embed hello.py -v
This generates a hello.c
file which I compile with
>>> gcc hello.c -I/usr/include/python2.7/ -lpython2.7
This works for gcc or clang.
When I execute ./a.out
I get the expected output
>>> ./a.out
>>> Hello world
next I want to compile hello.c
to javascript using emscripten
>>> emcc hello.c -I/usr/include/python2.7/ -lpython2.7
I get
>>> WARNING emcc: -I or -L of an absolute path encountered.
>>> If this is to a local system header/library, it may cause problems
>>> (local system files make sense for compiling natively on your system,
>>> but not necessarily to JavaScript)
>>> clang: warning: argument unused during compilation: '-nostdinc++'
It still generates a a.out.js
file which I try to run in node.js
>>> node a.out.js
I get a reference error
>>> ReferenceError: _Py_SetProgramName is not defined
I tried changing the generated javscript a little bit, but basically I think all the _Py_
functions are not defined.
Does anyone have any experience with this, or any suggested fixes?