I am trying to create javascript from python using cython and emscripten.
hello.py :
print 'Hello world.'
Then I compile this with 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 in 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.out.js file which I am trying to run in node.js
>>> node a.out.js
I get a reference error
>>> ReferenceError: _Py_SetProgramName is not defined
I tried to modify the generated javscript a bit, but basically I think all _Py_ functions are undefined.
Does anyone have experience with this or any suggested fixes?
source share