# walrus **Repository Path**: mirrors_Samsung/walrus ## Basic Information - **Project Name**: walrus - **Description**: WebAssembly Lightweight RUntime - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-10-24 - **Last Updated**: 2026-10-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # WALRUS: WebAssembly Lightweight RUntime [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Actions Status](https://github.com/Samsung/walrus/actions/workflows/actions.yml/badge.svg)](https://github.com/Samsung/walrus/actions) [![Coverity Scan Build Status](https://scan.coverity.com/projects/26942/badge.svg)](https://scan.coverity.com/projects/samsung-walrus) This project aims to provide a lightweight WebAssembly runtime engine. It now fully supports WebAssembly specs with an simple interpreter, but we plan to optimize interpreting as well as adopting JIT compiler for better performance. ## Cloning Clone as normal, but don't forget to get the submodules as well: ```console $ git clone --recursive https://github.com/Samsung/walrus $ cd walrus $ git submodule update --init ``` This will fetch the testsuite and gtest repos, which are needed for some tests. ## Building using CMake You'll need [CMake](https://cmake.org). You can then run CMake, the normal way: The build supports CMake 2.8.12 through 4.x without a policy-version override. WASI uses a system libuv (with pkg-config); when none is available, downloading libuv requires CMake 3.14 or newer. WASI-NN requires CMake 3.14 or newer. ```console $ cmake -H. -Bout/release/x64 -DCMAKE_BUILD_TYPE=Release -DWALRUS_ENABLE_SHELL=ON -GNinja $ cmake --build out/release/x64 $ ./out/release/x64/walrus test.wasm ``` Use standard CMake inputs for the build configuration (`CMAKE_BUILD_TYPE` or `cmake --build ... --config Debug` with a multi-config generator), target system (`CMAKE_SYSTEM_NAME`, `CMAKE_SYSTEM_PROCESSOR`, or `CMAKE_TOOLCHAIN_FILE`) and compiler flags (`CMAKE_C_FLAGS`, `CMAKE_CXX_FLAGS`, and `CMAKE_*_LINKER_FLAGS`). | Option | Default | Purpose | | --- | --- | --- | | `WALRUS_BUILD_SHARED_LIBS` | `BUILD_SHARED_LIBS`, otherwise `OFF` | Build a shared rather than static Walrus library | | `WALRUS_BUILD_GC_SHARED_LIBS` | `OFF` | Build GCutil as a shared library | | `WALRUS_ENABLE_SHELL` | `ENABLE_SHELL`, otherwise `ON` | Build the `walrus` executable alongside the library | | `WALRUS_BUILD_API_TESTS` | `OFF` | Build wasm-c-api examples | | `WALRUS_WASI` | `ON` | Enable WASI | | `WALRUS_WASI_NN` | `OFF` | Enable WASI neural networks | | `WALRUS_GC` | `ON` | Enable WebAssembly GC | | `WALRUS_JIT` | `ON` | Enable JIT compilation | | `WALRUS_ASAN` | `OFF` | Enable AddressSanitizer | | `WALRUS_SMALL_CONFIG` | `OFF` | Optimize for binary size | | `WALRUS_DEBUG_INFO` | `OFF` | Add debug information independently of build type | `WALRUS_HOST` and `WALRUS_ARCH` remain available as explicit overrides. Legacy `WALRUS_MODE=debug/release` supplies the default build type when `CMAKE_BUILD_TYPE` is unset. Legacy `WALRUS_OUTPUT=shell/static_lib/shared_lib/api_test` supplies defaults for the independent output options; explicit new options take precedence. Walrus does not overwrite the parent's `BUILD_SHARED_LIBS` or `ENABLE_SHELL`. Build flags, definitions, include paths and PIC settings are applied to individual targets. Embedding Walrus does not change parent or unrelated target settings. WABT options use the `WABT_` prefix (for example `WABT_USE_ASAN` and `WABT_WERROR`), and WASI uses `UVWASI_ASAN`. Legacy unprefixed options are read as defaults without creating unprefixed cache entries. To check build-setting isolation, configure and build the standalone fixture: ```console $ cmake -Htest/cmake/isolation -Bout/cmake-isolation -GNinja $ cmake --build out/cmake-isolation --target walrus-isolation ``` The same fixture supports `-DWABT_USE_ASAN=ON -DUVWASI_ASAN=ON` to check that sanitizer settings stay on their owning targets. ## Perf You'll need [Perf](https://perf.wiki.kernel.org/index.php/Main_Page). 0. To compile with perf support, use `-DWALRUS_JITPERF=1` 1. Set the path where temporary files are created with `WALRUS_PERF_DIR` environment variable. Run Walrus with: `sudo perf record -k 1 walrus --jit WALRUS_PARAMETERS` The `-k 1` option sets the monotonic clock, `-k mono` is also correct. Three files are generated: - perf.data - it is generated by perf - jit-XXXXXX.dump - The dump of jit generated functions, XXXXXX is the PID of process - jit-XXXXXX-codedump.txt - Walrus ByteCode dump, XXXXXX is the PID of process 2. You should chown perf.data, because you don't need `sudo` after that. 3. Inject JITDump file into `perf.data` with `perf inject --jit -i perf.data -o perf.data.jitted` It'll generate many shared object files, and `perf.data.jitted` 4. View the report with `perf report -i perf.data.jitted` ## Wasi Neural Network Walrus uses [NNtrainer](https://github.com/nntrainer/nntrainer) as it's neural network engine. To compile with wasi-nn support use `-DWALRUS_WASI_NN=ON` and `-DWASI_NN_BACKEND="nntrainer"` Documentation on how to build nntrainer for Walrus is found inside the `third_party/nntrainer` directory. After building nntrainer simply compile with ninja.