Home Empirical Findings of RQ2 (Adaptation Strategies)
Post

Empirical Findings of RQ2 (Adaptation Strategies)

This table presents the empirical findings of RQ2. To understand how developers resolve CPI issues in the *.patch files, we analyzed adaptation code segments and their accompanying documentation from the openharmony-sig/tpc_c_cplusplus repository. For each adaptation, we collected commit logs and related developer notes as evidence. From this, we derived eight adaptation strategies that address all three types of CPI issues identified in RQ1. Effective adaptation requires developers to deeply understand the divergences between OpenHarmony and Linux, along with practical workarounds.
Issue TypeDescriptionRoot CausesStrategyExample Link
Type ACPI issues caused by system library and
runtime environment discrepancies between OpenHarmony and Linux
Inconsistent Native API Availability Address incompatible APIs by
(1) supplementing equivalent alternative APIs from musl/OpenHarmony kernel
(2) implementing the APIs within *.patch files
HDiffPatch
Divergent Logical Path Encapsulation ConventionsReplace logical header file paths with their corresponding physical file paths Chipmunk2D
Non-aligned Filesystem Hierarchy StructuresEmploye path remapping by converting the standard FHS hierarchy
to OpenHarmony-compatible filesystem hierarchy
cpp-httplib
Type BOpenHarmony and Linux have discrepant build systemCompiler-dependent Default Type Signedness VariationsEnforce the signedness of Char type json-schema-validator
ISA-specific Compilation Configuration MismatchesIncorporate ARM-specific compilation options in build configurations
to ensure proper architectural support
cpp-httplib
Conditional Compilation Branch InconsistenciesExtend the original OS-detection logic:
(1)OpenHarmony-specific macro checks
(2)Build system identification
curl
Differing C/C++ Standard Version Support ThresholdsSpecify the version supported by OpenHarmony MXNet
Type CAPI breaking changes of third-party libraries pre-installed in OpenHarmony and Linux-Ensure compatibility by:
(1)Replacing incompatible APIs with their OpenHarmony equivalents
(2)Implementing missing API implementation in *.patch files
zbar