This page contains basic instructions on how to manually build and configure Emscripten from source on a clean Windows box.
Note
The instructions clone from the main Emscripten repository (https://github.com/emscripten-core/emscripten). Contributors should instead clone from their own Emscripten fork, and submit changes as pull requests.
Tip
You can also build Emscripten from source using the SDK. This is recommended if you need to easily switch between SDK and source builds.
The specific versions of tools that are needed are listed in the Emscripten Toolchain Requirements.
Note
64-bit versions of all needed dependencies are preferred, and may be required if you are building large projects.
These instructions explain how to install all the required tools. You can test whether some of these are already installed on the platform and skip those steps.
- Python v2.7 is currently preferred, although experimental support for Python3 exists.
- Add the path to the Python directory containing Python.exe to your PATH.
- Paths are set by opening System Settings | Advanced system properties, clicking Environment Variables and selecting PATH.
- Add the path to python, separated by semicolons: e.g.
;C:/Python27/;
or;C:/Python27/bin;
(depending on the location of the exe).
- Version 8.9.1 or newer is needed.
Using GitHub for Windows: - Launch the GitHub for Windows client. Click Skip Setup if you don’t have a GitHub account. - (optional) Select Options from the gear menu, and customize the default storage directory. Ensure the path has no spaces. - In your web browser, open https://github.com/emscripten-core/emscripten and press the Clone in Windows button.
Using the command line: - Create a directory (with no spaces in the name) to contain the clone. - Enter the following command into the terminal:
git clone https://github.com/emscripten-core/emscripten.git
Almost all the compiler settings used by Emscripten are defined in the compiler configuration file (.emscripten), a user-specific file located in the user’s home directory.
Instructions for creating and manually configuring this file are given in Configuring Emscripten Settings when Manually Building from Source.
The best way to validate the environment is to build some code. Open the terminal in your Emscripten directory — the directory that contains emcc (if you installed using GitHub for Windows this will be C:/Users/username/Documents/GitHub/emscripten) and enter:
./emcc tests/hello_world.cpp
If this builds a.out.js in the current directory, and you don’t see any build errors in the terminal, Emscripten is good to go!
There are additional validation and troubleshooting instructions in the topic Verifying the Emscripten Development Environment.