Elixir + WASM -> will it happen?

I made a brief attempt at it but I got inundated with compile errors that look difficult to tackle without solid C experience. For anyone who wants to try, here’s the basics of how I got started. You’ll need emsdk installed and activated first:

# Clone Erlang repo
git clone https://github.com/erlang/otp.git
cd otp
git checkout OTP-21.0.9

# Some of the build stuff references the environment variable $ERL_TOP
export ERL_TOP=`pwd`

# Start with some autoconf stuff for the Erlang RunTime System (erts). Though it may not
# actually make a difference here, I'm prefixing these commands with `emconfigure` command
# to make sure that emscripten's headers are used instead of the default system headers
cd erts
emconfigure autoheader
emconfigure autoconf

# Back in the root, configure and compile. The flag --enable-bootstrap-only causes only the
# core runtime system to be compiled
cd ..
emconfigure autoconf
emconfigure ./configure --enable-bootstrap-only
emmake make

At this point, be prepared for a mountain of compiler errors. The exact errors differ when running it on Mac vs Ubuntu. Many of them occur in parts of the code that can be disabled with preprocessor defines, so it’s possible that the right set of defines could get it to work.

There’s a section of the Erlang docs that describes cross-compilation, but I didn’t find anything I knew how to make use of. To anyone at Dockyard or elsewhere giving this a whirl, good luck, and please let us know how it’s going!

5 Likes