Application compilation method, device, electronic device and storage medium

By obtaining the root file system containing the compilation tools and the compilation environment simulator, and simulating the compilation environment with the same system architecture, the difficulty of compiling applications under different system architectures is solved, and efficient cross-architecture compilation is achieved.

CN114168150BActive Publication Date: 2025-02-28DOUYIN VISION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111506045.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-10
Publication Date
2025-02-28
Estimated Expiration
2041-12-10

AI Technical Summary

Technical Problem

Existing compilation solutions cannot effectively handle application compilation between different system architectures, resulting in compilation failure or running errors, and multiple trial and error downloads are required to obtain the correct version of the software.

Method used

By obtaining the root file system corresponding to the application, the root file system includes at least a compilation tool and a compilation environment emulator, the compilation environment simulator is used to simulate a compilation environment that is the same as the system architecture applied to by the application, and the application is compiled in this environment.

Benefits of technology

It realizes effective compilation of applications under different system architectures, avoids compilation failures and operation errors, simplifies the download and trial and error process, and improves compilation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114168150B_ABST
    Figure CN114168150B_ABST
Patent Text Reader

Abstract

The present application proposes an application compilation method, device, electronic device and storage medium. The technical solution of the present application includes: in response to a compilation request of an application, obtaining a root file system that can compile the application; wherein the root file system at least includes the compilation tools and compilation environment simulator required by the application; using the compilation environment simulator in the root file system to simulate a compilation environment with the same system architecture as the system architecture to which the application is applied; deploying the application in the compilation environment, and using the compilation tools required by the application in the root file system to compile the application deployed in the compilation environment. By adopting the technical solution of the present application, it is possible to compile applications for different system architectures in the same host or virtual machine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an application compilation method, device, electronic device and storage medium. Background Art

[0002] For existing compilation solutions, software packages are generally compiled based on a local host, or a virtual machine is used to compile software packages. During the compilation process, some resources or programs (also called dependent packages) that the software package depends on need to be pre-installed in the local environment or the virtual machine environment, and then the compilation tool is called to compile the software package based on the pre-installed resources or programs.

[0003] However, the compilation environment of the software package depends on the system architecture of the host or virtual machine. If the host is an X86 architecture, the compilation environment created in the host can only be used to compile software packages for the X86 architecture. If the host downloads a software package for other systems, the software package cannot be compiled normally, or even if it can be compiled, the compiled software package will have errors or cannot be run during the actual operation process. Therefore, the host may need to download and try multiple times because there are multiple different versions of the software package for multiple different systems before downloading the correct version of the software for normal compilation. Summary of the invention

[0004] The embodiments of the present application provide an application compilation method, device, electronic device, and storage medium to solve the problems existing in the related technologies. The technical solutions are as follows:

[0005] In a first aspect, an embodiment of the present application provides an application compilation method, comprising:

[0006] In response to a compilation request of an application, based on a system architecture to which the application is applied, a root file system capable of compiling the application is obtained; wherein the root file system includes at least a compilation tool and a compilation environment simulator required by the application;

[0007] Using the compilation environment simulator in the root file system, simulating a compilation environment with a system architecture identical to the system architecture to which the application is applied;

[0008] The application is deployed in the compilation environment, and the application deployed in the compilation environment is compiled using a compilation tool required by the application in the root file system.

[0009] In a second aspect, an embodiment of the present application provides an application compilation device, including:

[0010] A root file system acquisition module, used to acquire a root file system capable of compiling the application based on the system architecture to which the application is applied; wherein the root file system at least includes a compilation tool and a compilation environment simulator required by the application;

[0011] A compilation environment simulation module, used to use a compilation environment simulator in the root file system to simulate a compilation environment with a system architecture identical to the system architecture to which the application is applied;

[0012] The application compiling module is used to deploy the application in the compiling environment and compile the application deployed in the compiling environment using the compiling tool required by the application in the root file system.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the application compilation method in any embodiment of the present application.

[0014] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, an application compilation method in any embodiment of the present application is implemented.

[0015] The advantages or beneficial effects of the above technical solution include at least:

[0016] In the technical solution provided by the present application, in response to the compilation request of the application, the root file system corresponding to the application is obtained, and the root file system of the application can be compiled. The root file system includes at least the compilation tools and the compilation environment simulator required for compiling the application. In this way, even if the system architecture to which the application is applied is different from the system architecture of the current execution subject, the compilation environment simulator in the root file system can still be used to simulate the compilation environment that is the same as the system architecture to which the application is applied, so that the application can be compiled in a suitable compilation environment. The present application implements that the same execution subject only uses one root file system to provide different compilation environments for applications of different system architectures, and can provide compilation functions for applications of different system architectures.

[0017] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.

[0019] Figure 1 is a flowchart of an application compilation method according to a first embodiment of the present application;

[0020] Figure 2 is a flowchart of an application compilation method according to a second embodiment of the present application;

[0021] Figure 3 is a structural block diagram of an application compiling device according to a third embodiment of the present application;

[0022] Figure 4 is a structural block diagram of an application compiling device according to a fourth embodiment of the present application;

[0023] Figure 5 The present invention is a structural block diagram of an electronic device that can implement the application program compilation method according to an embodiment of the present application. DETAILED DESCRIPTION

[0024] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.

[0025] Figure 1 A flowchart of an application compilation method according to a first embodiment of the present application is shown. As shown in 1, the method may include:

[0026] S110, in response to a compilation request of the application, based on the system architecture to which the application is applied, obtaining a root file system for compiling the application; wherein the root file system includes at least a compilation tool and a compilation environment simulator required by the application;

[0027] S120, using a compilation environment simulator in the root file system, simulating a compilation environment with a system architecture identical to the system architecture to which the application program is applied;

[0028] S130, deploying the application in the compilation environment, and using the compilation tool required by the application in the root file system to compile the application deployed in the compilation environment.

[0029] The compilation (compilation, compile) of an application includes two meanings, the process of generating a target program from a source program compiled from a source language using a compiler and the action of generating a target program using a compiler. The embodiment of the present application can provide a corresponding compiler for application to a processor, and the processor can execute the compilation method provided by the embodiment of the present application when running the compiler. The working process of the compiler translating a source program into a target program can be divided into five stages: lexical analysis, syntax analysis, semantic checking and intermediate code generation, code optimization, and target code generation. In layman's terms, compilation is to convert code into machine code that can be executed by a machine, and translate a program compiled in a certain programming language into an executable code or program described in a binary language that can be recognized by a computer.

[0030] When the kernel in the host or operating system starts up, it can mount the root file system into the memory through a series of initialization tasks to execute the corresponding application. The root file system needs to be formatted in advance according to a certain file system format and load the corresponding content data into it, such as files, resources or applications. After the kernel starts up, it will find the storage location of the root file system according to the startup parameters, and then mount the root file system.

[0031] For different applications, a suitable root file system can be built based on the type of application and its system architecture, or root file systems can be built for different applications in advance, and then the corresponding root file system can be provided for the application when needed.

[0032] In some embodiments, an initialized root file system or a root file system that has been used in the past can be provided, and the root file system can be modified to obtain the root file system required by the application program, so as to conveniently improve the resource utilization efficiency of the system.

[0033] Exemplarily, the above step S120, based on the system architecture to which the application is applied, obtaining the root file system for compiling the application may include:

[0034] Determine the compilation tools and compilation environment simulator required by the application based on the system architecture to which the application is applied;

[0035] Based on the compilation tools and compilation environment simulator required by the application, the root file system of the application is modified.

[0036] In this example, the compilation tool required by the application can be determined based on the format of the application. For example, an application in the dpkg (Debian Packager) format can use a compilation tool that can compile applications in the dpkg format. The compilation tools required for applications in different formats can be different or the same. If there are some compilation tools that can compile applications in multiple different formats, these multiple different formats include the dpkg format, and they can also be determined as the compilation tools required by the application.

[0037] In the case of multiple compilation tools, a compilation tool that can compile the application and whose compilation efficiency meets the set requirements can be selected. In some embodiments, it is also possible to determine whether the compilation tool is the compilation tool required by the application based on the usage frequency of the compilation tool. For example, if the application used compilation tool A with a usage frequency higher than a set threshold in the past, compilation tool A can be determined as the compilation tool required by the application.

[0038] In this exemplary embodiment, the compilation environment simulator required by the application can be determined based on the system architecture to which the application is applied. The compilation environment simulators required by applications of different system architectures may be the same or different. For example, for applications applied to the X86 architecture, a simulator that can simulate the compilation environment of the X86 architecture can be used; for applications applied to the ARM architecture (Acorn RISC Machine), a simulator that can simulate the compilation environment of the ARM architecture can be used. If there are some simulators that can simulate the compilation environments of multiple different system architectures, they can also be selected as the simulators required by the application.

[0039] When there are multiple simulators, you can choose a simulator that can compile a compilation environment that is the same as the system architecture used by the application and the effect of the compilation environment applied to the compilation meets the set requirements.

[0040] After determining the compilation tools and compilation environment simulator required by the application, the root file system can be modified based on these determined tools to obtain the root file system, or a new root file system can be created. The created new root file system needs to include the compilation tools and compilation environment simulator required by the above determined application.

[0041] Exemplarily, the compilation tool and the compilation environment simulator required by the application program modify the root file system of the application program, including at least one of the following:

[0042] In the case that the root file system of the application does not include the compilation tool required by the application, adding the compilation tool required by the application to the root file system;

[0043] In a case where the root file system includes a compilation tool not required by the application, deleting the compilation tool not required by the application in the root file system;

[0044] In the case that the root file system does not include the compilation environment simulator required by the application, the compilation environment simulator required by the application is added to the root file system.

[0045] In this example, the modification tool of the root file system can be called to modify the root file system as described above. The initial root file system can provide some commonly used compilation tools for applications, such as gcc (GNU Compiler Collection), crypt (an encryption function), ACL (Access Control Lists), debconf (a software package configuration management system), libc library (a function library standard), etc. Then, the initial root file system is modified, which can improve the efficiency of obtaining a suitable root file system.

[0046] In some embodiments, if the existing root file system meets the requirements of the application program, the root file system can be directly obtained. For the root file system that meets the requirements of the application program, it includes the compilation tool and the compilation environment simulator required by the application program.

[0047] Of course, you can still modify the root file system, for example, delete unnecessary tools, replace more efficient compilation tools and compilation environment simulators.

[0048] In some embodiments, the root file systems corresponding to applications of different system architectures may be different. For applications, a root file system may be configured for each system architecture, and the root file system may include a compilation environment simulator of the corresponding system architecture. For example, the root file systems of the X86 architecture and the ARM architecture may be configured separately, the root file system of the X86 architecture includes a simulator that can simulate the compilation environment of the X86 architecture, and the root file system of the ARM architecture includes a simulator that can simulate the compilation environment of the ARM architecture.

[0049] Therefore, in some embodiments, corresponding root file systems may be configured in advance for applications of different system architectures. When a compilation request for an application is received, the root file system corresponding to the system architecture to which the application is applied is obtained.

[0050] In some embodiments, a root file system may be configured for multiple system architectures. The root file system may include multiple simulators. Each simulator may compile a compilation environment for a set system architecture. The applicable system architectures of the compilation environments compiled by different simulators may be different.

[0051] In some embodiments, a root file system can be configured for multiple system architectures, and the root file system can include one or more cross-compilation environment simulators, each of which can compile compilation environments of at least two set system architectures. For example, cross-compilation environment simulator A can compile a compilation environment for an X86 architecture, and can also compile a compilation environment for an ARM architecture.

[0052] Therefore, in some embodiments, the above S120, using the compilation environment simulator in the root file system to simulate a compilation environment having a system architecture identical to the architecture of the system to which the application is applied, may include:

[0053] Based on the system architecture to which the application is applied, obtain the corresponding compilation environment simulator in the root file system;

[0054] The obtained compilation environment simulator is used to simulate a compilation environment whose system architecture is the same as the system architecture to which the application is applied.

[0055] In some embodiments, the compilation environment module obtained in the root file system may only compile a compilation environment of one system architecture, where the system architecture is the system architecture to which the application is applied.

[0056] In some embodiments, the obtained compilation environment simulator can compile compilation environments of multiple different system architectures, and the multiple different system architectures at least include the system architecture to which the application is applied. In this example, the root file system can use a compilation environment simulator to implement cross-simulation of the compilation environment.

[0057] In the above step S130, after the compilation environment is constructed, the application can be parsed to obtain a list of compilation dependency packages of the application. Then, the compilation dependency packages of the application are obtained according to the list, and the compilation dependency packages are deployed in the compilation environment. At the same time, or before or after the deployment of the dependency packages, the application can also be deployed in the compilation environment. In this way, in the compilation environment, the compilation tool in the root file system is used to compile the application based on the compilation dependency packages of the application, and the compilation result of the application can be obtained. The compilation result may include the executable code of the application.

[0058] Figure 2 A block diagram of an application compilation method provided in the second embodiment of the present application is shown.

[0059] like Figure 2 As shown, the host receives the instruction to start the work and uses the CPU and memory resources of the host to start the work. When the host is started, a cross-compilation execution program that can execute the application compilation method provided in the embodiment of the present application can also be started. Alternatively, when a start request of the cross-compilation execution program is received, the cross-compilation execution program is started.

[0060] The cross-compilation execution program responds to the compilation request of the application, calls the cross-compilation parsing program, parses the application, obtains the version information of the application, such as the system architecture, format, creation date, etc. to which it is applied, and also obtains the compilation dependency list of the application. According to the compilation dependency list of the application, the compilation dependency package of the application can be obtained. Two different parsing methods can be used to parse the version information and the compilation dependency list of the application respectively. These two different parsing methods can be expressed in different programming languages. In some embodiments, these two different parsing methods can also be integrated together and expressed in the same programming language.

[0061] The cross-compilation execution program can obtain the root file system that can compile the application based on the version information of the application, such as the system architecture to which the application is applied. This root file system is also called a lightweight compilation system because its composition structure is relatively simple and occupies less host resources. In this example, the lightweight compilation system can provide compilation functions for multiple applications applied to different system architectures, so it can also be called a lightweight cross-compilation system.

[0062] The cross-compilation execution program obtains a cross-compilation environment simulator from the lightweight cross-compilation system, and uses the cross-compilation environment simulator to simulate a compilation environment that is the same as the system architecture to which the application is applied.

[0063] The cross-compilation executor obtains the compilation dependency packages of the application according to the compilation dependency list of the application, and deploys the compilation dependency packages in the compilation environment.

[0064] The cross-compilation executor also deploys the application in the compilation environment, and then uses the compilation tool in the lightweight cross-compilation system to compile the application based on the compilation dependency package deployed in the compilation environment.

[0065] In this example, the host provides CPU and memory resources. The constructed root file system can at least provide the following functions: start the compilation execution program, load the compilation parser, obtain compilation dependency information, install the lightweight cross-compilation system required for compilation, and execute compilation.

[0066] In this example, the root file system is used to provide the application with appropriate compilation tools and compilation environment, and to provide appropriate compilation functions for applications of different system architectures. In addition, the root file system is easy to tailor, occupies less system resources, and has high compilation efficiency.

[0067] Figure 3 FIG. 4 is a block diagram of an application program compiling device provided in the third embodiment of the present application. Figure 3 As shown, the application compilation device may include:

[0068] A root file system acquisition module 310 is used to obtain a root file system capable of compiling the application in response to a compilation request of the application; wherein the root file system at least includes a compilation tool and a compilation environment simulator required by the application;

[0069] A compilation environment simulation module 320, used to use a compilation environment simulator in the root file system to simulate a compilation environment with a system architecture identical to the system architecture to which the application is applied;

[0070] The application compiling module 330 is used to deploy the application in the compiling environment and compile the application deployed in the compiling environment using the compiling tool required by the application in the root file system.

[0071] Figure 4 FIG. 4 shows a block diagram of an application program compilation device provided by a fourth embodiment of the present application. Figure 4 As shown, the device includes a root file system acquisition module 310, a compilation environment simulation module 320 and an application compilation module 330. Among them, the root file system acquisition module 410, the compilation environment simulation module 420 and the application compilation module 430 have the same functions as the root file system acquisition module 310, the compilation environment simulation module 320 and the application compilation module 330 in the above embodiment, and will not be described in detail here.

[0072] In some embodiments, Figure 4 As shown, the root file system acquisition module 410 may include:

[0073] An information determining unit 411 is used to determine, in response to a compilation request of an application, a compilation tool and a compilation environment simulator required by the application based on a system architecture to which the application is applied;

[0074] The root file system modification unit 412 is used to modify the root file system of the application based on the compilation tool and the compilation environment simulator required by the application.

[0075] In some embodiments, the root file system modification unit 412 is used for at least one of the following:

[0076] In a case where the root file system of the application does not include the compilation tool required by the application, adding the compilation tool required by the application to the root file system;

[0077] In a case where the root file system includes a compilation tool not required by the application, deleting the compilation tool not required by the application in the root file system;

[0078] In the case that the root file system does not include the compiling environment simulator required by the application, the compiling environment simulator required by the application is added to the root file system.

[0079] In some embodiments, the compilation environment simulation module 420 includes:

[0080] The simulator acquisition unit 421 is used to acquire a corresponding compilation environment simulator in the root file system based on the system architecture to which the application is applied;

[0081] The simulator working unit 422 is used to use the obtained compilation environment simulator to simulate a compilation environment having a system architecture that is the same as the system architecture to which the application is applied.

[0082] In some embodiments, the obtained compilation environment simulator can compile compilation environments of multiple different system architectures, and the multiple different system architectures at least include the system architecture to which the application is applied.

[0083] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and will not be repeated here.

[0084] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.

[0085] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0086] like Figure 5 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0087] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0088] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as an application compilation method. For example, in some embodiments, the application compilation method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the application compilation method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the application compilation method in any other appropriate manner (e.g., by means of firmware).

[0089] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0090] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0091] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0092] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0093] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0094] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0095] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0096] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A method for compiling an application, characterized in that: include: In response to a compilation request of an application, based on the system architecture to which the application is applied, a root file system capable of compiling the application is obtained; wherein the root file system at least includes a compilation tool and a compilation environment simulator required by the application, and applications of different system architectures correspond to different root file systems; Using the compilation environment simulator in the root file system, simulating a compilation environment with a system architecture identical to the system architecture to which the application is applied; Deploy the application in the compilation environment, and compile the application deployed in the compilation environment using a compilation tool required by the application in the root file system; The step of obtaining a root file system capable of compiling the application based on the system architecture to which the application is applied comprises: Determine the compilation tool and compilation environment simulator required by the application based on the system architecture to which the application is applied; Based on the compilation tool and the compilation environment simulator required by the application, the root file system of the application is modified.

2. The method according to claim 1, characterized in that The modifying of the root file system of the application based on the compilation tool and the compilation environment simulator required by the application includes at least one of the following: In a case where the root file system of the application does not include the compilation tool required by the application, adding the compilation tool required by the application to the root file system; In a case where the root file system includes a compilation tool not required by the application, deleting the compilation tool not required by the application in the root file system; In the case that the root file system does not include the compiling environment simulator required by the application, the compiling environment simulator required by the application is added to the root file system.

3. The method according to claim 1 or 2, characterized in that: The using the compilation environment simulator in the root file system to simulate a compilation environment having a system architecture identical to the architecture of the system to which the application is applied comprises: Based on the system architecture to which the application is applied, obtaining a corresponding compilation environment simulator in the root file system; The obtained compilation environment simulator is used to simulate a compilation environment having a system architecture identical to the system architecture to which the application is applied.

4. The method according to claim 3, characterized in that The obtained compilation environment simulator can compile compilation environments of multiple different system architectures, and the multiple different system architectures at least include the system architecture to which the application is applied.

5. An application compilation device, characterized in that: include: A root file system acquisition module, used to respond to a compilation request of an application and, based on the system architecture to which the application is applied, acquire a root file system for compiling the application; wherein the root file system at least includes a compilation tool and a compilation environment simulator required by the application, and applications of different system architectures correspond to different root file systems; A compilation environment simulation module, used to use a compilation environment simulator in the root file system to simulate a compilation environment with a system architecture identical to the system architecture to which the application is applied; An application compiling module, used to deploy the application in the compiling environment, and compile the application deployed in the compiling environment using a compiling tool required by the application in the root file system; The root file system acquisition module includes: An information determination unit, used to determine the compilation tool and compilation environment simulator required by the application based on the system architecture to which the application is applied; The root file system modification unit is used to modify the root file system of the application based on the compilation tool and the compilation environment simulator required by the application.

6. The device according to claim 5, characterized in that The root file system modification unit is used for at least one of the following: In a case where the root file system of the application does not include the compilation tool required by the application, adding the compilation tool required by the application to the root file system; In a case where the root file system includes a compilation tool not required by the application, deleting the compilation tool not required by the application in the root file system; In the case that the root file system does not include the compiling environment simulator required by the application, the compiling environment simulator required by the application is added to the root file system.

7. The device according to claim 5 or 6, characterized in that The compilation environment simulation module includes: A simulator acquisition unit, configured to acquire a corresponding compilation environment simulator in the root file system based on the system architecture to which the application is applied; The simulator working unit is used to use the obtained compilation environment simulator to simulate a compilation environment whose system architecture is the same as the system architecture to which the application is applied.

8. The device according to claim 7, characterized in that The obtained compilation environment simulator can compile compilation environments of multiple different system architectures, and the multiple different system architectures at least include the system architecture to which the application is applied.

9. An electronic device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 4.

10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Method for realizing cross compiling of Docker mirror image

    CN111309451A

  • Compiling method, device and equipment and storage medium

    CN112256278A