跳到主要内容

Build WasmEdge With WasmEdge-Process Plug-in

备注

WasmEdge 0.18.0 移除了 Process 插件。以下说明适用于 0.17.2 及更早的版本。

The WasmEdge Process plug-in provides a sandboxed environment to execute system processes in a secured manner. This guide will walk you through the steps to build the WasmEdge Process plug-in.

Prerequisites​

The prerequisites of the WasmEdge-Process plug-in is the same as the WasmEdge building environment on the Linux platforms.

Build WasmEdge with WasmEdge-Process Plug-in​

To enable the WasmEdge WasmEdge-Process, developers need to building the WasmEdge from source with the cmake option -DWASMEDGE_PLUGIN_PROCESS=On.

cd <path/to/your/wasmedge/source/folder>
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_PLUGIN_PROCESS=On
cmake --build build
# For the WasmEdge-Process plug-in, you should install this project.
cmake --install build
备注

If the built wasmedge CLI tool cannot find the WasmEdge-Process plug-in, you can set the WASMEDGE_PLUGIN_PATH environment variable to the plug-in installation path (such as /usr/local/lib/wasmedge/, or the built plug-in path build/plugins/wasmedge_process/) to try to fix this issue.

Then you will have an executable wasmedge runtime under /usr/local/bin and the WasmEdge-Process plug-in under /usr/local/lib/wasmedge/libwasmedgePluginWasmEdgeProcess.so after installation.

Usage​

With WasmEdge 0.17.2, run a module that imports the Process plug-in using the plug-in search path:

WASMEDGE_PLUGIN_PATH="$PWD/build/plugins/wasmedge_process" wasmedge your_wasm_file.wasm

See the WasmEdge 0.17.2 Process plug-in for the matching source.