summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-10-25 19:41:47 +0100
committerAndrew Clayton <a.clayton@nginx.com>2023-10-25 19:57:13 +0100
commit3aed80812e105cd99c43f11023012608aecd9f4a (patch)
treeef078ea7efe8f5024294cb698d6fb47be2891c25 /README
parent510d3becc7592405f02e90f5aa43740c53f7deeb (diff)
downloadproject_blackbird-3aed80812e105cd99c43f11023012608aecd9f4a.tar.gz
project_blackbird-3aed80812e105cd99c43f11023012608aecd9f4a.tar.bz2
Add a component model example
This adds the 'Hello World' example from here[0]. The runtime is in Rust and the component is in C. This requires some new tools - https://github.com/bytecodealliance/wit-bindgen - https://github.com/bytecodealliance/wasm-tools You can use the pre-built packages, once downloaded and untar'd, edit rust/hello_world/component/Makefile and adjust the paths for the above tools. To build the component with make you may need to specify where the WASI sysroot is $ make WASI_SYSROOT=/path/to/wasi-sysroot [0]: <https://docs.rs/wasmtime/latest/wasmtime/component/macro.bindgen.html> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '')
-rw-r--r--README32
1 files changed, 32 insertions, 0 deletions
diff --git a/README b/README
index 822d1df..7e13c9a 100644
--- a/README
+++ b/README
@@ -70,3 +70,35 @@ Getting function exports...
[cabi_realloc]
Shutting down...
Done.
+
+
+Component Model
+===============
+
+You can play with the component model under rust/hello_world
+
+This requires some new tools
+
+ - https://github.com/bytecodealliance/wit-bindgen
+ - https://github.com/bytecodealliance/wasm-tools
+
+ You can use the pre-built packages, once downloaded and untar'd, edit
+
+ rust/hello_world/component/Makefile
+
+ and adjust the paths for the above tools.
+
+ To build the component with make you may need to specify where the WASI
+ sysroot is
+
+ $ make WASI_SYSROOT=/path/to/wasi-sysroot
+
+You can then build the Rust runtime under rust/hello_world with
+
+ $ cargo build
+
+after a while (sheesh) it should finish... then you can run it with
+
+ $ target/debug/hello_world
+
+it won't actually print anything, but also shouldn't give an error.