Hello Genodians

Benjamin Lamowskis great article "A first complex Rust package" [1] and the 
attention Rust on Genode received recently on this mailing list motivated me to explore 
the latest achievements regarding Goa and Rust myself :)

I went straight down experimenting with Rocket, a web framework for Rust and 
setup a corresponding Goa project [2].

Compiling the "Hello World" example [3] with Goa was a very pleasing experience 
and at link stage, only two symbols were missing: kqueue and kevent. I added dummy 
implementations for both calls [4] (and by the way learned about the compat-libc API). 
Building succeeds now, but obviously fails at runtime:
```
Genode 24.02 <local changes>
17592186044415 MiB RAM and 18997 caps assigned to init
[init -> hello_rocket] Warning: Libc RNG not configured
[init -> hello_rocket] Warning: __sys_kqueue: kqueue not implemented
[init -> hello_rocket] thread 'main' panicked at 
/home/wonko/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rocket-0.5.0/src/lib.rs:245:10:
[init -> hello_rocket] create tokio runtime: Os { code: 78, kind: Unsupported, message: 
"Function not implemented" }
[init -> hello_rocket] note: run with `RUST_BACKTRACE=1` environment variable 
to display a backtrace
[init -> hello_rocket] Error: raise(ABRT)
[init] child "hello_rocket" exited with exit value -1
```

I'm aware that most certainly, there are other roadblocks ahead. However, I'd 
like to pursue the topic regarding kqueue()/kevent() a bit more since I assume 
this might be (or has been) a roadblock for porting other applications or 
runtimes.

- Is it reasonable to add those calls to Genodes libc?

- Or can Rust be instructed not to use those calls but select() instead? I 
stumbled over the MIO flags `mio_unsupported_force_poll_poll` and 
`mio_unsupported_force_waker_pipe` [5]. But I'm not versed in Rust and setting 
`mio_unsupported_force_poll_poll` by naively applying the following patch to 
Goa leads to `error[E0252]: the name `Waker` is defined multiple times`:
```
diff --git a/share/goa/lib/build/cargo.tcl b/share/goa/lib/build/cargo.tcl
index 7c0c52b..78e7e26 100644
--- a/share/goa/lib/build/cargo.tcl
+++ b/share/goa/lib/build/cargo.tcl
@@ -43,6 +43,8 @@ proc build { } {
                lappend rustflags -C link-arg=$x
        }
+ lappend rustflags --cfg mio_unsupported_force_poll_poll
+
        set ::env(RUSTFLAGS) $rustflags
        set ::env(RUST_STD_FREEBSD_12_ABI) 1
```


- [1] https://genodians.org/atopia/2023-10-26-a-first-complex-rust-package
- [2] https://github.com/rite/goa-projects/tree/hello_rocket
- [3] https://rocket.rs/guide/v0.5/getting-started
- [4] 
https://github.com/rite/genode/commit/0219d0543cedd180b082e1ef13dd5d779d7e57e2
- [5] https://github.com/tokio-rs/mio?tab=readme-ov-file#unsupported-flags


--
Roman Iten
Gapfruit AG
Baarerstrasse 135
CH-6300 Zug
roman.i...@gapfruit.com
_______________________________________________
users mailing list -- users@lists.genode.org
To unsubscribe send an email to users-le...@lists.genode.org
Archived at 
https://lists.genode.org/mailman3/hyperkitty/list/users@lists.genode.org/message/STGXVUOZZA732WXH74S6X23VAYZKGFK6/

Reply via email to