Hosting Web Apps in Julia

Getting the full Julia working (REPL, libraries, test suite, etc.) in Emscripten/WebAssembly would be a lot of work. Ultimately, it should be doable because Julia is well matched for this. A more realistic starting point is to statically compile smaller chunks of code. This should be easier given the work Jameson/Julia Computing has done in this area.

I’ve tried it in the past. I could get simple functions compiled and run in the browser. These functions would involve basic types like Int’s or Float64’s. I couldn’t get arrays or indexing to work at all, and there were some other Emscripten issues I didn’t know how to deal with. As a starting point, I thing you need to consider the following:

  • Match up the versions of LLVM that Julia and Emscripten use
  • Statically compile Julia code to 32 bit LLVM output (-m32)
  • Compile the C code that makes up the Julia base library
  • Link them together–may need to handle naming somehow

At one point, Rust compilation used special LLVM passes. I don’t know if that’s needed anymore.

1 Like