Dynamic library compatibility method and device in domestic operating system environment
Through the dynamic library compatibility method, the real path of dynamic libraries in the operating system is analyzed and loaded, which solves the problem of application software compatibility after iteration of large versions of domestic operating systems, achieves seamless migration and high-stability operation, and reduces upgrade costs.
Patent Information
- Application Number
- CN202410989609.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-09-20
AI Technical Summary
After major version iterations of domestic operating systems, application software compatibility issues arise due to the change of the soname name of the dynamic library. Existing solution strategies such as recompilation, static link library and library version rollback have low efficiency, high complexity and security risks, hindering Smooth upgrade and seamless migration.
Adopt the dynamic library compatibility method and determine the real path of the target soname by parsing the dynamic library dependency list of the application software, and use the soname multi-version dynamic library management system and intelligent link analysis module to automatically load compatible dynamic library versions to ensure the stability of the application software. Works seamlessly.
It achieves seamless migration and compatibility operation of domestic operating systems during major version upgrades, improves user experience and system stability, reduces upgrade costs, and maintains technological progress and the stability of the software ecosystem.
Smart Images

Figure CN118672644A
Abstract
Description
Technical Field
[0001] 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
[0002] 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.
[0003] The current strategies for dealing with dynamic library soname incompatibility issues are: Recompile application software: Traditionally, application software developers are required to recompile and link against the new operating system to adapt to the new dynamic library soname. However, this approach is both 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 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.
[0004] 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.
[0005] 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
[0006] 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.
[0007] 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: 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; 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; Step S103, obtaining the real path of the target 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; 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.
[0008] In another possible implementation, parsing the application software to obtain a dynamic library dependency list corresponding to the application software includes: 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.
[0009] In another possible implementation, obtaining the real path of the target soname includes: 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.
[0010] In another possible implementation, the real path of the target soname is obtained from the soname multi-version dynamic library warehouse, which also includes: 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; 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; 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.
[0011] 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: 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: 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 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.
[0012] 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: 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.
[0013] In another possible implementation, the soname multi-version dynamic library management system obtains the real path of the target soname, including: 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.
[0014] In another possible implementation, the soname multi-version dynamic library management system further includes: 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; 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; 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.
[0015] In summary, this application includes the following beneficial technical effects: 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
[0016] Figure 1 It 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
[0017] The present application is further described in detail below in conjunction with the accompanying drawings.
[0018] 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.
[0019] 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.
[0020] 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.
[0021] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.
[0022] like Figure 1 As shown, in the embodiment of the present application, a dynamic library compatibility device is provided in a domestic operating system environment, including an intelligent link parsing module and a soname multi-version dynamic library management system, wherein: 1. soname multi-version dynamic library management system 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.
[0023] Specifically, the soname multi-version dynamic library management system creates a soname multi-version dynamic library warehouse containing multiple versions of dynamic libraries, including: 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.
[0024] 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.xyz, where x is the major version number (Major Version Number), y is the minor version number (Minor Version Number), and z is the release version number (Release Version Number). 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 does not add new interfaces or change interfaces. Changes in these two version numbers usually do not break backward compatibility.
[0025] 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.
[0026] 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.
[0027] 2. Intelligent link resolution module 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, thereby realizing 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.
[0028] 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: 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.
[0029] The dynamic library dependency list includes multiple sonames, and the soname is the soname required for the application software to run.
[0030] 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.
[0031] 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 is included in the DT_NEEDED area of file A.
[0032] 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.
[0033] Step S103, obtaining the real path of the target soname.
[0034] For the embodiment of the present application, the real path of the target soname is determined by an intelligent parsing processor.
[0035] 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.
[0036] 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.
[0037] 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.
[0038] 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.
[0039] 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
1. A dynamic library compatibility method under a domestic operating system environment, characterized in that: include: 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; 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; Step S103, obtaining the real path of the target 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; 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. The method for dynamic library compatibility under a domestic operating system environment according to claim 1, characterized in that: Parse the application software to obtain a dynamic library dependency list corresponding to the application software, including: 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. The method for dynamic library compatibility under a domestic operating system environment according to claim 1, characterized in that: Get the real path of the target soname, including: 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. The method for dynamic library compatibility under a domestic operating system environment according to claim 3, characterized in that: Get the real path of the target soname from the soname multi-version dynamic library warehouse, which also includes: 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; 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; 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. A dynamic library compatible device under a domestic operating system environment, characterized in that: include: soname multi-version dynamic library management system and intelligent link resolution module, among which, 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 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. 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: 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. 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: 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. The dynamic library compatibility device under a domestic operating system environment according to claim 7, characterized in that: The soname multi-version dynamic library management system also includes: 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; 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; 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.
Citation Information
Cited By
System migration compatibility analysis method and device, computer equipment and storage medium
CN119806633A
Self-adaptive iteration software package replacement method
CN120255954A
