Open rjzak opened 2 years ago
Hi, thanks for bringing this up, interesting idea.
At the moment, the toolchain uses the gfortran runtime provided by GCC, which relies on libc. Emscripten then provides the needed libc/musl binding to the existing Browser system interfaces.
Implementing support for a completely new system backend would require either replacing libc with something call-compatible that uses Wasi in the background, or moving to a different compiler infrastructure. I am still hoping for LLVM/flang to be released, moving to a 100% LLVM toolchain would eliminate many quirks and problems of the current toolchain. However, the flang compiler is not finished yet. In addition, I am unsure how easy it would be to use Wasi as a system backend in LLVM.
If you have any ideas, let me know.
Edit: I had a quick look at Wasi, and it appears that it provides a sizeable set of libc-like APIs. It might be feasible to compile libgfortran using this.
LFortran is a really cool project, but not yet complete enough to run most/all of the scientific codes I usually work with. See https://docs.lfortran.org/progress/ . I had a look at it in 2020 when I started this project, and it seems like a lot has been implemented since. But there are still more functions needed for full support.
I am intrigued by the Wasi framework. I'll take a more thorough look at it in the next days. This might help me with a semi-related project.
In your blog post, you discuss the use of WebAssembly and Javascript for use in the browser. How about support for Wasi and a runtime environment like Wasmtime? It might even just work out of the box, I haven't yet tried your Docker image.