Description
This issue collects the current set of issues blocking Servo from building & running on OpenHarmony and Oniro. Until now we have been hoping to use Rockchip (rk3568) board with OpenHarmony 3.2 (maybe upgrade to 4.0) as the eventual target, though all of the work below was done on an Ubuntu 20.04 VM.
Building servo/mozjs for OpenHarmony:
Able to compile successfully with local patch to make configure script work
Building servo uncovered more issues, most of them due to lack of support for ohos
target in third party rust crates:
- socket2 needs patches for Iovlen type. GitHub ticket open but no progress.
- The nix crate didn't compile as it uses C
shm_open
and and other functions from theshm_
family that OHOS chooses not to expose. We've patched it locally to follow the code innix
forandroid
which also doesn't exposeshm_*
. nix
had many other compilation errors becausenix
doesn't handletarget_env=ohos
in conditionally compiled code. We've patched it locally so that code conditional ontarget_env=musl
is now conditional onany(target_env=musl, target_env=ohos)
. A similar fix had to be done in socket2 crate as well. Seems like this was the correct approach.- Servo's components/allocator crate uses jemalloc-sys native library which doesn't support ohos triples in its configure script, so for now we've turned off the feature that uses jemalloc-sys.
The above local patches could potentially be contributed to upstream crates, but it is unclear what is the strategy for testing and reviewing the PRs should be.
- Servo requires the 'rustc-dev' component of the toolchain since its
script_plugin
crate uses therustc
crate for compile time plugins. The prebuilt rustc toolchain doesn't include this component, but looks like this can be built using standard rust toolchain. The version of rustc that Servo uses is now quite old and doesn't include recent patches in upstream rust for ohos target. So we'll probably need to complete the rustc toolchain upgrade in servo before attempting this again.
Additionally, there are open questions that we've not yet started exploring such as integrating with native windowing system & OpenGL stack on OpenHarmony. We also have an issue on Servo side to track the status and collect issues that might not be relevant to OHOS/Oniro folks.