Imagine that you have written a very large project in C/C++ and now you want the same in Java Script. Will you start writing each piece of code in Java Script? Isn’t it too tedious?
Some of the requirements before using emscripten:
- The Emscripten code, from github (
git clone git://github.com/kripken/emscripten.git)
- LLVM with Clang (3.1 is the officially supported version)
- Node.js (0.5.5 or above)
- Python 2.6
The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Clang is a new C/C++/Objective-C/Objectice-C++ compiler being developed on top of LLVM. This must be a good replacement for gcc.
Here are the steps to build and install clang. 
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
../llvm/configure –enable-optimized –disable-assertions
make && sudo make install
1. git clone https://github.com/joyent/node.git
2. cd node
5. sudo make install
Once you have successfully done this. The next step is to setup emscripten. You can run emscripten by typing ./emcc. This ma throw some error if the path to clang and node is not correct.
Now we can compile the first helloworld file using emscripten.
Hello world! gets printed 🙂
Hope this post helped you get started with emscripten.