To setup Emscripten for building Hermes, we recommend using
emsdk, which is
the same way Emscripten recommends for most circumstances.
Follow the directions on the
Emscripten website for
to download the SDK.
If you install
~/emsdk and activate
then you should use this shell variable for the rest of these instructions:
If you are using the old
fastcomp instead, replace
upstream in the above instruction with
WARNING: The old
fastcomp backend was removed in emscripten
2.0.0 (August 2020)
Hermes now requires a two stage build proecess because the VM now contains Hermes bytecode which needs to be compiled by Hermes.
Please follow the Cross Compilation to set up a workplace
and build a host hermesc at
Make sure that the
--emscripten-platform option matches the directory given
--emscripten-root, and is also the current activated Emscripten toolchain
configure.py --help for more build options.
configure.py script runs CMake for you with options chosen by the Hermes
project. If you want to customize your build, you can take this command as a
Each option is explained below:
CMAKE_BUILD_TYPE: set it to one of CMake's build modes:
EMSCRIPTEN_FASTCOMP: set to
1if using fastcomp, or
0if using upstream (LLVM)
WASM: whether to use asm.js (
0), WebAssembly (
1), or both (
NODERAWFS: set to
1if you will be running Hermes directly with Node. It enables direct access to the filesystem.
ALLOW_MEMORY_GROWTH: whether to pre-allocate all memory, or let it grow over time
You can customize the build generator by passing the
-G option to CMake, for