Rust FFI for Haiku and #[cfg(haiku)]?

This may be a question for @nielx . I found the Rust FFI for Haiku under the name haiku-sys but unfortunately when trying to access it from wrapper code using
mod haiku;
it doesn’t appear to even try to load it. Using cargo --verbose test on the wrapper it appears to try to load the unix cfg path but doesn’t find the os-target of freebsd11 that it seemed to think it was using earlier. Does rust_bin on HaikuPorts think it’s running on a BSD target? When I tried adding a linking target of -lbsd it didn’t think closely enough to POSIX to load the wrapper as a BSD anyway.

What I’m trying to do is use the area_info type and functions from the Region wrapper. It doesn’t appear to even try to load my code when I test it. Sorry to bother you with such a newbie Rust problem but this one is very Haiku specific.


The link to my half-finished commit is if you have the time to look.

Two points:

  • As for your problem, you would check if target_os = "haiku", that should resolve properly.
  • The haiku-sys crate is no longer necessary. Since libc 0.2.95 many of the native functions in libroot (including the area functions) are available in that crate.

I hope this helps.


Thanks! LibC is loading properly. I’ll try the target_os configuration.


It compiles but needs debugging. Due to interfacing with unsafe C++ code it’s not completely foolproof but at least it compiles the iterator now.


You’re more than welcome to post longer updates about this and WebAssembly on the Haiku blog too - I’m sure people who aren’t on the forums would love to hear about this :slight_smile:

Thanks! Once Wasmer works on Haiku it will be worthwhile to make a full blog post.

1 Like