ssh fedoravm
sudo dnf install git rpm-build crun podman buildah
sudo dnf install cmake clang lld llvm-devel lld-devel
mkdir work
cd work
git clone https://github.com/WasmEdge/WasmEdge.git
cd WasmEdge/
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${HOME}/.wasmedge -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_TESTS=ON .. && make -j
make install
ln -s ~/.wasmedge/lib64/libwasmedge.so ~/.wasmedge/lib64/libwasmedge_c.so
cd ~
dnf download --source crun
rpm -ivh crun-1.5-1.fc36.src.rpm
cd ~/rpmbuild/
sudo dnf builddep SPECS/crun.spec
rpmbuild -bp SPECS/crun.spec
cd BUILD/crun-1.5/
./autogen.sh
CPPFLAGS=-I${HOME}/.wasmedge/include LDFLAGS="-Wl,-R${HOME}/.wasmedge/lib64 -L${HOME}/.wasmedge/lib64" ./configure --prefix=${HOME}/.crun --with-wasmedge
make -j
make install
Check if crun --version
includes +WASM:wasmedge
.
$ ~/.crun/bin/crun --version
crun version 1.5.0.0.0.41-ce75
commit: b6c3139229b6e62292fea63e3334dafc053bd4bc
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
rustup target add wasm32-wasi
cd ~/work
git clone https://github.com/second-state/wasm-learning.git
cd wasm-learning/cli/hello
cargo build --target wasm32-wasi
$ ~/.wasmedge/bin/wasmedge target/wasm32-wasi/debug/hello.wasm
hello
cat > Dockerfile <<END
FROM scratch
COPY target/wasm32-wasi/debug/hello.wasm /
CMD ["/hello.wasm"]
END
buildah build --annotation "module.wasm.image/variant=compat" -t mywasm-hello .
$ podman --runtime ~/.crun/bin/crun run localhost/mywasm-hello
hello