一句话:提出Cross2OH,结合适配知识库与静态分析自动检测和修复C/C++库移植到OpenHarmony时的跨平台不兼容问题。
OpenHarmony是新兴移动操作系统,将Linux上的C/C++库移植到OpenHarmony因系统库、运行时环境和构建系统的架构差异而面临独特挑战,这些差异在交叉编译时表现为跨平台不兼容(CPI)问题。传统工具链仅提供简短错误信息,且缺乏系统文档。本文对92个成功移植的库进行实证研究,手动复现所有CPI问题,揭示差异可分为三类,CPI问题表现在八个维度,并总结出八种适配策略。基于此,提出Cross2OH自动化移植技术,结合适配知识库与静态分析检测并修补八类CPI问题。使用真实开发者补丁评估,达到0.94召回率和0.91精确率。Cross2OH成功为40个关键库实现交叉编译,其中29个通过OpenHarmony官方审核,展现了简化移植流程、促进生态发展的潜力。
OpenHarmony is a new mobile operating system that offers a popular alternative to Android and iOS. To support its adoption, significant efforts have been devoted to porting C/C++ libraries from Linux to OpenHarmony. However, this porting process presents unique challenges due to the fundamental architectural differences in system libraries, runtime environments, and build systems between the two platforms. These discrepancies manifest as Cross-platform Incompatibility (CPI) issues during cross-compilation, which are particularly difficult to resolve for two key reasons. First, conventional cross-compilation toolchains provide only brief error messages that offer inadequate diagnostic information for CPI issues. Second, resolving these issues requires a deep understanding of cross-platform discrepancies, yet comprehensive documentation or systematic guidelines about such Linux-to-OpenHarmony differences remain largely unavailable.In this experience paper, to assist developers in addressing these challenges, we conducted an empirical study on 92 C/C++ libraries successfully ported to OpenHarmony. Through manual step-by-step reproduction of all CPI issues, our study reveals that discrepancies between Linux and OpenHarmony can be divided into three categories, and CPI issues can manifest through eight dimensions. Furthermore, we identified eight common adaptation strategies for resolving CPI issues. Based on these findings, we present Cross2OH, an automated technique for porting Linux-based software to OpenHarmony. Our approach combines: (1) an adaptation knowledge base (derived from RQ1 and RQ2 findings) and (2) a static analysis approach to detect and patch eight types of CPI issues. Evaluation using real developer patches shows Cross2OH achieves 0.94 recall and 0.91 precision in resolving CPI issues. Notably, Cross2OH enables successful cross-compilation for 40 critical libraries (including dependencies for popular Android apps such as WeChat, Microsoft Excel, Bilibili), with 29 of them passed official OpenHarmony review. The evaluation results demonstrate Cross2OH’s potential to streamline the porting process and foster the growth of the OpenHarmony software ecosystem.
DOI 原文 ·
@inproceedings{paperbot9200,
title = {Cross2OH: Enabling Seamless Porting of C/C++ Software Libraries to OpenHarmony},
author = {Qian Zhang and Tsz-On Li and Ying Wang and Li Li and Shing-Chi Cheung},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00146}
}