Skip to content

perry/system + perry/updater FFI symbols undefined on --target harmonyos (same shape as #395) #399

@proggeramlug

Description

@proggeramlug

Summary

Companion to #395 (which fixed perry_ui_*). The same root cause leaks two more symbol families into the harmonyos libentry.so:

  • perry_system_* — 22 symbols (e.g. perry_system_is_dark_mode, perry_system_get_device_model, perry_system_audio_*, perry_system_keychain_*, perry_system_notification_*, perry_get_device_idiom)
  • perry_updater_* — 14 symbols

These are defined ONLY in the per-platform UI crates (perry-ui-macos / perry-ui-android / perry-ui-ios / perry-ui-gtk4 / perry-ui-windows), not in perry-runtime or perry-stdlib. On harmonyos there's no perry-ui-harmonyos crate, and unlike perry/ui's App({body: ...}) literal, perry/system + perry/updater calls don't go through the perry-codegen-arkts harvest pass — the LLVM codegen always emits the extern declarations.

So the moment a harmonyos app calls isDarkMode() / getDeviceModel() / keychainSave() / any other perry/system or perry/updater API (from anywhere — top-level, event handler, library code), the OHOS dynamic loader will reject the bundle with Error relocating ... perry_system_X: symbol not found or perry_updater_X: symbol not found.

This will surface immediately on Mango once #395 unblocks embedNSView, because Mango uses perry/system darkmode + locale APIs.

Suggested fix

Extend the perry-runtime/build.rs from #395 to also scan PERRY_SYSTEM_TABLE + PERRY_UPDATER_TABLE from perry-dispatch. Mechanical ~10 LOC change — replace the tables slice with all four tables and adjust the symbol-prefix filter. Each stub is auto-generated as a no-op via the existing ReturnKind → default-value mapping. Same cfg(feature = "ohos-napi") gating; same drift-proof source-of-truth approach.

Optionally, gate per-symbol so calls that DO have a real harmonyos impl (e.g. perry_system_is_dark_mode could route to @ohos.application.Configuration.colorMode via NAPI) get a real implementation instead of the no-op default — but that's per-symbol work and the immediate priority is just getting the link to resolve.

Affected versions

Latent on every Perry version that supports --target harmonyos (#399 onward, v0.5.418+). Masked because #395's perry_ui_embed_nsview fired first; will be the next undefined symbol once #395 lands.

Blocking

Likely the next undefined-symbol blocker after #395 lands. Should be fixed as a same-PR follow-up or immediately after.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions