Skip to content
Branch: master
Clone or download
Latest commit 2073746 Jul 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
julide Fix Plotly output also Mar 31, 2019
website Rebuild with bysyncify Jun 24, 2019
.gitignore Fix rebuild script Dec 31, 2018
README.md Update instructions Jul 5, 2019
build_julia_wasm.sh Remove path Jul 4, 2019
generate_interpreter_foreigncall.jl Update build scripts Jul 4, 2019
rebuild_js.sh Update build scripts Jul 4, 2019
serve.py Now with Plotly and JSON Jan 23, 2019

README.md

Julia on WASM - Setup instructions

This repo contains various experiments for setting up julia on wasm. It's intended for collaboration and issue tracking before things are working sufficiently to switch to the appropriate upstream repo: There's two scripts in this repo:

  • build_julia_wasm.sh which will setup all the directories and build two copies of julia (one natively for cross compiling the system image, one for wasm)
  • rebuild_js.sh which will rebuild just the wasm parts and dump it into the website/ directory which is a hacked up copy of https://github.com/vtjnash/JuliaWebRepl.jl

Try it out

There's two ways to try out the current state of the wasm port without building anything yourself.

  1. An instance of the Web REPL hosted at https://keno.github.io/julia-wasm/website/repl.htm
  2. Using the iodide IDE plugin (see https://alpha.iodide.io/notebooks/225/ to get started).

Both use a pre-built version that it regularly pushed to this repo. However, to save space it may be a few days out of date. Please note that this is an extremely early alpha and many things are likely (and known) to be broken.

To get started

First install the emscripten SDK and upstream LLVM using:

# Install emsdk
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install emscripten-incoming-64bit binaryen-master-64bit
./emsdk activate emscripten-incoming-64bit binaryen-master-64bit

# Install upstream LLVM
git clone https://github.com/llvm/llvm-project
mkdir llvm-build
cd llvm-build
cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lld" -DCMAKE_BUILD_TYPE=Release ../llvm-project/llvm
ninja
# Add LLVM_ROOT = '<PATH_TO_LLVM_HERE>/llvm-build/bin' to $HOME/.emscripten
# ADD llvm-build/bin to path

, then

# Do this every time you start a session
source ~/emsdk/emsdk_env.sh
export PATH=<PATH_TO_LLVM_HERE>/llvm-build/bin
# Do this once
./build_julia_wasm.sh
# Do this after you change something on the wasm side
./rebuild_js.sh
# Use this to start a web server to serve the website
# Restart it when it crashes
emrun --no_browser --port 8888 website/repl.htm &

At the moment Firefox Developer Edition seems to have the most complete wasm support and seems to be the fastest, so I'd recommend trying that. However, due to a Firefox bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1561127) you may want to disable the ion jit (javascript.options.wasm_ionjit) in about:config. After starting the server above, just navigate to localhost:8888/repl.htm

You can’t perform that action at this time.