• Stars
    star
    320
  • Rank 126,769 (Top 3 %)
  • Language
    JavaScript
  • Created over 5 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Running julia on wasm

Try it out!

There's three 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 a modified version of the Pluto IDE, available at https://pluto-wasm-backend.netlify.app/editor.html
  3. Using the iodide IDE plugin (see https://alpha.iodide.io/notebooks/225/ to get started).

Both use a pre-built version. Please note that this is an extremely early alpha and many things are likely (and known) to be broken.

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 three scripts in this repo:

  • configure_julia_wasm.sh which will setup all the directories
  • build_julia_wasm.sh which will 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

To get started

Pre-conditions

  1. nodejs
  2. gcc-multilib and g++-multilib

Emscripten SDK

First install the emscripten SDK

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

Upstream LLVM

Then build and install upstream LLVM

# 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

Setup environment

  1. Add LLVM_ROOT = '<PATH_TO_LLVM_HERE>/llvm-build/bin' to $HOME/.emscripten
  2. Add llvm-build/bin to $PATH

Bootstrapped build

Finally, you're ready to build julia for wasm

# Do this once
./configure-julia-wasm.sh
# this command may fail at the very end of the build process, that's normal
./build-julia-wasm.sh

This command may fail at the very end with an error like the following:

    JULIA build-native/usr/lib/julia/sys-o.a
syntax: incomplete: premature end of inputErrorException("")
ERROR: LoadError: syntax: incomplete: premature end of input
Stacktrace:
 [1] top-level scope at /root/julia-wasm/julia/contrib/generate_precompile.jl:7

This is expected (we're using a 32bit linux build, but telling it it's wasm to generate a compatible system image, so things are a bit confused). Afterwards, build the wasm build using:

 # Do this after you change something on the wasm side
 ./rebuild_js.sh

Afterwards you may set up a webserver using:

emrun --no_browser --port 8888 website/repl.htm &

At the moment Firefox Nightly seems to have the most complete wasm support and seems to be the fastest, so I'd recommend trying that. After starting the server above, just navigate to localhost:8888/repl.htm

Enable WASM GC support integration (Firefox Nightly)

In about:config enable javascript.options.wasm_gc

Enable WASM Reference Types (Chrome Canary)

google-chrome-unstable  --jsflags="--experimental-wasm-anyref"

More Repositories

1

SIUnits.jl

Efficient unit-checked computation
Julia
68
star
2

TerminalExtensions.jl

A package that makes Julia take advantage of cool terminal emulator features.
Julia
42
star
3

bmcnonsense

Playing with firmware
C
31
star
4

Compiler3.jl

Staging package for new compiler interfaces
Julia
28
star
5

InterfaceSpecs.jl

Playground for formal specifications of interfaces in Julia
Julia
26
star
6

TerminalUI.jl

Who needs a GUI if you have a terminal?
Julia
21
star
7

ASTInterpreter.jl

Gallium's AST interpreter as a separate package to simplify development
Julia
16
star
8

VT100.jl

Terminal Emulation for terminal UI verification
Julia
13
star
9

correctunwind

One part of my "this-is-why-we-cant-have-nice-thing" series
C
12
star
10

REPLCompletions.jl

Completions for your Julia REPL
Julia
10
star
11

supermicro-aspeed-uboot

Supermicro's GPL release for their U-Boot code for aspeed machines
C
9
star
12

ClangSA.jl

Playing with the clang static analyzer to find julia runtime bugs
C++
8
star
13

TexExtensions.jl

Tex Pretty printing of Julia Base types.
Julia
7
star
14

NewOptimizer.jl

WIP for new optimizer for julia base
Julia
7
star
15

LSH.jl

Locality Sensitive Hashing
Julia
7
star
16

julia-wasm-build

Builds of the julia-wasm repo
JavaScript
5
star
17

Pythia.jl

Julia wrappers for the Pythia event generator
Julia
5
star
18

AC274.jl

Toy CFD systems for Harvard AC274 class
Julia
5
star
19

Hydra.jl

Hosted Multi-user IJulia distribution
Julia
4
star
20

NotInferenceDontLookHere.jl

Package to help with Inference development
Julia
4
star
21

Arsenic.jl

Experimental Gallium.jl-based C/C++ debugger
Julia
4
star
22

COFF.jl

A julia implementation of the PE/COFF file format
Julia
4
star
23

NCurses.jl

ncurses bindings for Julia
Julia
3
star
24

SSH.jl

A toy SSH implementation
Julia
3
star
25

DWARF.jl

Julia Package for parsing the DWARF file format
Julia
3
star
26

ELF.jl

Julia Package for working with ELF files
Julia
3
star
27

REPL.jl

Pure-julia REPL implementation
Julia
3
star
28

JITTools.jl

Tools for working with in-memory object
Julia
2
star
29

RR.jl

Julia interface to mozilla's rr
Julia
2
star
30

DIDebug.jl

My collection of hacks for introspecting debug info
Julia
2
star
31

RRStrace.jl

strace, but for rr
Julia
2
star
32

Wine.jl

Sniffing the wineserver protocol for fun and profit
Julia
2
star
33

anubis.juliacomputing.io

Configuration and documents related to the anubis.juliacomputing.com server
Vim Script
2
star
34

Rift.jl

Wrapping the Oculus Rift SDK in julia
Julia
2
star
35

VXI11.jl

Implementation of the VXI11 remote instrument protocol
Julia
2
star
36

Hooking.jl

Function entry hooking for julia and c functions
Julia
2
star
37

CxxROOT.jl

Cxx.jl based interface to CERN's ROOT
Julia
2
star
38

DyldExport.jl

Export julia symbols to the dynamic linker such that they can be used by shared libraries
Julia
2
star
39

MachO.jl

An implementation of the MachO file format
Julia
2
star
40

LineNumbers.jl

Some utilities for line number mapping - not clear this will remain a separate package
Julia
1
star
41

LibOVR

Import of the Oculus SDK LibOVR
C++
1
star
42

LHEF.jl

Quick and dirty implementation of the Les Houches Event Format
Julia
1
star
43

PerfEvents.jl

Working with the linux perf events subsystem
Julia
1
star
44

OpenBLASAArch64_jll

Julia
1
star
45

CS250

Harvard CS250 psets
Coq
1
star
46

SPICE.jl

Working with SPICE data in Julia (incomplete, do not use!)
Julia
1
star
47

LinuxBuilder

Julia
1
star
48

WebREPL.jl

Julia Web REPL 2.0
JavaScript
1
star
49

GccBuilder

Julia
1
star
50

ObjFileBase.jl

Common functionality for Object Files
Julia
1
star
51

Terminals.jl

Terminal Interfaces for Julia
Julia
1
star
52

X86Assembly.jl

Playing with approaches to disassembling x86
Julia
1
star
53

steamdeck-notes

Notes for trying various things on steamdeck hardware
1
star
54

QemuBuilder

Julia
1
star
55

DeprecationBotTest

Playing with github integrations. To be deleted when I'm done
Julia
1
star
56

CFITSIOBuilder

Julia
1
star