- Python 3 (required by
mx) git(to download, update, and locate repositories)- JDK 21+
- WABT (WebAssembly Binary Toolkit) for translating .wat files
- Emscripten or WASI SDK for translating C files
To build GraalWasm, you need to follow the standard workflow for Graal projects. We summarize the basic steps below:
-
Create a new folder where your repositories
mxandgraalshould be located:$ mkdir graalvm $ cd graalvm -
Clone
mxand add it to thePATH:$ git clone https://github.com/graalvm/mx.git $ export PATH=$PWD/mx:$PATH
-
Clone the
graalrepository and enter the wasm directory:$ git clone https://github.com/oracle/graal.git $ cd graal/wasm -
Set
JAVA_HOME:$ export JAVA_HOME=[path to JDK] -
Build the project:
$ mx --dynamicimports /compiler build
These steps will build the wasm.jar file in the mxbuild/dists/jdk<version> directory, which contains GraalWasm.
To run a .wasm file, you can use the following command:
bash $ mx --dynamicimports /compiler wasm somefile.wasm
For instructions how to run the tests, see Tests and Benchmarks.