agoode · GitHub

@agoode

@agoode

jcreedcmu pushed a commit to jcreedcmu/twelf that referenced this pull request

Feb 29, 2024

Jason Reed

[This pull request against
MLton](MLton/mlton#550) enables compiling to
WebAssembly, so that twelf can be run from, e.g. inside a web browser.
A demo can be seen at:
https://jcreedcmu.github.io/twelf-wasm/
Test plan:
- ensure that the make target `twelf-server-mlton` still produces a
twelf-server binary
- ensure that the make target `wasi` produces
`bin/twelf.wasm`, when an appropriate version of `mlton` is installed.
Detailed instructions for building follow. Comments on the above pull
request have more details pertaining to build and install of GMP.
Checked out
https://github.com/agoode/mlton/tree/wasm2
at commit
MLton/mlton@ d2b9e5d 
put into
`$BUILD/dev-mlton`
and then did the following:
```
MLTON=$BUILD/mlton-wasm2-INSTALL
cd $BUILD/dev-mlton
make clean
make CC=$WASISDK/bin/clang \
     AR=$WASISDK/bin/ar \
     RANLIB=$WASISDK/bin/ranlib \
     TARGET_OS=wasi \
     TARGET_ARCH=wasm32 \
     TARGET=wasm32-unknown-wasi \
     WITH_GMP_DIR=$BUILD/gmp-wasi-INSTALL \
     PREFIX=$MLTON \
     dirs runtime install-runtime
cd $BUILD/dev-mlton
make clean
make all
make PREFIX=$MLTON install
cd $BUILD/twelf
mlton=$BUILD/mlton-wasm2-INSTALL/bin/mlton make wasi
```

robsimmons pushed a commit to standardml/twelf that referenced this pull request

Feb 29, 2024
[This pull request against
MLton](MLton/mlton#550) enables compiling to
WebAssembly, so that twelf can be run from, e.g. inside a web browser.
A demo can be seen at:
https://jcreedcmu.github.io/twelf-wasm/
Test plan:
- ensure that the make target `twelf-server-mlton` still produces a
twelf-server binary
- ensure that the make target `wasi` produces
`bin/twelf.wasm`, when an appropriate version of `mlton` is installed.
Detailed instructions for building follow. Comments on the above pull
request have more details pertaining to build and install of GMP.
Checked out
https://github.com/agoode/mlton/tree/wasm2
at commit
MLton/mlton@ d2b9e5d 
put into
`$BUILD/dev-mlton`
and then did the following:
```
MLTON=$BUILD/mlton-wasm2-INSTALL
cd $BUILD/dev-mlton
make clean
make CC=$WASISDK/bin/clang \
     AR=$WASISDK/bin/ar \
     RANLIB=$WASISDK/bin/ranlib \
     TARGET_OS=wasi \
     TARGET_ARCH=wasm32 \
     TARGET=wasm32-unknown-wasi \
     WITH_GMP_DIR=$BUILD/gmp-wasi-INSTALL \
     PREFIX=$MLTON \
     dirs runtime install-runtime
cd $BUILD/dev-mlton
make clean
make all
make PREFIX=$MLTON install
cd $BUILD/twelf
mlton=$BUILD/mlton-wasm2-INSTALL/bin/mlton make wasi
```
Co-authored-by: Jason Reed <jreed@gmail.com>

@agoode

agoode marked this pull request as draft

March 4, 2024 21:32

Merged

jcreedcmu pushed a commit to jcreedcmu/twelf-wasm that referenced this pull request

Mar 8, 2024

Jason Reed

My goal is to set down once and for all a reproducible build process
that shows how the `twelf.wasm` was constructed, instead of it
existing ad hoc across my memory and comments on the
PR MLton/mlton#550 . Already I discovered a
couple of crucial omissions in those comments.
This still deserves some cleanup, as the ordering of steps is not
really a coherent narrative, because I added some as I discovered
them. A cleaner one is forthcoming.

Closed

@agoode

@agoode

Merged

@agoode

@agoode

@agoode

@agoode

@agoode

agoode marked this pull request as ready for review

May 19, 2024 18:36

@MatthewFluet

@agoode

Read the original on github.com ↗