Priority: P3: Somewhat important
Affects Version/s: None
Fix Version/s: None
Component/s: QPA: Other
Enabling WASM_OBJECT_FILES=1 makes the compiler produce object files in the wasm format instead of llvm bitcode. This makes linking significantly faster, especially when not optimizing.
Currently this requires building upstream llvm/clang from source, instead of using the "fastcomp" fork shipped with emsdk. This mode will eventually be the default for emscripten.
- wasm-opt crash:
(work around by building with -O0)
- Computed goto is not supported: the QML compiler does not build.
- Warnings (mostly harmless?):
(Note: this is "how-I-did-it", not necessarily "how-it-should-be-done".)
(Note the 2nd: See also v8.dev/blog for official instructions on how to install using emsdk)
1. Clone the following repositories:
- emscripten : https://github.com/kripken/emscripten.git
- binaryen: https://github.com/WebAssembly/binaryen.git
- llvm, https://github.com/llvm/llvm-project.git
2. Check out the version you want to use
- emscripten and binaryen have matching emsdk version tags, for example "1.38.23".
- llvm has its own version numbers, and must be synced up manually. Currently:
- emscripten <= 1.38.23 : llvm 8.0 (8.0.0-rc2 branch)
- emscripten > 1.38.23 : llvm 9.0 (master branch)
(em++/emcc will complain if you have the incorrect llvm version)
- emscripten is all python, no build needed.
- binaryen: "cmake -GNinja && ninja"
(one of the WebAssembly targets may be redundant)
3. Configure Environment
I use the following:
Where .emscripten-vanillallvm-1.38.23 is a copy of the .emscripten config file that emsdk generates.