Build errors on Android
Hi , I was trying to build smithay as a dependency of https://github.com/stardustxr/server on Android/termux, and got a compiler error specifically from this block where android is not included in the targets:
https://github.com/Smithay/smithay/blob/fa58fec5934a86c3a849869669cc1a9897850109/src/utils/clock.rs#L22-L34
I saw https://github.com/Smithay/smithay/pull/711 which implies a lack of android support, but I'm not sure how important that is for stardust's specific usage.
As an aside for context, I know I won't be able to get stardust to work, I just want to get a sense of how far I can get setting it up currently.
I be fine with contributors adding stuff so smithay compiles on android. Android just hasn't been a priority for us but someone who wants to maintain support can do so.
There are some platform aspects to consider for Android like AHardwareBuffer objects for import, but that is something I know very little about. This part of the port might be best as a seperate crate but others here may have other opinions.
#711 did do a lot of stuff to try to make android work but has sadly been adandoned. I'd recommend smaller pull requests to get up to working android support if you want it.
Android support seems pretty uncontroversial as far as simply adding target_os = "android" to some conditional compilation.
In this particular case, Boottime isn't used anywhere in Smithay or Anvil, and both compile fine without it. Given it needs different code or doesn't exist on some other platforms, would it be better to just remove it?
There are a few other instances of #[cfg(target_os = "linux")] around – I'm guessing all of them could reasonably be changed to #[cfg(target_os = "linux", target_os = "android")].
But I think it might be more important to explicitly document the target platforms, and mention that Android is a possibility but not currently supported.
Also if @natasria or someone with a sense of the hurtles involved could write up some outline of the technical details of what they currently understand is involved in getting things to actually run on android, maybe including what's WIP and the state of things in #711, that could be very useful for a anyone who wants to contribute to implementing it down the line.
Smithay is a modular library, and you can compile with default-features=false and use only the parts you need, so the complexity of porting things depends somewhat on which parts of Smithay you want to use, and how you intend to use it.
Looking at https://github.com/StardustXR/server/blob/main/Cargo.toml, it's using default-features = false and features = ["desktop", "renderer_gl", "wayland_frontend"]. Which isn't a lot of smithay's features, so getting that to work probably requires fewer changes than https://github.com/Smithay/smithay/pull/711.