learn and experiment with emscripten


  1. Follow the Download and install instructions
  2. Run the following
# base install location
# ~/dev/emsdk_portable

# source in environment to update PATH and make tools available
# could add to .bash_profile to make available in all shells
$ source ~/dev/emsdk_env.sh

# needed to add python2 symlink (see https://github.com/kripken/emscripten/issues/3872)
$ cd /usr/local/bin
$ ln -s /usr/bin/python2.7 python2

# compile c file to javascript -> generates output/hello_world.js
$ emcc hello_world.c -o output/hello_world.js
$ node output/hello_world.js

# compile c file and generate html to view it -> generates output/hello.html and output/hello.js
# NOTE: overwrites
$ emcc hello_world.c -o output/hello.html