[go: up one dir, main page]

CN118672644A - Dynamic library compatibility method and device under domestic operating system environment - Google Patents

Dynamic library compatibility method and device under domestic operating system environment Download PDF

Info

Publication number
CN118672644A
CN118672644A CN202410989609.XA CN202410989609A CN118672644A CN 118672644 A CN118672644 A CN 118672644A CN 202410989609 A CN202410989609 A CN 202410989609A CN 118672644 A CN118672644 A CN 118672644A
Authority
CN
China
Prior art keywords
soname
dynamic library
version
dynamic
application software
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410989609.XA
Other languages
Chinese (zh)
Inventor
徐斌
淡建群
宁超举
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kirin Software Co Ltd
Original Assignee
Kirin Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kirin Software Co Ltd filed Critical Kirin Software Co Ltd
Priority to CN202410989609.XA priority Critical patent/CN118672644A/en
Publication of CN118672644A publication Critical patent/CN118672644A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/75Structural analysis for program understanding
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a method and a device for dynamic library compatibility under domestic operating system environment, and relates to the field of computer technology, wherein the method comprises the steps of S101, analyzing application software to obtain a dynamic library dependency list corresponding to the application software when the application software to be operated exists, wherein the dynamic library dependency list comprises a plurality of soname, S102, determining a target soname from the plurality of soname based on the dynamic library dependency list, S103, acquiring a real path of the target soname, S104, determining a dynamic library version library file corresponding to the target soname based on the real path of the target soname and loading the dynamic library version library file, S105, judging whether soname which does not determine the real path exists in the dynamic library dependency list, if yes, continuing to execute the step S102, and if no exists, ending the cycle.

Description

一种国产操作系统环境下动态库兼容方法及装置A dynamic library compatibility method and device under domestic operating system environment

技术领域Technical Field

本申请涉及计算机技术的领域,尤其涉及一种国产操作系统环境下动态库兼容方法及装置。The present application relates to the field of computer technology, and in particular to a method and device for dynamic library compatibility in a domestic operating system environment.

背景技术Background Art

随着国产操作系统的快速发展、大版本迭代升级已经成为常态,以适应不断变化的安全需求、性能标准和技术创新,其核心组件之一——动态链接库(Dynamic Library)也会经历相应的版本更迭。其中,soname作为动态库的唯一标识符,用于在运行时确定库的版本和位置。然而,当操作系统升级导致soname发生变更时,由于应用软件在老操作系统上编译链接时使用的是旧的动态库soname,当这些应用软件被移植到新操作系统时,可能因无法找到与之匹配的旧版soname而导致运行失败。这一现象严重阻碍了国产操作系统的平滑升级和已有应用生态的无缝迁移,这不仅影响了用户的正常使用,也增加了软件开发和维护的复杂度。With the rapid development of domestic operating systems, major version iteration upgrades have become the norm. In order to adapt to the ever-changing security requirements, performance standards and technological innovations, one of its core components, the dynamic link library (Dynamic Library), will also undergo corresponding version upgrades. Among them, soname is the unique identifier of the dynamic library, which is used to determine the version and location of the library at runtime. However, when the operating system upgrade causes soname to change, since the application software uses the old dynamic library soname when compiling and linking on the old operating system, when these application software are ported to the new operating system, they may fail to run because they cannot find the matching old version of soname. This phenomenon seriously hinders the smooth upgrade of domestic operating systems and the seamless migration of existing application ecosystems, which not only affects the normal use of users, but also increases the complexity of software development and maintenance.

目前应对动态库soname不兼容问题的策略主要有:The current strategies for dealing with dynamic library soname incompatibility issues are:

应用软件重编译:传统的做法通常是要求应用软件开发者针对新操作系统重新编译链接,以适配新的动态库soname。然而,这种做法既耗时又耗力,且对于大量的应用软件来说,实施起来非常困难,这种方法对于大量已停止维护或难以获取源代码的老旧应用来说并不适用,且增加了开发者的维护负担。此外,即使重新编译链接,也可能因为新操作系统与老操作系统在API层面的差异,导致应用软件无法正常运行。Recompile application software: The traditional approach is to require application software developers to recompile and link against the new operating system to adapt to the new dynamic library soname. However, this approach is time-consuming and labor-intensive, and is very difficult to implement for a large number of application software. This method is not applicable to a large number of old applications that have stopped maintenance or whose source code is difficult to obtain, and it increases the maintenance burden on developers. In addition, even if the link is recompiled, the application software may not run properly due to the differences in the API level between the new and old operating systems.

应用软件静态连接库:应用软件在老版本将所有外部库进行静态库链接。然而,静态库会增加应用软件的大小,而且在动态库更新时需要重新编译应用软件。这些方法不仅效率低下,而且给用户带来诸多不便。Application software statically links libraries: In the old version, the application software links all external libraries with static libraries. However, static libraries increase the size of the application software, and the application software needs to be recompiled when the dynamic library is updated. These methods are not only inefficient, but also bring a lot of inconvenience to users.

库版本回滚:通过操作系统包管理工具或第三方软件仓库提供旧版库的安装包,允许用户手动回退到与老应用兼容的库版本。但这种方法可能导致系统资源浪费、版本混乱以及潜在的安全风险,且并非所有历史库版本都能得到长期支持,同时,由于新老动态库软件包冲突,会导致系统功能异常。Library version rollback: Provide installation packages of old versions of libraries through operating system package management tools or third-party software repositories, allowing users to manually roll back to library versions compatible with old applications. However, this method may lead to waste of system resources, version confusion, and potential security risks. Not all historical library versions can be supported for a long time. At the same time, conflicts between new and old dynamic library packages may cause system malfunctions.

发明内容Summary of the invention

为解决国产操作系统大版本迭代升级后,由于动态库soname名称改变导致的应用软件兼容性问题,本发明提供了一种国产操作系统环境下动态库兼容方法及装置。In order to solve the application software compatibility problem caused by the change of dynamic library soname name after the major version iteration upgrade of the domestic operating system, the present invention provides a dynamic library compatibility method and device in the domestic operating system environment.

第一方面,本申请提供一种国产操作系统环境下动态库兼容方法,采用如下的技术方案:In the first aspect, the present application provides a dynamic library compatibility method in a domestic operating system environment, which adopts the following technical solution:

一种国产操作系统环境下动态库兼容方法,包括:A dynamic library compatibility method under a domestic operating system environment, comprising:

步骤S101,当存在需要运行的应用软件时,解析所述应用软件,得到所述应用软件对应的动态库依赖列表,所述动态库依赖列表中包括多个soname,所述soname为所述应用软件运行所需的soname;Step S101, when there is application software that needs to be run, the application software is parsed to obtain a dynamic library dependency list corresponding to the application software, wherein the dynamic library dependency list includes multiple sonames, and the sonames are sonames required for the application software to run;

步骤S102,基于所述动态库依赖列表从所述多个soname中确定出目标soname,所述目标soname是所述动态库以来列表中未执行过步骤S103的soname;Step S102, determining a target soname from the multiple sonames based on the dynamic library dependency list, wherein the target soname is a soname in the dynamic library dependency list that has not been subjected to step S103;

步骤S103,获取所述目标soname的真实路径;Step S103, obtaining the real path of the target soname;

步骤S104,基于所述目标soname的真实路径确定所述目标soname对应的动态库版本库文件并加载;Step S104, determining the dynamic library version library file corresponding to the target soname based on the real path of the target soname and loading it;

步骤S105,判断所述动态库依赖列表中是否存在未确定出真实路径的soname,若存在,则继续执行步骤S102,若未存在,则循环结束。Step S105, determining whether there is a soname whose real path has not been determined in the dynamic library dependency list, if so, continuing to execute step S102, if not, the loop ends.

在另一种可能实现的方式中,解析所述应用软件,得到所述应用软件对应的动态库依赖列表,包括:In another possible implementation, parsing the application software to obtain a dynamic library dependency list corresponding to the application software includes:

基于ELF文件结构解析能力,从二进制应用软件头部的DT_NEEDED区域中抽取包含在内的多项soname条目,并将所述多项soname条目整合为所述应用软件对应的动态库依赖列表。Based on the ELF file structure parsing capability, multiple soname entries contained in the DT_NEEDED area of the binary application software header are extracted, and the multiple soname entries are integrated into a dynamic library dependency list corresponding to the application software.

在另一种可能实现的方式中,获取目标soname的真实路径,包括:In another possible implementation, obtaining the real path of the target soname includes:

从soname多版本动态库仓库中获取目标soname的真实路径,所述soname多版本动态库仓库中包括多种版本的soname动态库以及每种版本的soname动态库对应的真实路径。The real path of the target soname is obtained from the soname multi-version dynamic library warehouse, wherein the soname multi-version dynamic library warehouse includes multiple versions of soname dynamic libraries and the real path corresponding to each version of the soname dynamic library.

在另一种可能实现的方式中,从soname多版本动态库仓库中获取目标soname的真实路径,之前还包括:In another possible implementation, the real path of the target soname is obtained from the soname multi-version dynamic library warehouse, which also includes:

当检测到存在新版本的动态库安装到操作系统时,为每个版本的动态库生成唯一的soname标识符,并得到多种版本的动态库分别对应的soname动态库;When a new version of a dynamic library is detected to be installed in the operating system, a unique soname identifier is generated for each version of the dynamic library, and soname dynamic libraries corresponding to the multiple versions of the dynamic libraries are obtained;

建立所述soname标识符与对应版本的动态库文件之间的关联,得到每个版本的soname动态库对应的真实路径;Establish an association between the soname identifier and the corresponding version of the dynamic library file to obtain the real path corresponding to each version of the soname dynamic library;

对多种版本的soname动态库以及每种版本的soname动态库对应的真实路径进行存储,得到soname多版本动态库仓库。Multiple versions of soname dynamic libraries and the real paths corresponding to each version of the soname dynamic library are stored to obtain a soname multi-version dynamic library warehouse.

第二方面,本申请提供一种国产操作系统环境下动态库兼容装置,采用如下的技术方案:In the second aspect, the present application provides a dynamic library compatibility device under a domestic operating system environment, which adopts the following technical solution:

一种国产操作系统环境下动态库兼容装置,包括:soname多版本动态库管理系统以及智能链接解析模块,其中,A dynamic library compatibility device under a domestic operating system environment includes: a soname multi-version dynamic library management system and an intelligent link parsing module, wherein:

智能链接解析模块:用于当存在需要运行的应用软件时,解析所述应用软件,得到所述应用软件对应的动态库依赖列表,基于所述动态库依赖列表从所述多个soname中确定出目标soname,所述动态库依赖列表中包括多个soname,所述soname为所述应用软件运行所需的soname;Intelligent link parsing module: used for parsing the application software when there is an application software to be run, obtaining a dynamic library dependency list corresponding to the application software, and determining a target soname from the multiple sonames based on the dynamic library dependency list, wherein the dynamic library dependency list includes multiple sonames, and the soname is the soname required for the application software to run;

soname多版本动态库管理系统:用于获取所述目标soname的真实路径,并基于所述目标soname的真实路径确定所述目标soname对应的动态库版本库文件。soname multi-version dynamic library management system: used to obtain the real path of the target soname, and determine the dynamic library version library file corresponding to the target soname based on the real path of the target soname.

在另一种可能的实现方式中,智能链接解析模块解析所述应用软件,得到所述应用软件对应的动态库依赖列表,包括:In another possible implementation, the intelligent link resolution module resolves the application software to obtain a dynamic library dependency list corresponding to the application software, including:

基于ELF文件结构解析能力,从二进制应用软件头部的DT_NEEDED区域中抽取包含在内的多项soname条目,并将所述多项soname条目整合为所述应用软件对应的动态库以来列表。Based on the ELF file structure parsing capability, multiple soname entries contained in the DT_NEEDED area of the binary application software header are extracted, and the multiple soname entries are integrated into a dynamic library dependency list corresponding to the application software.

在另一种可能的实现方式中,soname多版本动态库管理系统获取目标soname的真实路径,包括:In another possible implementation, the soname multi-version dynamic library management system obtains the real path of the target soname, including:

从soname多版本动态库仓库中获取目标soname的真实路径,所述soname多版本动态库仓库中包括多种版本的soname动态库以及每种版本的soname动态库对应的真实路径。The real path of the target soname is obtained from the soname multi-version dynamic library warehouse, wherein the soname multi-version dynamic library warehouse includes multiple versions of soname dynamic libraries and the real path corresponding to each version of the soname dynamic library.

在另一种可能的实现方式中,soname多版本动态库管理系统还包括:In another possible implementation, the soname multi-version dynamic library management system further includes:

当检测到存在新版本的动态库安装到操作系统时,为每个版本的动态库生成唯一的soname标识符,并得到多种版本的动态库分别对应的soname动态库;When a new version of a dynamic library is detected to be installed in the operating system, a unique soname identifier is generated for each version of the dynamic library, and soname dynamic libraries corresponding to the multiple versions of the dynamic libraries are obtained;

建立所述soname标识符与对应版本的动态库文件之间的关联,得到每个版本的soname动态库对应的真实路径;Establish an association between the soname identifier and the corresponding version of the dynamic library file to obtain the real path corresponding to each version of the soname dynamic library;

对多种版本的soname动态库以及每种版本的soname动态库对应的真实路径进行存储,得到soname多版本动态库仓库。Multiple versions of soname dynamic libraries and the real paths corresponding to each version of the soname dynamic library are stored to obtain a soname multi-version dynamic library warehouse.

综上所述,本申请包括以下有益技术效果:In summary, this application includes the following beneficial technical effects:

本申请提供了一种国产操作系统环境下动态库兼容装置,该装置包括soname多版本动态库管理系统以及智能链接解析模块,通过使用该装置执行本申请提供的一种国产操作系统环境下动态库兼容方法,使得当国产操作系统在进行大版本升级时,能够有效保障老版本应用软件的无缝迁移和兼容性运行,这种技术方案不仅保证了老版本应用软件的正常运行,还提高了用户体验和系统的稳定性。同时,由于避免了大规模的应用软件更新或重新编译,本申请还具有显著的经济效益和实用性,极大减轻了用户和企业的系统升级成本,提高了国产操作系统的市场接纳度和生态吸引力。此外,该装置为国产操作系统在保持技术进步的同时,提供了稳定的软件生态环境。The present application provides a dynamic library compatibility device under a domestic operating system environment, the device includes a soname multi-version dynamic library management system and an intelligent link parsing module, and the device is used to execute a dynamic library compatibility method under a domestic operating system environment provided by the present application, so that when the domestic operating system is undergoing a major version upgrade, the seamless migration and compatibility operation of the old version of the application software can be effectively guaranteed. This technical solution not only ensures the normal operation of the old version of the application software, but also improves the user experience and system stability. At the same time, since large-scale application software updates or recompilations are avoided, the present application also has significant economic benefits and practicality, greatly reducing the system upgrade costs of users and enterprises, and improving the market acceptance and ecological attractiveness of domestic operating systems. In addition, the device provides a stable software ecological environment for domestic operating systems while maintaining technological progress.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1是本申请实施例中的一种国产操作系统环境下动态库兼容的装置的总体架构图。FIG1 is a general architecture diagram of a dynamic library compatible device in a domestic operating system environment in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

以下结合附图对本申请作进一步详细说明。The present application is further described in detail below in conjunction with the accompanying drawings.

本领域技术人员在阅读完本说明书后可以根据需要对本实施例做出没有创造性贡献的修改,但只要在本申请的权利要求范围内都受到专利法的保护。After reading this specification, those skilled in the art may make non-creative modifications to this embodiment as needed, but such modifications are protected by patent law as long as they are within the scope of the claims of this application.

为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

另外,本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,如无特殊说明,一般表示前后关联对象是一种“或”的关系。In addition, the term "and/or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and/or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character "/" in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.

下面结合说明书附图对本申请实施例作进一步详细描述。The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.

如图1所示,在本申请实施例中提供了一种国产操作系统环境下动态库兼容装置,包括智能链接解析模块以及soname多版本动态库管理系统,其中,As shown in FIG1 , a dynamic library compatibility device is provided in a domestic operating system environment in an embodiment of the present application, including an intelligent link parsing module and a soname multi-version dynamic library management system, wherein:

一、soname多版本动态库管理系统1. soname multi-version dynamic library management system

用于在新操作系统内创建一个包含多种版本的动态库仓库,每种版本动态库按照对应的soname标识符进行有序组织和高效索引,确保快速定位和访问。It is used to create a dynamic library repository containing multiple versions in the new operating system. Each version of the dynamic library is organized and efficiently indexed according to the corresponding soname identifier to ensure fast positioning and access.

具体的,soname多版本动态库管理系统创建包含多种版本动态库的soname多版本动态库仓库,包括:Specifically, the soname multi-version dynamic library management system creates a soname multi-version dynamic library warehouse containing multiple versions of dynamic libraries, including:

当检测到存在新版本的动态库安装到操作系统时,为每个版本的动态库生成唯一的soname标识符,并得到多种版本的动态库分别对应的soname动态库,然后建立soname标识符与对应版本的动态库文件之间的关联,得到每个版本的soname动态库对应的真实路径,最后对多种版本的soname动态库以及每种版本的soname动态库对应的真实路径进行存储,从而得到soname多版本动态库仓库。When it is detected that a new version of a dynamic library is installed in the operating system, a unique soname identifier is generated for each version of the dynamic library, and the soname dynamic libraries corresponding to the multiple versions of the dynamic libraries are obtained. Then, an association is established between the soname identifier and the corresponding version of the dynamic library file, and the real path corresponding to each version of the soname dynamic library is obtained. Finally, the multiple versions of the soname dynamic libraries and the real path corresponding to each version of the soname dynamic library are stored, thereby obtaining a soname multi-version dynamic library warehouse.

其中为每个版本的动态库生成唯一的soname标识符时,可以根据动态库本身的版本信息生成,具体的动态库本身的版本信息是指动态库版本号,动态库版本号的命名格式通常为libname.so.x.y.z,其中x是主版本号(Major Version Number),y是次版本号(Minor Version Number),z是发布版本号(Release Version Number),soname是通过去掉动态库版本号中的次版本号和发布版本号得到的,格式为libname.so.x。其中,主版本号:表示库的重大升级,可能会改变原有的接口。不同主版本号的库是不兼容的,因此,为了保证向后兼容,不能删除旧的动态库的版本,次版本号表示库的增量升级,可能增加新的接口但保留原有接口;发布版本号则表示bug的修正和性能改进等,不添加新接口,也不更改接口。这两个版本号的变动通常不会打破向后兼容性。When generating a unique soname identifier for each version of a dynamic library, it can be generated based on the version information of the dynamic library itself. The specific version information of the dynamic library itself refers to the dynamic library version number. The naming format of the dynamic library version number is usually libname.so.x.y.z, where x is the major version number, y is the minor version number, and z is the release version number. The soname is obtained by removing the minor version number and the release version number from the dynamic library version number, and the format is libname.so.x. Among them, the major version number: indicates a major upgrade of the library, which may change the original interface. Libraries with different major version numbers are incompatible. Therefore, in order to ensure backward compatibility, the old dynamic library version cannot be deleted. The minor version number indicates an incremental upgrade of the library, which may add new interfaces but retain the original interfaces; the release version number indicates bug fixes and performance improvements, etc., and no new interfaces are added or changed. Changes in these two version numbers usually do not break backward compatibility.

进一步的,通过为每个动态库文件所在的目录创建一个指向它的软链接,从而达到建立soname标识符与对应版本的动态库文件之间的关联的目的,进而便于能够直接通过soname就能实现找到兼容的版本的动态库,且使得操作系统中可以同时存在多个版本的同一个动态库。Furthermore, by creating a soft link pointing to the directory where each dynamic library file is located, the purpose of establishing an association between the soname identifier and the corresponding version of the dynamic library file is achieved, thereby facilitating the direct use of soname to find a compatible version of the dynamic library, and allowing multiple versions of the same dynamic library to exist simultaneously in the operating system.

更进一步的,soname多版本动态库管理系统存在一个配置开关,当该配置开关处于开启状态时,若开启soname多版本动态库管理系统,则会将当前的soname多版本动态库环境设置成系统全局的搜索路径,然后与系统全局动态库环境并存,因此为了操作系统启动时就能将soname多版本动态库环境自动加载到系统全局搜索路径,所以该配置开关设置为默认开启状态。Furthermore, the soname multi-version dynamic library management system has a configuration switch. When the configuration switch is turned on, if the soname multi-version dynamic library management system is turned on, the current soname multi-version dynamic library environment will be set to the system's global search path, and then coexist with the system's global dynamic library environment. Therefore, in order to automatically load the soname multi-version dynamic library environment to the system's global search path when the operating system starts, the configuration switch is set to the default on state.

二、智能链接解析模块2. Intelligent link resolution module

用于自动识别当前应用软件对应的soname名称,并在soname多版本动态库管理系统中高效定位到对应的实际动态库路径文件,从而实现动态库的智能加载与管理,具体的,智能链接解析模块包括智能链接解析器、智能解析处理器以及智能解析加载器三部分。It is used to automatically identify the soname name corresponding to the current application software, and efficiently locate the corresponding actual dynamic library path file in the soname multi-version dynamic library management system, so as to realize the intelligent loading and management of the dynamic library. Specifically, the intelligent link resolution module includes three parts: intelligent link resolver, intelligent resolution processor and intelligent resolution loader.

通过结合智能链接解析模块以及soname多版本动态库管理系统实现国产操作系统环境下动态库兼容方法的具体实现过程如下:The specific implementation process of the dynamic library compatibility method under the domestic operating system environment by combining the intelligent link parsing module and the soname multi-version dynamic library management system is as follows:

步骤S101,当存在需要运行的应用软件时,解析应用软件,得到应用软件对应的动态库依赖列表。Step S101, when there is application software that needs to be run, the application software is parsed to obtain a dynamic library dependency list corresponding to the application software.

其中,动态库依赖列表中包括多个soname,soname为应用软件运行所需的soname。The dynamic library dependency list includes multiple sonames, and the soname is the soname required for the application software to run.

对于本申请实施例,在应用程序初始化阶段,即当检测到存在需要运行的应用软件时,智能链接解析模块即时启动运作,承担起从二进制代码深处发掘soname标识的重任。智能链接解析器依托于先进的ELF文件结构解析能力,深入探索二进制应用软件程序头部的DT_NEEDED区域,精细抽取包含在内的多项soname条目,并将这些关键的多项soname条目依赖整合为一份详实的应用软件对应的动态库依赖列表。For the embodiment of the present application, during the application initialization phase, that is, when the application software that needs to be run is detected, the intelligent link parsing module starts operating immediately and takes on the important task of discovering the soname identifier from the depths of the binary code. The intelligent link parser relies on the advanced ELF file structure parsing capability to deeply explore the DT_NEEDED area of the binary application software program header, finely extract the multiple soname entries contained therein, and integrate these key multiple soname entry dependencies into a detailed dynamic library dependency list corresponding to the application software.

其中,DT_NEEDED区域中包含所依赖的动态库的soname,假设文件A依赖于文件B,那么在文件A的DT_NEEDED区域中奖包含文件B的soname。Among them, the DT_NEEDED area contains the soname of the dependent dynamic library. Assuming that file A depends on file B, the soname of file B will be included in the DT_NEEDED area of file A.

步骤S102,基于动态库依赖列表从多个soname中确定出目标soname,其中,目标soname是动态库以来列表中未执行过步骤S103的soname。Step S102, determining a target soname from multiple sonames based on the dynamic library dependency list, wherein the target soname is a soname in the dynamic library dependency list that has not been executed in step S103.

步骤S103,获取目标soname的真实路径。Step S103, obtaining the real path of the target soname.

对于本申请实施例,通过智能解析处理器确定出目标soname的真实路径。For the embodiment of the present application, the real path of the target soname is determined by an intelligent parsing processor.

步骤S104,基于目标soname的真实路径确定目标soname对应的动态库版本库文件并加载。Step S104, determining the dynamic library version library file corresponding to the target soname based on the real path of the target soname and loading it.

对于本申请实施例,通过智能解析处理器基于目标soname的真实路径确定目标soname对应的动态库版本库文件,并通过智能解析加载器加载目标soname对应的动态库版本库文件。For the embodiment of the present application, the dynamic library version library file corresponding to the target soname is determined based on the real path of the target soname through the intelligent parsing processor, and the dynamic library version library file corresponding to the target soname is loaded through the intelligent parsing loader.

步骤S105,判断动态库依赖列表中是否存在未确定出真实路径的soname,若存在,则继续执行步骤S102,若未存在,则循环结束。Step S105, determining whether there is a soname whose real path has not been determined in the dynamic library dependency list, if so, continuing to execute step S102, if not, the loop ends.

对于本申请实施例,智能链接模块运用这份动态库依赖列表为导向,无缝接入预设的soname多版本动态库环境路径(由于soname多版本动态库环境配置默认开启,所以智能链接解析模块能立即获取到soname多版本动态库的真实路径),为应对Soname多版本挑战,该模块能无碍访问到每个Soname对应的全局系统动态库版本库文件的具体存储路径。通过循环遍历soname依赖清单,模块系统化地将Soname逐一对应到它们在文件系统中的精确位置,实现了从逻辑标识到物理路径的高效映射,然后根据映射结果,智能链接解析模块触发加载机制,确保每个soname所指代的恰当动态库版本被稳妥加载至应用程序的内存环境之中,全程自动化执行动态链接流程,对于应用程序来说是无感的,没有多余的操作步骤。这一系列动作,不仅极大简化了复杂的库管理任务,还从根本上强化了软件部署的灵活性与可靠性,标志着向更高效率及稳定性软件工程实践迈出的关键一步。For the embodiment of the present application, the intelligent link module uses this dynamic library dependency list as a guide to seamlessly access the preset soname multi-version dynamic library environment path (since the soname multi-version dynamic library environment configuration is enabled by default, the intelligent link parsing module can immediately obtain the real path of the soname multi-version dynamic library). To cope with the Soname multi-version challenge, the module can access the specific storage path of the global system dynamic library version library file corresponding to each Soname without hindrance. By looping through the soname dependency list, the module systematically maps Soname to their precise location in the file system one by one, realizing efficient mapping from logical identification to physical path, and then according to the mapping result, the intelligent link parsing module triggers the loading mechanism to ensure that the appropriate dynamic library version referred to by each soname is safely loaded into the memory environment of the application program, and the dynamic link process is fully automated, which is imperceptible to the application program and has no redundant operation steps. This series of actions not only greatly simplifies the complex library management tasks, but also fundamentally strengthens the flexibility and reliability of software deployment, marking a key step towards more efficient and stable software engineering practices.

以上仅是本申请的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above are only some implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims (8)

1.一种国产操作系统环境下动态库兼容方法,其特征在于,包括:1. A dynamic library compatibility method under a domestic operating system environment, characterized in that it includes: 步骤S101,当存在需要运行的应用软件时,解析所述应用软件,得到所述应用软件对应的动态库依赖列表,所述动态库依赖列表中包括多个soname,所述soname为所述应用软件运行所需的soname;Step S101, when there is application software that needs to be run, the application software is parsed to obtain a dynamic library dependency list corresponding to the application software, wherein the dynamic library dependency list includes multiple sonames, and the sonames are sonames required for the application software to run; 步骤S102,基于所述动态库依赖列表从所述多个soname中确定出目标soname,所述目标soname是所述动态库以来列表中未执行过步骤S103的soname;Step S102, determining a target soname from the multiple sonames based on the dynamic library dependency list, wherein the target soname is a soname in the dynamic library dependency list that has not been subjected to step S103; 步骤S103,获取所述目标soname的真实路径;Step S103, obtaining the real path of the target soname; 步骤S104,基于所述目标soname的真实路径确定所述目标soname对应的动态库版本库文件并加载;Step S104, determining the dynamic library version library file corresponding to the target soname based on the real path of the target soname and loading it; 步骤S105,判断所述动态库依赖列表中是否存在未确定出真实路径的soname,若存在,则继续执行步骤S102,若未存在,则循环结束。Step S105, determining whether there is a soname whose real path has not been determined in the dynamic library dependency list, if so, continuing to execute step S102, if not, the loop ends. 2.根据权利要求1所述的一种国产操作系统环境下动态库兼容方法,其特征在于,解析所述应用软件,得到所述应用软件对应的动态库依赖列表,包括:2. According to a method for dynamic library compatibility in a domestic operating system environment as described in claim 1, it is characterized in that parsing the application software to obtain a dynamic library dependency list corresponding to the application software includes: 基于ELF文件结构解析能力,从二进制应用软件头部的DT_NEEDED区域中抽取包含在内的多项soname条目,并将所述多项soname条目整合为所述应用软件对应的动态库依赖列表。Based on the ELF file structure parsing capability, multiple soname entries contained in the DT_NEEDED area of the binary application software header are extracted, and the multiple soname entries are integrated into a dynamic library dependency list corresponding to the application software. 3.根据权利要求1所述的一种国产操作系统环境下动态库兼容方法,其特征在于,获取目标soname的真实路径,包括:3. According to a method for dynamic library compatibility under a domestic operating system environment as described in claim 1, it is characterized in that obtaining the real path of the target soname includes: 从soname多版本动态库仓库中获取目标soname的真实路径,所述soname多版本动态库仓库中包括多种版本的soname动态库以及每种版本的soname动态库对应的真实路径。The real path of the target soname is obtained from the soname multi-version dynamic library warehouse, wherein the soname multi-version dynamic library warehouse includes multiple versions of soname dynamic libraries and the real path corresponding to each version of the soname dynamic library. 4.根据权利要求3所述的一种国产操作系统环境下动态库兼容方法,其特征在于,从soname多版本动态库仓库中获取目标soname的真实路径,之前还包括:4. According to a method for dynamic library compatibility under a domestic operating system environment as described in claim 3, it is characterized in that the real path of the target soname is obtained from the soname multi-version dynamic library warehouse, and before that, it also includes: 当检测到存在新版本的动态库安装到操作系统时,为每个版本的动态库生成唯一的soname标识符,并得到多种版本的动态库分别对应的soname动态库;When a new version of a dynamic library is detected to be installed in the operating system, a unique soname identifier is generated for each version of the dynamic library, and soname dynamic libraries corresponding to the multiple versions of the dynamic libraries are obtained; 建立所述soname标识符与对应版本的动态库文件之间的关联,得到每个版本的soname动态库对应的真实路径;Establish an association between the soname identifier and the corresponding version of the dynamic library file to obtain the real path corresponding to each version of the soname dynamic library; 对多种版本的soname动态库以及每种版本的soname动态库对应的真实路径进行存储,得到soname多版本动态库仓库。Multiple versions of soname dynamic libraries and the real paths corresponding to each version of the soname dynamic library are stored to obtain a soname multi-version dynamic library warehouse. 5.一种国产操作系统环境下动态库兼容装置,其特征在于,包括:soname多版本动态库管理系统以及智能链接解析模块,其中,5. A dynamic library compatibility device under a domestic operating system environment, characterized by comprising: a soname multi-version dynamic library management system and an intelligent link parsing module, wherein: 智能链接解析模块:用于当存在需要运行的应用软件时,解析所述应用软件,得到所述应用软件对应的动态库依赖列表,基于所述动态库依赖列表从所述多个soname中确定出目标soname,所述动态库依赖列表中包括多个soname,所述soname为所述应用软件运行所需的soname;Intelligent link parsing module: used for parsing the application software when there is an application software to be run, obtaining a dynamic library dependency list corresponding to the application software, and determining a target soname from the multiple sonames based on the dynamic library dependency list, wherein the dynamic library dependency list includes multiple sonames, and the soname is the soname required for the application software to run; soname多版本动态库管理系统:用于获取所述目标soname的真实路径,并基于所述目标soname的真实路径确定所述目标soname对应的动态库版本库文件。soname multi-version dynamic library management system: used to obtain the real path of the target soname, and determine the dynamic library version library file corresponding to the target soname based on the real path of the target soname. 6.根据权利要求5所述的一种国产操作系统环境下动态库兼容装置,其特征在于,智能链接解析模块解析所述应用软件,得到所述应用软件对应的动态库依赖列表,包括:6. The dynamic library compatibility device under a domestic operating system environment according to claim 5, characterized in that the intelligent link parsing module parses the application software to obtain a dynamic library dependency list corresponding to the application software, including: 基于ELF文件结构解析能力,从二进制应用软件头部的DT_NEEDED区域中抽取包含在内的多项soname条目,并将所述多项soname条目整合为所述应用软件对应的动态库以来列表。Based on the ELF file structure parsing capability, multiple soname entries contained in the DT_NEEDED area of the binary application software header are extracted, and the multiple soname entries are integrated into a dynamic library dependency list corresponding to the application software. 7.根据权利要求5所述的一种国产操作系统环境下动态库兼容装置,其特征在于,soname多版本动态库管理系统获取目标soname的真实路径,包括:7. The dynamic library compatibility device under a domestic operating system environment according to claim 5, characterized in that the soname multi-version dynamic library management system obtains the real path of the target soname, including: 从soname多版本动态库仓库中获取目标soname的真实路径,所述soname多版本动态库仓库中包括多种版本的soname动态库以及每种版本的soname动态库对应的真实路径。The real path of the target soname is obtained from the soname multi-version dynamic library warehouse, wherein the soname multi-version dynamic library warehouse includes multiple versions of soname dynamic libraries and the real path corresponding to each version of the soname dynamic library. 8.根据权利要求7所述的一种国产操作系统环境下动态库兼容装置,其特征在于,soname多版本动态库管理系统还包括:8. The dynamic library compatibility device under the domestic operating system environment according to claim 7, characterized in that the soname multi-version dynamic library management system also includes: 当检测到存在新版本的动态库安装到操作系统时,为每个版本的动态库生成唯一的soname标识符,并得到多种版本的动态库分别对应的soname动态库;When a new version of a dynamic library is detected to be installed in the operating system, a unique soname identifier is generated for each version of the dynamic library, and soname dynamic libraries corresponding to the multiple versions of the dynamic libraries are obtained; 建立所述soname标识符与对应版本的动态库文件之间的关联,得到每个版本的soname动态库对应的真实路径;Establish an association between the soname identifier and the corresponding version of the dynamic library file to obtain the real path corresponding to each version of the soname dynamic library; 对多种版本的soname动态库以及每种版本的soname动态库对应的真实路径进行存储,得到soname多版本动态库仓库。Multiple versions of soname dynamic libraries and the real paths corresponding to each version of the soname dynamic library are stored to obtain a soname multi-version dynamic library warehouse.
CN202410989609.XA 2024-07-23 2024-07-23 Dynamic library compatibility method and device under domestic operating system environment Pending CN118672644A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410989609.XA CN118672644A (en) 2024-07-23 2024-07-23 Dynamic library compatibility method and device under domestic operating system environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410989609.XA CN118672644A (en) 2024-07-23 2024-07-23 Dynamic library compatibility method and device under domestic operating system environment

Publications (1)

Publication Number Publication Date
CN118672644A true CN118672644A (en) 2024-09-20

Family

ID=92724866

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410989609.XA Pending CN118672644A (en) 2024-07-23 2024-07-23 Dynamic library compatibility method and device under domestic operating system environment

Country Status (1)

Country Link
CN (1) CN118672644A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119806633A (en) * 2024-12-13 2025-04-11 北京长擎软件有限公司 System migration compatibility analysis method, device, computer equipment and storage medium
CN120255954A (en) * 2025-06-05 2025-07-04 麒麟软件有限公司 An adaptive iterative software package replacement method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119806633A (en) * 2024-12-13 2025-04-11 北京长擎软件有限公司 System migration compatibility analysis method, device, computer equipment and storage medium
CN120255954A (en) * 2025-06-05 2025-07-04 麒麟软件有限公司 An adaptive iterative software package replacement method

Similar Documents

Publication Publication Date Title
CN102402427B (en) A kind of update method of java application and device
JP4878715B2 (en) Method, computer system and computer readable recording medium for patching applications that do not conform to operating system
US11249758B2 (en) Conditional branch frame barrier
CN108027722B (en) Dynamically updating applications in compilation and deployment
US5956479A (en) Demand based generation of symbolic information
JP5208350B2 (en) Self-describing software image update component
US8677345B2 (en) System for creating virtual application, method for installing virtual application, method for calling native API and method for executing virtual application
US8707287B2 (en) Method, computer program product, and system for non-blocking dynamic update of statically typed class-based object-oriented software
US5325533A (en) Engineering system for modeling computer programs
CN118672644A (en) Dynamic library compatibility method and device under domestic operating system environment
US8434054B2 (en) System and method for managing cross project dependencies at development time
CN100530108C (en) Method and system for calling function
WO2018072493A1 (en) Compiling method and compiling system
US20100153693A1 (en) Code execution with automated domain switching
US7765520B2 (en) System and method for managing cross project dependencies at development time
JP5401561B2 (en) Application of platform-dependent routines within a virtual mechanism by embedding native code in a class file
EP3207453A1 (en) Api versioning independent of product releases
CN117742725A (en) Code compilation method, electronic device and computer-readable storage medium
CN101002174A (en) Method for loading software with an intermediate object oriented language in a portable device
CN112579156B (en) A business event processing system, processing method, device and equipment
CN109558121A (en) Development approach, device, equipment and the storage medium of interface drive program
CN113778388A (en) Program development method and apparatus
WO2023169164A1 (en) Method and apparatus for restoring application program, and computer device and storage medium
CN113791809B (en) Application exception handling method and device and computer readable storage medium
CN119376741B (en) Java migration compatibility processing method, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination