Program compiling method, electronic equipment and program product

By receiving compilation instructions, determining the configuration files and compiling tools of the target operating system, and compiling the programs to be compiled in sequence, solving the problem of manually setting multiple configuration files and compiling multiple times in software development, improving development efficiency.

CN119718333AInactive Publication Date: 2025-03-28NIO TECH ANHUI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411902087.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-03-28
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

During the software development process, R&D personnel need to manually set up multiple different configuration files and compile the compiled programs multiple times, resulting in reduced development efficiency.

Method used

Provide a program compilation method, by receiving compilation instructions, determine the configuration file of the program to be compiled in the target operating system, and determine the target compilation tool based on the configuration file, and compile the program to be compiled through each target compilation tool in turn to generate the target program file corresponding to the target operating system.

Benefits of technology

There is no need for R&D personnel to manually write configuration files, automatically generate configuration files corresponding to the target operating system, and automatically compile the program to be compiled into program files corresponding to the target operating system, reducing the software compilation time of R&D personnel and improving software development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718333A_ABST
    Figure CN119718333A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is suitable for the technical field of computers, and provides a program compiling method, electronic equipment and a program product.The method comprises the steps that a compiling instruction for a to-be-compiled program is received, and the compiling instruction indicates to compile the to-be-compiled program; in response to the compiling instruction, determining at least one configuration file corresponding to the to-be-compiled program in the target operating system; the target operating system is a test operating system or a running operating system of the to-be-compiled program; determining at least one target compiling tool of the to-be-compiled program in a target operating system according to the at least one configuration file; and compiling the to-be-compiled program through each target compiling tool in sequence to obtain a target program file corresponding to the to-be-compiled program in the target operating system. Through the method provided by the embodiment of the invention, the electronic equipment can automatically compile the to-be-compiled program into the program file corresponding to the target operating system, so that the development efficiency of software is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application belong to the field of computer technology, and in particular, relate to a program compilation method, an electronic device, and a program product. Background Art

[0002] During the program development process, since developers need to use testing tools running in a specified operating system to develop and test the program, it may happen that the operating system used during program testing is inconsistent with the operating system on which the program actually runs.

[0003] In the prior art, when the operating system during program testing (referred to as the test operating system) is inconsistent with the operating system actually running (referred to as the running operating system), the R&D personnel need to set different configuration files for the test operating system and the running operating system at the same time, and compile the to-be-compiled program according to the two configuration files to generate program files suitable for different operating systems. It can be seen that during the software development process, the R&D personnel need to manually set multiple different configuration files and compile the to-be-compiled program multiple times, thereby reducing the software development efficiency. Summary of the invention

[0004] In view of this, embodiments of the present application provide a program compiling method, an electronic device, and a program product to improve software development efficiency.

[0005] A first aspect of an embodiment of the present application provides a program compiling method, comprising:

[0006] receiving a compiling instruction for a program to be compiled, wherein the compiling instruction instructs compiling the program to be compiled;

[0007] In response to the compiling instruction, determining at least one configuration file corresponding to the program to be compiled in a target operating system; the target operating system is a test operating system or a running operating system of the program to be compiled;

[0008] Determine at least one target compilation tool for the program to be compiled in the target operating system according to the at least one configuration file;

[0009] The program to be compiled is compiled by each of the target compilation tools in turn to obtain a target program file corresponding to the program to be compiled in the target operating system.

[0010] In a possible implementation manner of the first aspect, the target operating system is a first operating system and the compile instruction is an application layer compile instruction, and the second compiling the program to be compiled by each of the target compilation tools to obtain a target program file corresponding to the program to be compiled in the target operating system includes:

[0011] At least one application layer submodule program of the application layer in the program to be compiled is compiled in sequence by each of the target compilation tools to obtain an application layer file; the target program file includes the application layer file.

[0012] In a possible implementation of the first aspect, the first operating system is a vxworks system, and the method further includes, before compiling the program to be compiled by each of the target compilation tools to obtain a target program file corresponding to the target operating system, the following steps:

[0013] When there is no kernel file corresponding to the program to be compiled in the database, compiling at least one kernel submodule program by each of the target compilation tools in turn to obtain the kernel file; the at least one kernel submodule program is a program corresponding to the kernel level in the program to be compiled;

[0014] In the case that the database contains a kernel file corresponding to the program to be compiled, the kernel file is obtained from the database.

[0015] In a possible implementation manner of the first aspect, the target operating system is a second operating system and the compile instruction is any one of an application layer compile instruction or a kernel compile instruction;

[0016] The step of compiling the program to be compiled by each of the target compilation tools in sequence to obtain a target program file corresponding to the program to be compiled in the target operating system includes:

[0017] Acquire at least one submodule program from the program to be compiled based on the compilation instruction;

[0018] The at least one sub-module program is compiled in sequence by each of the target compilation tools to obtain the target program file.

[0019] In a possible implementation manner of the first aspect, the program to be compiled includes multiple sub-module programs in any level, and the program to be compiled is compiled by each of the target compilation tools in sequence to obtain a target program file corresponding to the program to be compiled in the target operating system, including:

[0020] According to the compilation order of the plurality of sub-module programs, each of the sub-module programs is compiled in turn using at least one of the target compilation tools to obtain a program sub-file corresponding to each of the sub-module programs;

[0021] The target program file is obtained based on the program sub-files respectively corresponding to the plurality of sub-module programs.

[0022] In a possible implementation of the first aspect, before sequentially compiling each of the sub-module programs using at least one of the target compilation tools according to the compilation order of the multiple sub-module programs to obtain a program sub-file corresponding to each of the sub-module programs, the method further includes:

[0023] For any of the sub-module programs in any level, obtaining a parameter mapping relationship describing data interaction between the sub-module program and other sub-module programs in any level;

[0024] The compilation order between the plurality of sub-module programs in any level is determined based on all parameter mapping relationships.

[0025] In a possible implementation manner of the first aspect, before obtaining, for any of the sub-module programs in any level, a parameter mapping relationship describing data interaction between the sub-module program and other sub-module programs in any level, the method further includes:

[0026] Determining a compilation range corresponding to the target operating system according to a preset program switch template and a system identifier of the target operating system;

[0027] At least one sub-module program corresponding to the target operating system is determined from all candidate compilation modules corresponding to the program to be compiled based on the compilation range corresponding to the target operating system.

[0028] In a possible implementation manner of the first aspect, obtaining the target program file based on the program sub-files respectively corresponding to the plurality of sub-module programs includes:

[0029] All the program sub-files are compressed and packaged by a file packaging tool to obtain the target program file.

[0030] In a possible implementation manner of the first aspect, determining, in response to the compile instruction, at least one configuration file corresponding to the program to be compiled in the target operating system includes:

[0031] Determining compilation parameters corresponding to the program to be compiled based on the project identifier corresponding to the program to be compiled;

[0032] At least one configuration file corresponding to the program to be compiled is generated based on the compilation parameters and the configuration template.

[0033] In a possible implementation manner of the first aspect, determining at least one target compilation tool for the program to be compiled in the target operating system according to the at least one configuration file includes:

[0034] Determining at least one candidate compilation tool for the program to be compiled in the target operating system;

[0035] The at least one target compilation tool is obtained by configuring the properties of at least one candidate compilation tool through at least one of the configuration files.

[0036] In a possible implementation manner of the first aspect, after sequentially compiling the program to be compiled by each of the target compilation tools to obtain a target program file corresponding to the target operating system, the method further includes:

[0037] An image file corresponding to the target program file is generated based on the image parameters corresponding to the target operating system.

[0038] A second aspect of an embodiment of the present application provides a program compiling device, including:

[0039] A receiving module, configured to receive a compiling instruction for a program to be compiled, wherein the compiling instruction instructs compiling the program to be compiled;

[0040] A first determining module is used to determine, in response to the compiling instruction, at least one configuration file corresponding to the program to be compiled in a target operating system; the target operating system is a test operating system or a running operating system of the program to be compiled;

[0041] A second determining module, configured to determine at least one target compiling tool for the program to be compiled in the target operating system according to the at least one configuration file;

[0042] The compiling module is used to compile the program to be compiled by each of the target compiling tools in turn to obtain the target program file corresponding to the program to be compiled in the target operating system.

[0043] A third aspect of an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the program compilation method as described in the first aspect above is implemented.

[0044] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the program compilation method as described in the first aspect above is implemented.

[0045] A fifth aspect of the embodiments of the present application provides a computer program product. When the computer program product is run on a computer, the computer executes the program compiling method described in the first aspect.

[0046] Compared with the prior art, the embodiments of the present application have the following advantages:

[0047] In an embodiment of the present application, an electronic device can receive a compilation instruction for a program to be compiled; wherein the compilation instruction can be used to instruct the electronic device to compile the program to be compiled; the electronic device can determine at least one configuration file corresponding to the program to be compiled in the target operating system in response to the compilation instruction; wherein the target operating system can be a test operating system or a running operating system of the program to be compiled; then, the electronic device can determine at least one target compilation tool of the program to be compiled in the target operating system according to at least one configuration file; the electronic device can compile the program to be compiled through each target compilation tool in turn to obtain the target program file corresponding to the program to be compiled in the target operating system. Through the method provided in this embodiment, the electronic device can automatically generate a configuration file corresponding to the target operating system without the need for the R&D personnel to manually write a configuration file, and automatically compile the program to be compiled into a program file corresponding to the target operating system based on the configuration file. Therefore, the method provided in this embodiment can reduce the software compilation time of the R&D personnel, thereby improving the software development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or prior art descriptions. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0049] Figure 1 is a schematic diagram of a program compilation method provided in an embodiment of the present application;

[0050] Figure 2 This is a schematic diagram of a compilation process provided by an embodiment of the present application;

[0051] Figure 3 is a schematic diagram of another program compilation method provided in an embodiment of the present application;

[0052] Figure 4 It is a schematic diagram of a program compilation framework provided in an embodiment of the present application;

[0053] Figure 5 is a schematic diagram of a program compiling device provided in an embodiment of the present application;

[0054] Figure 6 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In the following description, specific details such as specific system structures, technologies, etc. are proposed for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from hindering the description of the present application.

[0056] The technical solution of the present application is described below through specific embodiments.

[0057] Reference Figure 1 , shows a schematic diagram of a program compilation method provided by an embodiment of the present application, the program compilation method can be applied to electronic devices such as computers, tablet computers, smart phones, etc., the program compilation method can also be applied to servers, or terminals installed with client programs that provide online services through the server, and the electronic devices of the execution subject are not limited here. The above program compilation method can specifically include the following steps:

[0058] S101: Receive a compile instruction for a program to be compiled.

[0059] In this embodiment, when the R&D personnel compiles a program to be compiled, the R&D personnel can initiate a compilation instruction to the electronic device to instruct the electronic device to compile the program to be compiled. The electronic device can receive the compilation instruction initiated by the R&D personnel. Specifically, when the electronic device is a computer, a tablet computer, a smart phone or other device, the R&D personnel can directly select the program to be compiled on the electronic device or input the program to be compiled on the electronic device, and input the system identifier corresponding to the target operating system to the electronic device to generate the compilation instruction. When the electronic device is a server of a certain compilation system, the R&D personnel can select the program to be compiled on a terminal device installed with a client program that provides online services through the server or input the program to be compiled on the terminal device, and input the system identifier corresponding to the target operating system to the terminal device. The terminal device can generate a compilation instruction based on the program to be compiled and the system identifier, and send the compilation instruction to the server through a preset data transmission channel.

[0060] S102: In response to the compiling instruction, determine at least one configuration file corresponding to the program to be compiled in the target operating system.

[0061] In this embodiment, after receiving the compilation instruction, the electronic device can respond to the compilation instruction and determine the target operating system corresponding to the system to be compiled from multiple candidate operating systems. Among them, the compilation instruction may include a system identifier corresponding to the target operating system. The electronic device may include multiple candidate operating systems, and each candidate compilation system may correspond to a different system identifier. Specifically, the candidate operating system at least includes a test operating system that the R&D personnel need to use for software testing of the program to be compiled and a running operating system that the program to be compiled actually needs to run. The candidate operating system in the electronic device may include but is not limited to vxworks system, windows system, Android system, Linux system, QNX system, etc. After determining the target operating system corresponding to the compilation instruction, the electronic device can determine at least one candidate compilation tool required to be used by the program to be compiled from multiple compilation tools corresponding to the target operating system according to the program to be compiled. After determining at least one candidate compilation tool required to be used by the program to be compiled, the electronic device can generate at least one configuration file corresponding to the program to be compiled according to the target operating system and the candidate compilation tool.

[0062] In this embodiment, since the electronic device can automatically generate a configuration file corresponding to the program to be compiled, the user does not need to write or modify the configuration file for a separate platform. It can be seen that the method provided in this embodiment can improve development efficiency and reusability of the configuration file.

[0063] In one possible implementation, before a user compiles a program to be compiled through an electronic device, the user may first store the program to be compiled, external libraries required for compilation, a virtual machine manager (Hypervisor), various candidate operating systems, and other compilation data required for the compilation process in a storage path pre-set by the R&D personnel. Among them, the external library may store sub-module programs that need to be called by the program to be compiled to implement specific functions or services. The virtual machine manager can be used to create and manage multiple virtual machines on an electronic device. Before the electronic device compiles the program to be compiled, it may first build a unified compilation environment through a compilation container. Therefore, before the user initiates a compilation instruction to the electronic device, he may also initiate an environment building instruction to the electronic device. In response to the environment building instruction initiated by the user, the electronic device may start the compilation container pre-set by the R&D personnel. Exemplarily, the compilation container in the electronic device may be a Docker container. Figure 2 As shown, a schematic diagram of a compilation process provided by an embodiment of the present application is shown. Figure 2After starting the compilation container, the electronic device can map all the contents under the storage path to the compilation path of the compilation container and record the mapping relationship between the storage path and the compilation path. After mapping all the contents under the storage path to the compilation path of the compilation container, the electronic device can respond to the compilation instruction initiated by the user and execute steps S102 to S104 in the compilation container to compile the program to be compiled and generate a program file corresponding to the program to be compiled.

[0064] In this embodiment, before the electronic device compiles the program to be compiled, it first maps the compilation data needed in the compilation process to the compilation container, and then compiles the program to be compiled in the compilation container. This not only ensures the consistency of the compilation environment, but also effectively avoids the dependence of the electronic device's own operating system during software compilation, so that electronic devices using any operating system can compile program files corresponding to different target operating systems.

[0065] The configuration file generated by the electronic device may include, but is not limited to, the compilation parameters of the program to be compiled, the external library required by the program to be compiled, the storage path of the external library, the environment variables required for compilation, the storage path of the environment variables, the storage path of the candidate compilation tool in the electronic device, etc. Specifically, the compilation parameters in the configuration file may include the optimization level of the compilation tool, the type of compiler, the C++ standard, etc.

[0066] In a possible implementation, the electronic device can determine at least one candidate compilation tool corresponding to the program to be compiled according to the file extension of the program to be compiled. Since different operating systems can use different compilation tools, for example, when the target operating system is a QNX system, and it is necessary to compile the kernel submodule program in the program to be compiled, Makefile can be used for compilation; when the target operating system is a vxworks system, CMake can be used for compilation. Therefore, each candidate operating system in the electronic device can correspond to an extension mapping table, and each extension mapping table is used to determine the correspondence between each file extension and the candidate compilation tool. The electronic device can query the extension mapping table corresponding to the target operating system according to the file extension corresponding to the program to be compiled to determine the candidate compilation tool corresponding to the program to be compiled.

[0067] In a possible implementation, the electronic device may also determine at least one candidate compilation tool corresponding to the program to be compiled according to the tool identifier included in the program to be compiled. The tool identifier in the program to be compiled may be added to the program to be compiled by the developer when writing the program to be compiled. The tool identifier in the program to be compiled may be used to indicate the compilation tool that the developer needs to use. After the electronic device determines the target operating system corresponding to the program to be compiled from multiple candidate operating systems in response to the compilation instruction initiated by the user, it may scan the entire program to be compiled to determine at least one tool identifier from the program to be compiled. Each candidate operating system in the electronic device may correspond to an identifier mapping table, and each identifier mapping table may have multiple different tool identifiers and candidate compilation tools corresponding to each tool identifier. After determining all tool identifiers corresponding to the program to be compiled, the electronic device may query the identifier mapping table of the target operating system corresponding to the compilation instruction according to the tool identifier corresponding to the program to be compiled to determine the candidate compilation tool corresponding to the program to be compiled.

[0068] In a possible implementation, the contents of the configuration files corresponding to different candidate compilation tools may be different, and the formats of the configuration files that can be used by different operating systems may be different. For example, different compilation tools may use different external libraries. For example, when the target operating system is an Android system, the file type of the configuration file may be a .bp file or a .Makefile file. Therefore, after the electronic device determines the candidate compilation tool corresponding to the program to be compiled, it can determine the configuration template corresponding to the program to be compiled according to the target operating system corresponding to the candidate compilation tool and the compilation instruction. After determining the configuration template corresponding to the program to be compiled, the electronic device can generate the configuration file corresponding to the program to be compiled according to the determined configuration template.

[0069] Specifically, when the R&D personnel need to personalize the compilation process of the current software development project, the R&D personnel can write the compilation parameters of the program to be compiled into a database or electronic device pre-set by the R&D personnel for storage. When the R&D personnel initiates the compilation instruction, they can input the project identifier of the software development project corresponding to the program to be compiled that currently needs to be compiled. After the electronic device obtains the compilation instruction initiated by the R&D personnel, it can determine whether there is a project identifier in the compilation instruction.

[0070] If the compilation instruction currently initiated by the user does not contain a project identifier, that is, the R&D personnel do not need to personalize the compilation process of the current program to be compiled, the electronic device can compile the current program to be compiled according to unified parameters. At this time, the electronic device can generate a configuration file corresponding to the current program to be compiled according to the determined configuration template and the default parameters pre-set by the R&D personnel. If the compilation instruction currently initiated by the user contains a project identifier, the electronic device can query the compilation parameters corresponding to the current program to be compiled according to the project identifier corresponding to the program to be compiled in the compilation instruction. After obtaining the compilation parameters, the electronic device can generate a configuration file corresponding to the current program to be compiled according to the determined configuration template and the queried compilation parameters.

[0071] Through the method provided by this embodiment, when the electronic device generates a configuration file corresponding to the program to be compiled, it can query the compilation parameters corresponding to the current program to be compiled according to the project identifier. Therefore, the method provided by this embodiment enables the electronic device to perform personalized compilation of the program to be compiled according to the compilation parameters preset by the user. In addition, since the R&D personnel can write the compilation parameters of the program to be compiled into a database or electronic device preset by the R&D personnel for storage, and specify the compilation parameters corresponding to the current program to be compiled by inputting the project identifier in the compilation instruction, when the user needs to compile the program to be compiled for a certain software development project for multiple times, the user does not need to repeatedly set the compilation parameters, thereby simplifying the software compilation process and accelerating the software compilation efficiency.

[0072] S103: Determine at least one target compilation tool for the program to be compiled in the target operating system according to at least one configuration file.

[0073] In this embodiment, after generating at least one configuration file corresponding to the program to be compiled, the electronic device can configure the properties of at least one candidate compilation tool associated with the target operating system through the at least one configuration file to generate a target compilation tool corresponding to the program to be compiled. Exemplarily, the candidate compilation tools in the electronic device may include but are not limited to compilers (such as GNU Compiler Collection, Clang, config, and Shell script compilers, etc.), assemblers (such as GNU Assembler, etc.), linkers (such as GNU Linker, etc.), and build tools (such as Make, CMake, Gradle, Maven, etc.).

[0074] S104 , compiling the program to be compiled by each target compilation tool in turn to obtain a target program file corresponding to the program to be compiled in the target operating system.

[0075] In this embodiment, after generating the target compilation tool corresponding to the program to be compiled, the electronic device may compile the program to be compiled by each target compilation tool in sequence to generate a program file corresponding to the target operating system.

[0076] Figure 3 FIG. 1 shows a specific implementation flow chart of a program compiling method S104 provided in the second embodiment of the present application. Figure 3 , compared to Figure 1 In the embodiment, S104 of a program compiling method provided in this embodiment includes: S301-S302, which are described in detail as follows:

[0077] S301. Obtain at least one sub-module program from a program to be compiled based on a compilation instruction.

[0078] In this embodiment, the program to be compiled may include at least one sub-module program. Before the electronic device executes multiple steps in the compilation process for the program to be compiled, it may first obtain the parameter mapping relationships corresponding to each sub-module program in the program to be compiled. Among them, the parameter mapping relationship corresponding to any sub-module program obtained by the electronic device can be used to describe the data interaction relationship between the sub-module program and other sub-module programs. Specifically, each sub-module program in the program to be compiled may correspond to a sub-module identifier. For any sub-module program, the terminal can query the relationship library pre-set by the R&D personnel according to the sub-module identifier corresponding to the sub-module program, and determine the parameter mapping relationship corresponding to the sub-module program through the relationship library. Among them, the relationship library may store multiple parameter mapping relationships pre-set by the R&D personnel.

[0079] In a possible implementation, the program to be compiled may include multiple candidate compilation modules. Since the expression forms of programs used to perform certain functions under different operating systems may be different, there may be some candidate compilation modules in the program to be compiled that cannot adapt to all operating systems, but exist for a specific operating system. For example, the name of the function used to execute function A under the Windows operating system may be different from the name of the function used to execute function A under the Linux operating system. Therefore, when the R&D personnel write the program to be compiled, for some candidate compilation modules that exist for a specific operating system, the R&D personnel can write the candidate compilation modules that exist for a specific operating system in the compilation scope corresponding to the operating system. Or when the R&D personnel need to compile a program file that can execute a specific function under a specific operating system, for example, the R&D personnel need to compile a program file that only executes function B under the Windows operating system, the R&D personnel can write the candidate compilation module corresponding to the specific function in the compilation scope corresponding to the specific operating system.

[0080] Before obtaining the parameter mapping relationship corresponding to each submodule program in the program to be compiled, the electronic device can also determine the compilation range corresponding to the current target operating program according to the system identifier of the target operating system that needs to be compiled and the program switch template pre-set by the R&D personnel. After determining the compilation range corresponding to the current target operating system, the electronic device can determine the submodule program that needs to be compiled by the target operating system from all candidate compilation modules of the program to be compiled according to the compilation range corresponding to the current target operating system.

[0081] Exemplarily, the program switch template may be __system identifier__ (underscore system identifier underscore), for example, the compilation range under the vxworks operating system may be represented by __Vxworks__, the compilation range under the windows operating system may be represented by __Windows__, and the compilation range under the linux operating system may be represented by __linux__.

[0082] In this embodiment, after the electronic device obtains the parameter mapping relationships corresponding to all the sub-module programs in the current program to be compiled, it can determine the compilation order according to all the parameter mapping relationships currently obtained and the order in which the various sub-module programs appear in the program to be compiled. Exemplarily, when the sub-module program to be compiled is an automatic vehicle search module that performs an automatic vehicle search function, since the software needs to combine the communication function and the tracking function of the software to perform automatic vehicle search when executing the automatic vehicle search function. Therefore, the parameter mapping relationship corresponding to the automatic vehicle search module can indicate that the automatic vehicle search module needs to rely on the communication module and the tracking module when compiling. Therefore, the electronic device can determine that the current compilation order is to compile the communication module first, then compile the tracking module, and finally compile the automatic vehicle search module.

[0083] In a possible implementation, since each submodule program in the program to be compiled can be written by different R&D personnel in the actual process of software development, the electronic device used by the R&D personnel responsible for a certain submodule program may only store the submodule program that he is responsible for. In this case, the R&D personnel responsible for each submodule program can upload the written submodule program to the code server after writing the submodule program that he is responsible for. Therefore, after determining the compilation order of all submodule programs in the program to be compiled, the electronic device can determine whether all submodule programs in the compilation order are stored in the current electronic device. If the electronic device determines that there is a submodule program in the compilation order that is not stored in the electronic device, at this time, the electronic device can obtain the submodule program from the code server according to the storage path of the program to be compiled in the code server and the submodule program identifier corresponding to the submodule program, and store the obtained submodule program according to the storage path preset by the R&D personnel, so as to compile according to the submodule program. If the electronic device determines that all sub-module programs in the compilation order are stored in the current electronic device, the electronic device can directly execute multiple steps in the compilation process for each sub-module program in sequence according to the compilation order to generate program sub-files corresponding to each sub-module program.

[0084] Through the method provided in this embodiment, since the electronic device can obtain the sub-module program from the code server, the R&D personnel only need to update and maintain the compiled program in the code server during the R&D process, thereby reducing the maintenance cost and error possibility of our code.

[0085] S302: Compile at least one sub-module program by using various target compilation tools in sequence to obtain a target program file.

[0086] In this embodiment, after determining the compilation order, the electronic device can compile the various submodule programs of the program to be compiled in sequence according to the compilation order to obtain the target program file. Exemplarily, the program subfile generated by the electronic device can be a binary file, a dynamic link library file, or other files in various forms.

[0087] In a possible implementation, after determining the compilation order, the electronic device may first generate a first configuration file corresponding to the first submodule program in the compilation order, and configure the properties of at least one candidate compilation tool corresponding to the first submodule program through the generated first configuration file, and generate the first target compilation tool corresponding to the first submodule program. The electronic device may compile the program to be compiled through each first target compilation tool in turn, and generate the first program subfile corresponding to the first submodule program. After generating the first program subfile, the electronic device may store the generated first program subfile according to the output path in the first configuration file corresponding to the first submodule program. Then, the electronic device may repeat the above compilation process for each subsequent submodule program of the first submodule program according to the compilation order until the last submodule program in the compilation order, so as to generate the program subfiles corresponding to each submodule program in turn. After generating the program subfiles corresponding to all submodule programs, the electronic device may obtain all program subfiles corresponding to the current module to be compiled according to the output path, and generate a program file according to all program subfiles.

[0088] Specifically, the electronic device can compress and package all program sub-files in the output path through a file packaging tool pre-set by the R&D personnel to generate a program file. Exemplarily, the file packaging tool can be any file packaging tool such as InnoSetup, Advanced Installer, NSIS, etc. After generating the program file, the electronic device can generate an image file corresponding to the program file in the compilation container according to the image parameters corresponding to the current target operating system. Specifically, the image parameters can be used to define the content, environment and operation mode of the image file, such as the commands that the electronic device needs to execute on the image file, such as installing a software package, updating the system, etc.; the storage address of the program file that needs to generate the image file in the electronic device; the storage address of the image file in the electronic device, etc.

[0089] In a possible implementation, the submodule programs in the program to be compiled can be divided into a kernel submodule program, an application layer submodule program, and a virtual machine submodule program according to the level at which the submodule programs are located in the computer system and the functions they undertake. The kernel submodule program, the application layer submodule program, and the virtual machine submodule program can each include at least one module component. Therefore, when a user compiles the program to be compiled, he can not only directly compile the entire program to be compiled, but also compile a submodule program of a certain level in the program to be compiled separately.

[0090] In view of this, the compilation instructions initiated by the user to the electronic device may include compilation instructions such as full compilation instructions, application layer compilation instructions, kernel compilation instructions and virtual machine compilation instructions. Exemplarily, the user can initiate a full compilation instruction through the command "mm--kernel". The user can also initiate a virtual machine compilation instruction through the command "mm--hvp". The user can also initiate a kernel compilation instruction through the command "mm--kernel". The user can also initiate an application layer compilation instruction through the command "mm--app". Among them, the full compilation instruction can be used to instruct the electronic device to compile all sub-module programs in the program to be compiled. The application layer compilation instruction can be used to instruct the electronic device to compile the application layer sub-module program in the program to be compiled. The kernel compilation instruction can be used to instruct the electronic device to compile the kernel sub-module program in the program to be compiled. The virtual machine compilation instruction can be used to instruct the electronic device to compile the virtual machine sub-module program in the program to be compiled. Among them, since the electronic device is different from the specific compilation process of the vxworks system and the specific compilation process of other operating systems other than the vxworks system when compiling the application layer sub-module program, in view of this, the embodiment of the present application can be divided into two cases for discussion based on whether the target operating system is a vxworks system.

[0091] Case 1: the target operating system is the first operating system.

[0092] When the target operating system is the first operating system, that is, the target operating system is the vxworks system, the electronic device can first determine whether the compilation instruction initiated by the user is an application layer compilation instruction. If the compilation instruction initiated by the user is a compilation instruction other than the application layer compilation instruction, such as a kernel compilation instruction, a virtual machine compilation instruction, a full compilation instruction, etc., the electronic device can respond to the compilation instruction initiated by the user and compile the sub-module program corresponding to the compilation instruction to generate a program file corresponding to the sub-module program pointed to by the compilation instruction. Specifically, the operations performed by the electronic device for other compilation instructions except the application layer compilation instruction are the same as the operations performed when the target operating system is the second operating system. Please refer to the specific description of the second operating system in this application.

[0093] If the compilation instruction initiated by the user is an application layer compilation instruction, the electronic device can determine that the current compilation order is the first compilation order. Among them, the first compilation order can be a compilation order of first obtaining the kernel file corresponding to the kernel sub-module program, and then executing the compilation process for the application layer sub-module program according to the kernel file. The electronic device can query whether there is a kernel file of the program to be compiled corresponding to the application layer compilation instruction in the database according to the project identifier in the application layer compilation instruction. Among them, the kernel file is generated by the electronic device after compiling the kernel sub-module program corresponding to the program to be compiled. If the kernel file corresponding to the program to be compiled exists in the database, the electronic device can obtain the kernel file and compile the application layer sub-module program according to the kernel file.

[0094] Specifically, after the electronic device obtains the kernel file corresponding to the program to be compiled, it can generate the second configuration file corresponding to the application layer sub-module program according to the kernel file, the configuration template of the candidate compilation tool corresponding to the application layer sub-module program and the compilation parameters corresponding to the program to be compiled. Wherein, the specific process of the electronic device generating the second configuration file can refer to the content in the first embodiment of the present application, which will not be repeated here. Exemplarily, when the electronic device generates the second configuration file of the application layer sub-module program, it can determine the processor type in the second configuration file, the optimization level of the compiler for the application layer sub-module program, the memory model used when compiling the application layer sub-module program, etc. according to the kernel file. After the electronic device generates the second configuration file corresponding to the application layer sub-module program according to the kernel file, it can configure the candidate compilation tool according to the generated second configuration file to generate a target compilation tool, and compile the application layer sub-module program through each target compilation tool in turn to generate an application layer file. After generating the application layer file, the electronic device can also link the application layer file to the kernel file and generate a program file corresponding to the program to be compiled.

[0095] If the kernel file corresponding to the program to be compiled does not exist in the database, the electronic device can first compile the kernel sub-module program in the program to be compiled to generate the kernel file corresponding to the program to be compiled, and then compile the application layer sub-module program corresponding to the program to be compiled according to the kernel file to generate the application layer file corresponding to the program to be compiled.

[0096] Specifically, the electronic device can obtain the kernel submodule program corresponding to the program to be compiled according to the storage path of the program to be compiled in the code server. After obtaining the kernel submodule program corresponding to the program to be compiled, the electronic device can determine the first configuration file corresponding to the kernel submodule program according to the first operating system. Among them, the specific process of the electronic device generating the first configuration file can refer to the content in the first embodiment of the present application, which will not be repeated here. After the electronic device generates the first configuration file, it can configure the properties of at least one candidate compilation tool associated with the first operating system through the first configuration file to obtain the first target compilation tool. Then, the electronic device can compile the kernel submodule program through each first target compilation tool in turn to generate a kernel file. After compiling the kernel file, the electronic device can obtain at least one application layer submodule program corresponding to the program to be compiled from the code server through the storage path corresponding to the program to be compiled, and compile the application layer submodule program according to the kernel file. Among them, the specific process of the electronic device compiling the application layer submodule program according to the kernel file can refer to the relevant content in this embodiment, which will not be repeated here.

[0097] In this embodiment, the electronic device can automatically compile the application layer submodule program of the vxworks system, that is, the method provided in this embodiment can not only generate program files corresponding to common operating systems such as Linux system and QNX system, but also generate program files corresponding to the vxworks system. Therefore, the program compilation method provided in this embodiment has high usability.

[0098] Case 2: The target operating system is the second operating system.

[0099] In this case, the target operating system is an operating system other than the vxworks system, such as the windows system, QNX system, Android system and other systems. At this time, the electronic device can respond to any compilation instruction initiated by the user and directly execute the compilation process for at least one sub-module program corresponding to the compilation instruction to generate a program file corresponding to the sub-module program pointed to by the compilation instruction.

[0100] Specifically, when the compilation instruction initiated by the user is an application layer compilation instruction, the electronic device can obtain the application layer submodule program in the program to be compiled, and respectively perform multiple steps in the compilation process on the module components in the application layer submodule program to generate the application layer file corresponding to the application layer submodule program. When the compilation instruction initiated by the user is a kernel compilation instruction, the electronic device can obtain the kernel submodule program in the program to be compiled, and respectively perform multiple steps in the compilation process on the module components in the kernel submodule program to generate the kernel file corresponding to the kernel submodule program. When the compilation instruction initiated by the user is a virtual machine compilation instruction, the electronic device can obtain the virtual machine submodule program in the program to be compiled, and respectively perform multiple steps in the compilation process on the module components in the virtual machine submodule program to generate the virtual machine file corresponding to the virtual machine submodule program. Specifically, when the compilation instruction initiated by the user is a full compilation instruction, the electronic device can compile the kernel submodule program, the application layer submodule program and the virtual machine submodule program in the program to be compiled in sequence to generate the program file corresponding to the program to be compiled.

[0101] Specifically, the compilation instruction may include the storage path of the program to be compiled in the code server. The electronic device may obtain at least one sub-module program corresponding to the compilation instruction according to the storage path in the compilation instruction. Wherein, when the compilation instruction is an application layer compilation instruction, the sub-module program obtained by the electronic device may be an application layer sub-module program; when the compilation instruction is a kernel compilation instruction, the sub-module program obtained by the electronic device may be a kernel sub-module program; when the compilation instruction is a virtual machine compilation instruction, the sub-module program obtained by the electronic device may be a virtual machine sub-module program; when the compilation instruction is a full compilation instruction, the sub-module program obtained by the electronic device may be an application layer sub-module program, a kernel sub-module program, and a virtual machine sub-module program. After obtaining the sub-module program corresponding to the compilation instruction, the electronic device may determine the third configuration file corresponding to the sub-module program based on the second operating system, and configure the properties of at least one candidate compilation tool associated with the second operating system through the third configuration file to obtain a third target compilation tool. Wherein, the specific process of the electronic device generating the third configuration file refers to the content in the first embodiment of the present application, which will not be repeated here. The electronic device may compile the sub-module program corresponding to the compilation instruction through each third target compilation tool in turn to generate a program sub-file corresponding to the second operating system.

[0102] Through the method provided in this embodiment, the user can control the electronic device to compile different sub-module programs by issuing different compilation instructions to the electronic device. For example, when the user needs to compile all sub-module programs in the program to be compiled, the user can issue a full compilation instruction to the electronic device. When the user needs to compile in modules, the user can issue compilation instructions such as kernel compilation instructions, application layer compilation instructions, virtual machine compilation instructions, etc. to the electronic device to make the electronic device compile a sub-module program in the program to be compiled.

[0103] See also Figure 4 , shows a schematic diagram of a program compilation framework provided by an embodiment of the present application. Figure 4 As shown, in the embodiment of the present application, the user can compile all modules in the program to be compiled by initiating a full compilation instruction, and can also initiate a single module compilation instruction such as an application layer compilation instruction, a kernel compilation instruction, etc. to compile some sub-module programs in the program to be compiled. The program compilation method provided in the embodiment of the present application can be applied not only to a single module compilation scenario, but also to a multi-module engineering-level compilation scenario and a compilation scenario during software release.

[0104] Before the electronic device compiles the program to be compiled, it can first map the compilation data needed to be used in the compilation process such as the program to be compiled, the external library to be used during the compilation, the virtual machine manager, and each candidate operating system to the compilation container, and compile the program to be compiled in the compilation container. Therefore, the program compilation method provided in the embodiment of the present application can achieve environmental isolation. Further, since the compilation container contains compilation tools corresponding to each candidate compilation system, for example, the compilation container can include vxworks compilation tool chain, QNX compilation tool chain, Linux compilation tool chain and general packaging tools, and the electronic device can first determine the candidate compilation tool corresponding to the sub-module program currently required to be compiled before compiling each sub-module program. Therefore, the program compilation method provided in the embodiment of the present application can achieve compilation tool isolation.

[0105] Specifically, the specific process of the electronic device compiling in the compilation container can be as follows. The electronic device can read the program to be compiled in the compilation container, and determine the compilation order according to the parameter mapping relationship corresponding to each sub-module program in the program to be compiled. After determining the compilation order of each sub-module program, the electronic device can respectively generate a configuration file for each sub-module program, configure a target compilation tool through the configuration file, and compile through the target compilation tool in turn, and generate program sub-files corresponding to each sub-module program. After the terminal device completes the compilation of all sub-module programs, it can package all generated program sub-files through a packaging tool and generate a program file corresponding to the program to be compiled.

[0106] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0107] Reference Figure 5 , shows a schematic diagram of a program compiling device provided in an embodiment of the present application, which may specifically include a receiving module 501, a first determining module 502, a second determining module 503 and a compiling module 504, wherein:

[0108] The receiving module 501 is used to receive a compile instruction for a program to be compiled, wherein the compile instruction instructs to compile the program to be compiled;

[0109] A first determining module 502 is used to determine, in response to the compiling instruction, at least one configuration file corresponding to the program to be compiled in a target operating system; the target operating system is a test operating system or a running operating system of the program to be compiled;

[0110] A second determining module 503, configured to determine at least one target compiling tool for the program to be compiled in the target operating system according to the at least one configuration file;

[0111] The compiling module 504 is used to compile the program to be compiled by using each of the target compiling tools in turn to obtain a target program file corresponding to the program to be compiled in the target operating system.

[0112] The compilation module can also be used to compile at least one application layer submodule program of the application layer in the program to be compiled in sequence through each of the target compilation tools to obtain an application layer file; the target program file includes the application layer file.

[0113] The compilation module can also be used to compile at least one kernel sub-module program in sequence through each of the target compilation tools to obtain the kernel file when the kernel file corresponding to the program to be compiled does not exist in the database; the at least one kernel sub-module program is a program corresponding to the kernel level in the program to be compiled; and when the kernel file corresponding to the program to be compiled exists in the database, the kernel file is obtained from the database.

[0114] The compiling module can also be used to obtain at least one sub-module program from the program to be compiled based on the compiling instruction; and compile the at least one sub-module program in turn through each of the target compiling tools to obtain the target program file.

[0115] The compilation module can also be used to compile each of the sub-module programs in turn using at least one of the target compilation tools according to the compilation order of the multiple sub-module programs to obtain a program sub-file corresponding to each of the sub-module programs; and obtain the target program file based on the program sub-files corresponding to the multiple sub-module programs.

[0116] The compilation module can also be used to obtain the parameter mapping relationship that describes the data interaction between any sub-module program in any level and other sub-module programs in any level; and determine the compilation order between multiple sub-module programs in any level based on all parameter mapping relationships.

[0117] The compilation module can also be used to determine the compilation range corresponding to the target operating system based on a preset program switch template and the system identifier of the target operating system; based on the compilation range corresponding to the target operating system, determine at least one sub-module program corresponding to the target operating system from all candidate compilation modules corresponding to the program to be compiled.

[0118] The compiling module can also be used to compress and package all the program sub-files through a file packaging tool to obtain the target program file.

[0119] The compiling module may also be used to determine the compiling parameters corresponding to the program to be compiled based on the project identifier corresponding to the program to be compiled; and generate at least one configuration file corresponding to the program to be compiled based on the compiling parameters and a configuration template.

[0120] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment part.

[0121] Reference Figure 6 , shows a schematic diagram of an electronic device provided by an embodiment of the present application. Figure 6 As shown, the electronic device 600 in the embodiment of the present application includes: a processor 610, a memory 620, and a computer program 621 stored in the memory 620 and executable on the processor 610. When the processor 610 executes the computer program 621, the steps in each embodiment of the above-mentioned program compilation method are implemented, for example Figure 1 Alternatively, when the processor 610 executes the computer program 621, the functions of each module / unit in the above-mentioned device embodiments are realized, for example Figure 3 Functions of modules 301 to 305 are shown.

[0122] Exemplarily, the computer program 621 may be divided into one or more modules / units, which are stored in the memory 620 and executed by the processor 610 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which may be used to describe the execution process of the computer program 621 in the electronic device 600. For example, the computer program 621 may be divided into an operating system determination module and a compilation module, and the specific functions of each module are as follows:

[0123] An operating system determination module, configured to determine, in response to a compilation instruction, a target operating system corresponding to the program to be compiled from a plurality of candidate operating systems; the candidate operating systems include a test operating system and a running operating system of the program to be compiled;

[0124] A compiling module is used to perform multiple steps of the compiling process on the program to be compiled based on a preset compiling process, and generate a program file matching the target operating system; the multiple steps include:

[0125] Based on the program to be compiled, generating at least one configuration file matching the target operating system;

[0126] Performing attribute configuration on at least one candidate compilation tool associated with the target operating system through the configuration file to obtain a target compilation tool;

[0127] The program to be compiled is compiled in sequence using each of the target compilation tools to generate a program file corresponding to the target operating system.

[0128] The electronic device 600 may include, but is not limited to, a processor 610 and a memory 620. Those skilled in the art will appreciate that Figure 6 It is only an example of the electronic device 600 and does not constitute a limitation of the electronic device 600. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 600 may also include input and output devices, network access devices, buses, etc.

[0129] The processor 610 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0130] The memory 620 may be an internal storage unit of the electronic device 600, such as a hard disk or memory of the electronic device 600. The memory 620 may also be an external storage device of the electronic device 600, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 600. Further, the memory 620 may also include both an internal storage unit of the electronic device 600 and an external storage device. The memory 620 is used to store the computer program 621 and other programs and data required by the electronic device 600. The memory 620 may also be used to temporarily store data that has been output or is to be output.

[0131] An embodiment of the present application also discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the program compiling method described in the above embodiments is implemented.

[0132] The embodiment of the present application further discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the program compiling method as described in the above embodiments is implemented.

[0133] The embodiments of the present application further disclose a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the program compiling method described in the above embodiments.

[0134] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above-mentioned embodiments, a person skilled in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A program compiling method, characterized in that: include: receiving a compiling instruction for a program to be compiled, wherein the compiling instruction instructs compiling the program to be compiled; In response to the compiling instruction, determining at least one configuration file corresponding to the program to be compiled in a target operating system; the target operating system is a test operating system or a running operating system of the program to be compiled; Determine at least one target compilation tool for the program to be compiled in the target operating system according to the at least one configuration file; The program to be compiled is compiled by each of the target compilation tools in turn to obtain a target program file corresponding to the program to be compiled in the target operating system.

2. The method according to claim 1, characterized in that The target operating system is a first operating system and the compile instruction is an application layer compile instruction, and the second compiling the program to be compiled by each of the target compile tools to obtain a target program file corresponding to the program to be compiled in the target operating system includes: At least one application layer submodule program of the application layer in the program to be compiled is compiled in sequence by each of the target compilation tools to obtain an application layer file; the target program file includes the application layer file.

3. The method according to claim 2, characterized in that The first operating system is a vxworks system, and the method further comprises: When there is no kernel file corresponding to the program to be compiled in the database, compiling at least one kernel submodule program by each of the target compilation tools in turn to obtain the kernel file; the at least one kernel submodule program is a program corresponding to the kernel level in the program to be compiled; In the case that the database contains a kernel file corresponding to the program to be compiled, the kernel file is obtained from the database.

4. The method according to claim 1, characterized in that: The target operating system is a second operating system and the compile instruction is any one of an application layer compile instruction or a kernel compile instruction; The step of compiling the program to be compiled by each of the target compilation tools in turn to obtain a target program file corresponding to the program to be compiled in the target operating system includes: Acquire at least one submodule program from the program to be compiled based on the compilation instruction; The at least one sub-module program is compiled in sequence by each of the target compilation tools to obtain the target program file.

5. The method according to claim 1, characterized in that The program to be compiled includes a plurality of submodule programs in any level, and the program to be compiled is compiled by each of the target compilation tools in sequence to obtain a target program file corresponding to the program to be compiled in the target operating system, including: According to the compilation order of the plurality of sub-module programs, each of the sub-module programs is compiled in turn using at least one of the target compilation tools to obtain a program sub-file corresponding to each of the sub-module programs; The target program file is obtained based on the program sub-files respectively corresponding to the plurality of sub-module programs.

6. The method according to claim 5, characterized in that Before the step of compiling each of the sub-module programs in turn using at least one of the target compilation tools according to the compilation order of the multiple sub-module programs to obtain a program sub-file corresponding to each of the sub-module programs, the method further includes: For any of the sub-module programs in any level, obtaining a parameter mapping relationship describing data interaction between the sub-module program and other sub-module programs in any level; The compilation order between the plurality of sub-module programs in any level is determined based on all parameter mapping relationships.

7. The method according to claim 6, characterized in that Before obtaining, for any of the sub-module programs in any level, a parameter mapping relationship describing data interaction between the sub-module program and other sub-module programs in any level, the method further includes: Determining a compilation range corresponding to the target operating system according to a preset program switch template and a system identifier of the target operating system; At least one sub-module program corresponding to the target operating system is determined from all candidate compilation modules corresponding to the program to be compiled based on the compilation range corresponding to the target operating system.

8. The method according to any one of claims 5 to 7, characterized in that: The target program file is obtained based on the program sub-files respectively corresponding to the plurality of sub-module programs, including: All the program sub-files are compressed and packaged by a file packaging tool to obtain the target program file.

9. The method according to any one of claims 1 to 5, characterized in that: The step of determining, in response to the compiling instruction, at least one configuration file corresponding to the program to be compiled in the target operating system includes: Determining compilation parameters corresponding to the program to be compiled based on the project identifier corresponding to the program to be compiled; At least one configuration file corresponding to the program to be compiled is generated based on the compilation parameters and the configuration template.

10. The method according to any one of claims 1 to 5, characterized in that: The step of determining at least one target compilation tool for the program to be compiled in the target operating system according to the at least one configuration file includes: Determining at least one candidate compilation tool for the program to be compiled in the target operating system; The at least one target compilation tool is obtained by configuring the properties of at least one candidate compilation tool through at least one of the configuration files.

11. The method according to any one of claims 1 to 5, characterized in that: After the program to be compiled is compiled by each of the target compilation tools in sequence to obtain a target program file corresponding to the target operating system, the method further includes: An image file corresponding to the target program file is generated based on the image parameters corresponding to the target operating system.

12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the program compiling method according to any one of claims 1 to 11 is implemented.

13. A computer program product, when the computer program product is run on a computer, enables the computer to execute the program compiling method according to any one of claims 1 to 11.