Add build file for mlton wasm compilation#4
Merged
Conversation
robsimmons
reviewed
Feb 29, 2024
Member
robsimmons
left a comment
There was a problem hiding this comment.
In general I'm totally on board here, but is there any chance those huge MLB files can be refactored and shared with other mlb files?
Collaborator
Author
|
You're right, that would be better, will do. |
[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 ```
f7999da to
56449e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since compilation to webassembly with MLTon is demonstrably feasible, I would like to upstream the minor change that was required to get it to work.