Hello folks!
I'd like to make rustix build with for android with libc
backend, but without any dependency on linux-raw-sys
. Right now it seems linux-raw-sys
is always a dependency on Linux, and there are quite a few cases where linux-raw-sys
is used outside backend/linux-raw-sys
- as long as it's under cfg(linux_kernel)
.
Where should I look to understand how to do this in a way that makes sense for rustix architecture, and also doesn't break stuff?
Would a patch like this be welcome upstream?
Rustix on Android uses rustix's libc backend, however it also uses linux-raw-sys in order to expose Linux-specific features that aren't available through the libc
crate.
Is there a problem with linux-raw-sys on Android, or are you looking to ensure that everything goes through libc
that can?
I'm looking to use libc
parts exclusively, even at the cost of losing some functionality that's not available via libc
.
What I'm aiming for is to use it in AOSP (Android platform). The feedback I got from Android maintainers was to avoid the linux-raw-sys
dependency because of the linux-raw-sys
bindings being statically generated not specifically out of Android kernel. I'm trying to figure out if that could work and make sense.
There are several uses of linux_raw_sys in the src/backend/libc directory, but it's probably manageable.
Some of those might be able to be upstreamed to the libc
crate.
There's also a bunch outside src/backend. What would be the right approach for those, disabling by some kind of absolutely_no_linux_raw_sys_please
-like cfg?
Ah, yes. Some of those should be able to be disabled in bulk, by disabling eg. the prctl
module in the thread
directory.
OK, I'll go poke around a little. Thank you for the hints!
For the cfg, the best way might be to make the linux-raw-sys dependency optional
And then you can use cfg(feature = "linux-raw-sys")
Does each optional dependency implicitly declare a feature with its name?
Yes
That's awesome, TIL. Thank you :D
If you run into problems, let me know, and I'll see if I can help!
Last updated: Dec 23 2024 at 12:05 UTC