Hi Roman,
Nice to see your interest in Rust on Genode! I finally got around looking into your experiments with Rocket.
I'm afraid there is no easy hotfix for your specific use case. I got around your specific error by adding both Mio flags to cargo.tcl:
lappend rustflags --cfg mio_unsupported_force_poll_poll --cfg mio_unsupported_force_waker_pipe
However down the road compilation failed anyway because the Tokio crate, expecting a kqueue based Mio implementation on FreeBSD, uses AIO, which fails with Mio's poll implementation. Your general approach was correct though, as long as more granular config flag support[1] is not available, there is no alternative to setting the cfg flag globally.
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?
I absolutely agree that implementing support for kqueue()/kevent() in Genode's libc port is the reasonable way forward and I also suspect that future ports will likely benefit from its availability. I have looked into potential stumbling blocks and sketched out a possible implementation. I would be happy to implement at least basic support for the common kevent filters used in Mio (EVFILT_READ, EVFILT_WRITE) and defer implementing some of the more obscure ones. However, to make the Tokio runtime work, it seems we will need to implement support for AIO as well. I haven't really looked into AIO yet and I'm not sure how difficult it will be to make this work, but with the widespread use of Tokio, it will be a prerequisite for many complex Rust packages.
I much appreciate your experiments and if you want to take this further, we do of course welcome contributions to our libc port. While I'm looking forward to extending our Rust support, I'm currently working on other road map milestones and may not get around to working on this before the 24.04 Sculpt release.
Best wishes,
Ben
[1] https://github.com/rust-lang/cargo/issues/10271