Emscripten is a complex system of software tools with support for multiple platforms. As is typical for such systems, the getting-started instructions can be a bit cryptic. A first sad note is that just installing emscripten from the Ubuntu repos probably isn't your best bet, at least for now.
I got much of what I needed by downloading Portable Emscripten SDK for Linux and OS X, and following these steps from the included README.md file:
- Run .
/emsdk update
. This will fetch the latest registry of available tools.
- Run
./emsdk install latest
. This will download and install the latest SDK tools.
- Run
./emsdk activate latest
. This will set up ~/.emscripten to point to the SDK.
Note that the initial download is tiny, but running the steps above takes a while (on the order of an hour, but probably depends on Internet speeds) and uses about 13G of disk space.
I found that I also needed to install (on Ubuntu 14.04 LTS):
apt-get install nodejs-legacy
There may be other dependencies required, which will hopefully be easy to track down based on the error messages that you see.
Here's a simple example of how you might build and run a C++ program:
emsdk_portable/emscripten/tag-1.34.8/em++ hello.cpp -o temp.html
chromium-browser --new-window temp.html
./emcc
in the Emscripten repository folder, and that seemed to work. It appears that no additional installation steps are required (correct me if I'm wrong.)