Pre-compiled binaries are included for convenience's sake. If you want to re-create these, you should follow this tutorial.
Major differences between that tutorial and this one are that I'm using LLVM 20.x, so some things will be accordingly changed.
Feel free to skip to Part Four if you have no intention of changing the binary .wasm
code.
- Clone LLVM on Github.
- Apply the Git patch under
llvm/llvm-wasm.diff
.
The FORMAT
statement is actually a bunch of disguised calls to libFortranRuntime
, so we need to compile these calls to WebAssembly:
- Install and activate the emscripten SDK.
- Build
libFortranRuntime
andlibFortranDecimal
. You can configure with:emcmake cmake -S flang/runtime -B flang/runtime
emcmake cmake -S flang/lib/Decimal -B flang/lib/Decimal
- Then make with
emcmake cmake --build <DIRECTORY>
for each.
- Copy the built libraries to the
binaries/libFortran
folder of the git project.
emcmake cmake -B build
cmake --build build --target=fortran_wasm
I believe this is something specific to Ninja, so you can just re-run emcmake cmake -B build
and it should be fixed.
npm -C web ci
npm -C web run start --mode development