Emscripten Toolchain Requirements

The instructions below list the main tools and dependencies in an Emscripten environment, along with instructions on how to test which dependencies are installed.

Tip

The SDK provides the easiest and most reliable method for getting, using, updating and managing Emscripten environments. If you’re using the SDK you won’t need these instructions — they are provided for information only.

The instructions below are useful if you’re manually building from source.

What you’ll need

Emscripten tools and dependencies

A complete Emscripten environment requires the following tools. First test to see if they are already installed using the instructions below. Then install any missing tools using the instructions in the appropriate platform-specific build topic (Manually Building Emscripten on Linux, Manually Building Emscripten on Windows, Manually Building Emscripten on Mac OS X):

  • Node.js (0.8 or above; 0.10.17 or above to run websocket-using servers in node):
  • Python 2.x (2.7.3 or above preferred)
  • Java (1.6.0_31 or later). Java is optional. It is required to use the Closure Compiler (in order to minify your code).
  • Git client. Git required if building tools from source.
  • Fastcomp (Emscripten’s fork of LLVM and Clang)
  • The Emscripten code, from GitHub

Note

The Spidermonkey shell is also required if you want to run 100% of the tests in the test suite. Most developers will not need this, and should instead use node.js.

Compiler toolchain

When building Emscripten from source code, whether “manually” or using the SDK, you will need a compiler toolchain:

  • Windows: Install Visual Studio 2010 and cmake. You may also need Microsoft Windows SDK for Windows 7 and .NET Framework 4).

    Note

    • Visual Studio 2010 is required! Visual Studio 2012 and Visual Studio 2013 do not correctly compile Fastcomp. This issue will be fixed (eventually) when Fastcomp is migrated to use a LLVM 3.4 or later.

    • SDK users can also install and activate the MinGW compiler toolchain in order to build their own projects:

      emsdk install mingw-4.6.2-32bit
      emsdk activate mingw-4.6.2-32bit
      

      While this toolchain can in theory also be used to build Fastcomp, Visual Studio 2010 is recommended (by the LLVM development team).

  • Linux: Install gcc and cmake:

    #Install gcc
    sudo apt-get install build-essential
    # Install cmake
    sudo apt-get install cmake
    
  • Mac OS X: Install the XCode Command Line Tools:

    • Install XCode from the Mac OS X App Store.
    • In XCode | Preferences | Downloads, install Command Line Tools.

Test which tools are installed

Some of the tools are pre-installed on the various platforms (for example, Python is always available on Linux builds).

You can check which tools are already present using the following commands:

# Check for Python
python --version

# Check for node.js on Linux
nodejs --version

# Check for node.js on Windows
node --version  #

# Check for node.js on Mac OS X
node -v

# Check for git
git --version

# Check for Java
java -version

# Check for gcc / g++
gcc --version
g++

# Check for cmake
cmake