Questions tagged [wasi]
45 questions
1
vote
0 answers
Accessing file system with Go WASI throws "Bad file number" error
I'm trying out Go's newly added support for the WebAssembly System Interface (WASI). I'm attempting to access OS resources, such as the file system.
package main
import "os"
func main() {
err := os.WriteFile("text.txt", []byte("Hello World"),…

OptimusePrime
- 46
- 4
1
vote
0 answers
Golang cannot compile wasmer
Am trying to build a simple go file, with the following contents:
package main
import (
_ "embed"
"fmt"
"log"
"github.com/mattn/gowasmer"
)
//go:embed main.wasm
var webassembly []byte
func main() {
inst, err :=…

nigel239
- 1,485
- 1
- 3
- 23
1
vote
0 answers
How to compile a Rust project that includes libc dependencies to wasm?
For some reason I need to translate a piece of C code to Rust with c2rust and then compile it to wasm. The Rust code is as follows:
extern "C" {
fn printf(_: *const libc::c_char, _: ...) -> libc::c_int;
fn time(__timer: *mut time_t) ->…

Effy
- 11
- 2
1
vote
1 answer
How to produce single WASM file using WASI SDK C#
How to produce single WASM file using .NET WASI SDK? Here is my project file
Exe
net8.0
wasi-wasm
…

codevision
- 5,165
- 38
- 50
1
vote
0 answers
Where can I find up-to-date status for implementation of WASI proposals?
I am exploring standalone WASM/WASI runtimes like Wasmtime/Wasmer and I am wondering where can I find up-to-date information regarding their current implementation of the WASI proposals?
I tried their website docs with no luck.
I am looking for…

geeko
- 2,649
- 4
- 32
- 59
1
vote
0 answers
cannot load precompiled module `demo.wasm` unless --allow-precompiled is passed
I'm trying to follow a WASI-tutorial but all I'm getting are errors. I'm currently using wasmtime-cli version 1.0.0, and clang 14.0.0.
The tutorial has 3 simple steps.
save sample code to demo.c. This code is shown at the bottom of this…

J'e
- 3,014
- 4
- 31
- 55
1
vote
1 answer
Issue Linking C++ Library to Rust code in wasi
I am trying to compile a C++ library to wasm32 wasi for use inside my rust application. However I am running into this issue.
Error: failed to run main module `target/wasm32-wasi/release/so.wasm`
Caused by:
0: failed to instantiate…

Kival M
- 182
- 1
- 10
1
vote
1 answer
Wasmtime WASI communication via HTTP/sockets
There is awesome webassembly compiler&vm named Wasmtime, which provide support for execution without any kind of embedding, which allows run WASM applications direcly from command line https://docs.wasmtime.dev/lang-bash.html
Unfortunately there is…

Vladislav Ihost
- 2,127
- 11
- 26
1
vote
1 answer
WASI vs Emscripten FS, sand-boxed file system
As I know, WASI gives sand-boxed WebAssembly applications access to the underlying operating system and also Emscripten FS provides several file systems such, NODEFS. My question is both WASI and EMscriptenFS stands for same objective to provide…

Asanka
- 552
- 6
- 15
1
vote
1 answer
How can I read an existing directory from WASM in Rust using wasmer-wasi?
I wrote a simple wasmer-wasi example that reads directory entries but it always fails.
wasi_fs_example/src/lib.rs:
#[no_mangle]
pub fn start() {
std::fs::read_dir("/").unwrap();
}
runner/src/main.rs:
use wasmer::{Instance, Module, Store};
use…

freecoder
- 131
- 2
- 6
1
vote
1 answer
Stack space in WebAssembly (& WASI)
I'm writing small programs in WebAssembly text format (.wat). I've looked at Wasm code compiled from C and it looks like the common practice is to maintain a global stack pointer, and when we enter a function, to create a stack frame by subtracting…

Yage Hu
- 11
- 1
1
vote
0 answers
Could OpenCV compile/use with WASI(WebAssembly System Interface)?
WASI (WebAssembly System Interface) is intended to bring WebAssembly outside the browser.
I built a simple face recognition application with the eigenfaces example of OpenCV 4.3.0 (See:…

B.Lee
- 11
- 1
1
vote
1 answer
WebAssembly runtime vs. interpreter vs. engine
From webassembly.org:
WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine.
In the context of Wasm/WASI, what is
a WebAssembly runtime?
a WebAssembly interpreter?
a WebAssembly engine?
and in the above…

Marcellvs
- 391
- 1
- 3
- 15
0
votes
3 answers
Will Go 1.21 include ability to host http via WebAssembly? How?
I'd like to try an http server via WebAssembly on Go. I think that compiling go for webassembly outside the browser is not supported in go 1.20, and that the net/http libraries aren't included in tinygo.
I tried to do it with gotip after reading…

Tyler
- 25
- 7
0
votes
1 answer
Server-side AssemblyScript: How to read a file?
I'd like to write some server-side AssemblyScript that uses the WASI interface to read a file and process the contents.
I know that AssemblyScript and the ByteCode Alliance have recently had a falling out over the "openness" of the WASI standard,…

Chris W
- 289
- 1
- 12