Target tool compiling method and device, equipment and medium
By automatically obtaining and compiling the source code and dependency packages of target tools in embedded system development, using library management modules and cross-compiling tool chains, the problem of cross-platform compilation is solved, compilation efficiency and accuracy are improved, and suitable for diversified hardware environments.
Patent Information
- Application Number
- CN202411006835.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2025-03-14
AI Technical Summary
In embedded system development, cross-platform compilation is difficult, especially on non-standard hardware platforms. Developers need to manually configure library dependencies, resulting in cumbersome and inefficient compilation process.
Provides a compilation method for target tools. By obtaining the compile parameters provided by users, it automatically obtains the source code package of the target tool and the source code of the dependent package, and uses pre-configured library management modules and cross-compilation tool chains to realize automated compilation from source code to executable files.
It solves the cumbersome problem of manual configuration library dependence, improves the efficiency and accuracy of building target tools, and is suitable for various hardware platforms and architectures, ensuring that the generated target tools run stably on the target platform.
Smart Images

Figure CN119621064A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of compilation technology, and in particular to a compilation method, device, equipment and medium for a target tool. Background Art
[0002] In embedded system development, the diversity of hardware platforms brings challenges to compilation. Take the aarch64 architecture as an example. It is a 64-bit ARM processor architecture widely used in different fields, supporting both little endian and big endian data storage methods. Issuers generally provide corresponding cross-compilation tool chains and executable programs for common hardware architectures. These cross-compilation tool chains are mainly designed to solve the problem of compiling code on one architecture so that it can run on another architecture.
[0003] However, when developers are faced with self-developed or special-need boards, especially when these boards use non-standard configurations, such as the aarch64 architecture in big-endian mode, the tools provided by the publisher may not be directly applicable. At this time, developers must resort to cross-compilation to adapt to the target platform. Cross-compilation involves using a compiler for one architecture to generate code for another architecture, which is a complex process, especially when it comes to dependencies between static and dynamic libraries.
[0004] Static libraries are collections of precompiled code that are directly linked into the final executable file during compilation. Dynamic libraries are loaded when the program is running. If the publisher only provides libraries that match the little-endian architecture, the big-endian architecture board will face the problem of not being able to find or recompile the corresponding version of the library during compilation. This requires developers to manually resolve library dependency issues, including but not limited to selecting the correct library version, configuring the library search path, and ensuring that all dependencies can be linked correctly. This process is often very cumbersome and may require developers to make a lot of modifications and reconstructions to the compilation system, consuming a lot of time and resources. Summary of the invention
[0005] In view of the above problems in the prior art, the present application provides a target tool compilation method, device, equipment and medium, which solves the problem of cross-platform compilation in embedded system development, realizes the automated construction of the target tool, and improves the efficiency and accuracy of building the target tool.
[0006] To achieve the above-mentioned purpose, the first aspect of the present application provides a method for compiling a target tool, comprising:
[0007] Obtaining compilation parameters provided by a user, wherein the compilation parameters include one or more of the following parameters: an identifier of a target tool, an identifier of a list file recording dependent packages of the target tool, and an identifier of a required cross-compilation tool chain;
[0008] According to the compilation parameters, in a pre-configured library management module, the source code package of the target tool, the source code of each dependent package of the target tool, and the cross-compilation tool chain are obtained; the library management module includes: a package management library, a list library, a tool library, and a cross-compilation tool chain library;
[0009] The cross-compilation tool chain is used to compile the source codes of the dependent packages of the target tool and the source code package of the target tool to generate a binary file executable by the target tool.
[0010] Thus, in the present application, by automatically acquiring the source code of each dependent package of the target tool and the source code package of the target tool, the tedious problem of manually configuring library dependencies is effectively solved, and then the required cross-compilation tool chain obtained is used to automatically complete the compilation from source code to executable files, eliminating the complexity of manually setting compilation options and link scripts, thereby realizing the automated construction of the target tool and improving the efficiency and accuracy of building the target tool;
[0011] Furthermore, since users can customize the cross-compilation tool chain, this method is applicable to various hardware platforms and architectures, including special boards using non-mainstream byte orders, ensuring that the generated target tool can run stably on the target platform and meeting the software deployment requirements in diverse hardware environments.
[0012] As a possible implementation of the first aspect, obtaining source code of each dependent package of the target tool includes:
[0013] According to the list file identifier, read the corresponding dependent package list from the list library;
[0014] According to the dependent package identifiers recorded in the dependent package list, source codes of each dependent package of the target tool are read from the package management library.
[0015] In this way, the list of dependent packages is obtained through the list file identifier, and then the corresponding source code of each dependent package in the package management library is obtained. This method ensures the accuracy and flexibility of dependent package management. Users can customize the dependent package list to accurately control the dependent environment required by the target tool, avoiding the introduction of unnecessary dependencies or missing key dependencies.
[0016] As a possible implementation of the first aspect, obtaining a source code package of a target tool includes:
[0017] According to the identification of the target tool, a source code package of the corresponding target tool is read from the tool library.
[0018] In this way, managing the source code packages of the target tools through the tool library can ensure that all developers follow the same standards when obtaining the target tools. This helps reduce compilation problems caused by inconsistent target tool versions or configuration differences, and improves the stability and consistency of the entire development process.
[0019] As a possible implementation of the first aspect, obtaining a cross-compilation tool chain includes:
[0020] According to the required cross-compilation tool chain identifier, the corresponding cross-compilation tool chain is read from the cross-compilation tool chain library.
[0021] In this way, according to the required cross-compilation tool chain identifier, the corresponding cross-compilation tool chain is directly read from the cross-compilation tool chain library, ensuring the accuracy of obtaining the cross-compilation tool chain. Different hardware platforms require different cross-compilation tool chains. This on-demand reading method can meet the compilation requirements under different platforms and improve the flexibility and applicability of the compilation process.
[0022] As a possible implementation of the first aspect, using the cross-compilation tool chain to compile source codes of dependent packages of the target tool and the source code package of the target tool includes:
[0023] Using the cross-compilation tool chain, compile the source code of each dependent package of the target tool and the source code package of the target tool respectively;
[0024] The compiled source codes of the dependent packages of the target tool and the source code package of the target tool are linked.
[0025] In this way, through the above method, an executable binary file of the target tool is generated and can be successfully run on the target platform, that is, the automated construction of the target tool is realized.
[0026] As a possible implementation of the first aspect, the following also includes:
[0027] When the list file identifier recording the dependent packages of the target tool is not obtained, all source codes are read from the package management library to generate a default list file, wherein the default list file includes all source codes in the package management library;
[0028] Using the cross-compilation tool chain, compile all source codes in the default list file, and read the source codes of each dependent package of the target tool;
[0029] The source codes of the dependent packages of the target tool and the source code package of the target tool are compiled to generate a binary file executable by the target tool.
[0030] In this way, even if the user does not provide a list file identifier, the default list file is generated and compiled by reading all the source codes in the package management library. Although this method increases the complexity and time cost of compilation, it also provides an automatic fault-tolerant mechanism, which can avoid compilation failures caused by user negligence to a certain extent.
[0031] To achieve the above-mentioned object, the second aspect of the present application provides a compilation device of a target tool, comprising:
[0032] A first acquisition unit is used to acquire compilation parameters provided by a user, wherein the compilation parameters include one or more of the following parameters: an identifier of a target tool, an identifier of a list file recording dependent packages of the target tool, and an identifier of a required cross-compilation tool chain;
[0033] A second acquisition unit is used to acquire, according to the compilation parameters, a source code package of the target tool, source codes of each dependent package of the target tool, and a cross-compilation tool chain in a pre-configured library management module; the library management module includes: a package management library, a list library, a tool library, and a cross-compilation tool chain library;
[0034] The generating unit is used to compile the source code of each dependent package of the target tool and the source code package of the target tool by using the cross-compilation tool chain to generate a binary file executable by the target tool.
[0035] As a possible implementation manner of the second aspect, the generating unit is used to:
[0036] Using the cross-compilation tool chain, compile the source code of each dependent package of the target tool and the source code package of the target tool respectively;
[0037] The compiled source codes of the dependent packages of the target tool and the source code package of the target tool are linked.
[0038] To achieve the above object, the third aspect of the present application provides a computing device, including:
[0039] processor, and
[0040] A memory having program instructions stored thereon, wherein when the program instructions are executed by the processor, the processor executes the compiling method described in any one of the first aspects above.
[0041] To achieve the above-mentioned purpose, the fourth aspect of the present application provides a computer-readable storage medium having program instructions stored thereon, and when the program instructions are executed by a computer, the computer implements the compilation method described in any one of the above-mentioned first aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0043] Figure 1 It is a flow chart of the main steps of a compilation method of a target tool provided by the present application;
[0044] Figure 2 It is a structural schematic diagram of a compilation device of a target tool provided by the present application;
[0045] Figure 3 It is a structural schematic diagram of a computing device provided by this application.
[0046] It should be understood that the size and shape of each block diagram in the above structural diagram are for reference only and should not constitute an exclusive interpretation of the embodiment of the present invention. The relative position and inclusion relationship between the blocks presented in the structural diagram are only schematic representations of the structural association between the blocks, and do not limit the physical connection method of the embodiment of the present invention. DETAILED DESCRIPTION
[0047] The technical solution provided by the present application is further described below with reference to the accompanying drawings and examples. It should be understood that the system structure and business scenarios provided in the examples of the present application are mainly to illustrate the possible implementation methods of the technical solution of the present application and should not be interpreted as the only limitation on the technical solution of the present application. It is known to those of ordinary skill in the art that with the evolution of the system structure and the emergence of new business scenarios, the technical solution provided by the present application is also applicable to similar technical problems.
[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present application. In case of any inconsistency, the meaning described in this specification or the meaning derived from the contents recorded in this specification shall prevail. In addition, the terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0049] The present application embodiment provides a method for compiling a target tool, such as Figure 1 As shown, the method includes:
[0050] S101, obtaining compilation parameters provided by a user, wherein the compilation parameters include one or more of the following parameters: an identifier of a target tool, an identifier of a list file recording dependent packages of the target tool, and an identifier of a required cross-compilation tool chain;
[0051] S102, according to the compilation parameters, in a pre-configured library management module, obtaining the source code package of the target tool, the source code of each dependent package of the target tool, and the cross-compilation tool chain; the library management module includes: a package management library, a list library, a tool library, and a cross-compilation tool chain library;
[0052] S103 , using the cross-compilation tool chain, compile the source code of each dependent package of the target tool and the source code package of the target tool to generate an executable binary file of the target tool.
[0053] The target tool may be a compiling tool or a debugging tool.
[0054] Thus, in the present application, by automatically acquiring the source code of each dependent package of the target tool and the source code package of the target tool, the tedious problem of manually configuring library dependencies is effectively solved, and then the required cross-compilation tool chain obtained is used to automatically complete the compilation from source code to executable files, eliminating the complexity of manually setting compilation options and link scripts, thereby realizing the automated construction of the target tool and improving the efficiency and accuracy of building the target tool;
[0055] Furthermore, since users can customize the cross-compilation tool chain, this method is applicable to various hardware platforms and architectures, including special boards using non-mainstream byte orders, ensuring that the generated target tool can run stably on the target platform and meeting the software deployment requirements in diverse hardware environments.
[0056] In addition, when the user provides all necessary source code packages (such as the source code of each dependency package of the target tool, the source code package of the target tool, and the source code package of the cross-compilation tool chain), the compilation environment no longer needs to connect to the Internet to download additional tools or dependent libraries. In this case, the compilation process only needs to rely on the basic scripting language environment (such as shell) and build tools (such as make) to execute. In other words, as long as tools such as shell and make already exist, the source code package provided by the user can be directly used for compilation without introducing other complex software or frameworks.
[0057] In some embodiments, the present application is not limited to obtaining the source code package of the target tool and the source code of each dependent package of the target tool through the above steps S101 and S102, but also supports the user to provide all necessary source code packages, such as the source code package of the target tool and the source code of each dependent package of the target tool, by themselves when there is no network environment or the network is limited, and then use these source code packages to compile and link operations in an offline environment, thereby realizing compilation without a network environment. In this way, the target tool can be compiled and built even when there is no network environment or the network is limited.
[0058] In some embodiments, obtaining the source code of each dependent package of the target tool includes:
[0059] According to the list file identifier, read the corresponding dependent package list from the list library;
[0060] According to the dependent package identifiers recorded in the dependent package list, source codes of each dependent package of the target tool are read from the package management library.
[0061] In this way, the list of dependent packages is obtained through the list file identifier, and then the corresponding source code of each dependent package in the package management library is obtained. This method ensures the accuracy and flexibility of dependent package management. Users can customize the dependent package list to accurately control the dependent environment required by the target tool, avoiding the introduction of unnecessary dependencies or missing key dependencies.
[0062] It is worth noting that the package management library of this application stores the source code of each dependent package of multiple tools. Each tool corresponds to a list file, and the list file includes the source code of each dependent package of the tool. When users develop new tools themselves, they only need to pay attention to and maintain the list file of the tool. Users can add, delete or update the dependencies of the tool without having to worry about the list files of other tools. Therefore, the task of tool developers is greatly simplified, allowing developers to focus more on the development of the core functions of the tool without being involved in the management of other tools, avoiding distractions caused by complex cross-tool dependency coordination.
[0063] In some embodiments, obtaining the source code package of the target tool includes:
[0064] According to the identification of the target tool, a source code package of the corresponding target tool is read from the tool library.
[0065] In this way, managing the source code packages of the target tools through the tool library can ensure that all developers follow the same standards when obtaining the target tools. This helps reduce compilation problems caused by inconsistent target tool versions or configuration differences, and improves the stability and consistency of the entire development process.
[0066] In some embodiments, obtaining a cross-compilation tool chain includes:
[0067] According to the required cross-compilation tool chain identifier, the corresponding cross-compilation tool chain is read from the cross-compilation tool chain library.
[0068] In this way, according to the required cross-compilation tool chain identifier, the corresponding cross-compilation tool chain is directly read from the cross-compilation tool chain library, ensuring the accuracy of obtaining the cross-compilation tool chain. Different hardware platforms require different cross-compilation tool chains. This on-demand reading method can meet the compilation requirements under different platforms and improve the flexibility and applicability of the compilation process.
[0069] In some embodiments, using the cross-compilation tool chain to compile the source code of each dependent package of the target tool and the source code package of the target tool includes:
[0070] Using the cross-compilation tool chain, compile the source code of each dependent package of the target tool and the source code package of the target tool respectively;
[0071] The compiled source codes of the dependent packages of the target tool and the source code package of the target tool are linked.
[0072] It is worth noting that linking can be understood as the process of combining one or more compiled object files (i.e. the source code of the target tool's dependent packages and the target tool's source code package) into an executable program or library file. The specific process is completed by the linker.
[0073] In this way, through the above method, an executable binary file of the target tool is generated and can be successfully run on the target platform, that is, the automated construction of the target tool is realized.
[0074] In some embodiments, it also includes:
[0075] When the list file identifier recording the dependent packages of the target tool is not obtained, all source codes are read from the package management library to generate a default list file, wherein the default list file includes all source codes in the package management library;
[0076] Using the cross-compilation tool chain, compile all source codes in the default list file, and read the source codes of each dependent package of the target tool;
[0077] The source codes of the dependent packages of the target tool and the source code package of the target tool are compiled to generate a binary file executable by the target tool.
[0078] For example, the user specifies the target tool identifier as netperf_tester, but does not provide a dependency package list file, and specifies the cross-compilation tool chain to be used as aarch64-linux-gnu-gcc.
[0079] Among them, netperf_tester can be understood as a network performance testing tool for aarch64 architecture boards.
[0080] You can use the following steps to generate an executable binary file of netperf_tester:
[0081] Step 1: Read the complete source package of netperf_tester from the tool library according to the identifier of the target tool specified by the user.
[0082] Step 2: Read the cross-compilation tool chain aarch64-linux-gnu-gcc from the cross-compilation tool chain library according to the cross-compilation tool chain identifier specified by the user;
[0083] Step 3: Read all available source codes from the package management library and generate a default list file. This list contains complete information of all source codes in the package management library.
[0084] Step 4. Use the specified cross-compilation tool chain aarch64-linux-gnu-gcc to compile all source codes in the default list file.
[0085] Step 5. Use the specified cross-compilation tool chain aarch64-linux-gnu-gcc to compile the complete source package of netperf_tester;
[0086] Step 6. After the compilation of the above steps 4 and 5 is completed, the source code of the compiled netperf_tester tool dependency packages and the source code package of the netperf_tester tool are linked to generate an executable binary file of netperf_tester, which can run on the big-endian mode single board of the aarch64 architecture.
[0087] It is worth noting that during the linking process, the source code package of the netperf_tester tool and the source code of each dependent package of the netperf_tester tool are automatically linked. For example, the source code of each dependent package of the netperf_tester tool includes libpcap, openssl, and pthread. Among them, libpcap is used for network packet capture, openssl is used for encryption, and pthread is used for multi-threaded processing.
[0088] In this way, even if the user does not provide a list file identifier, the default list file is generated and compiled by reading all the source codes in the package management library, automatically linking the source code package of the target tool and the source code of each dependent package of the target tool. Although this method increases the complexity and time cost of compilation, it also provides an automatic fault-tolerant mechanism, which can avoid compilation failures caused by user negligence to a certain extent.
[0089] In order to more clearly illustrate the above method, the present application provides specific embodiments.
[0090] This embodiment is described by taking the target tool as a crash tool as an example.
[0091] For the aarch64 architecture, it is designed to support both little-endian and big-endian byte orders, but most implementations and toolchains are prepared for little-endian mode by default. Therefore, in order to make the crash tool work on the aarch64 architecture in big-endian mode, you can take the following steps:
[0092] Preparation stage:
[0093] The source code package of the crash tool is placed in the tool library;
[0094] The source code of each dependent package of the crash tool (such as libcap, libedit, lzlib) is placed in the package management library;
[0095] The list files of each dependent package of the crash tool (such as crash.list) are placed in the list library;
[0096] The cross-compilation toolchain is placed in the cross-compilation toolchain library.
[0097] Execution phase:
[0098] Step 1: Get the compilation parameters provided by the user, including the crash tool identifier (e.g., "crash"), the list file identifier of all dependent packages of the crash tool (e.g., "crash.list"), and the required cross-compilation tool chain identifier (e.g., "aarch64-linux-gnu-gcc").
[0099] Step 2: According to the provided list file identifier (such as crash.list), search for each list file in the list library, read all dependent package identifiers of the crash tool from the hit list file (such as crash.list), and read the source code of each dependent package (such as libcap, libedit and lzlib) from the package management library.
[0100] Step 3: Read the complete source code package of the crash tool from the tool library according to the crash tool identifier provided by the user.
[0101] Step 4: Read the corresponding cross-compilation tool chain from the cross-compilation tool chain library according to the cross-compilation tool chain identifier specified by the user.
[0102] Step 5: Use the cross-compilation tool chain obtained in step 4 to compile the source code package of the crash tool and the source code of all its dependent packages;
[0103] Step 6. After the compilation is completed, link the source code of each dependent package of the compiled crash tool with the source code package of the crash tool to generate the final crash tool executable file so that it can run on the aarch64 architecture in big-endian mode.
[0104] Figure 2 A target tool compilation device 200 provided in an embodiment of the present application includes:
[0105] The first acquisition unit 201 is used to acquire the compilation parameters provided by the user, wherein the compilation parameters include one or more of the following parameters: the identifier of the target tool, the identifier of the list file recording the dependent packages of the target tool, and the identifier of the required cross-compilation tool chain;
[0106] The second acquisition unit 202 is used to acquire the source code package of the target tool, the source code of each dependent package of the target tool, and the cross-compilation tool chain in a pre-configured library management module according to the compilation parameters; the library management module includes: a package management library, a list library, a tool library, and a cross-compilation tool chain library;
[0107] The generating unit 203 is used to compile the source code of each dependent package of the target tool and the source code package of the target tool by using the cross-compilation tool chain to generate a binary file executable by the target tool.
[0108] In some embodiments, the generating unit 203 is used to:
[0109] Using the cross-compilation tool chain, compile the source code of each dependent package of the target tool and the source code package of the target tool respectively;
[0110] The compiled source codes of the dependent packages of the target tool and the source code package of the target tool are linked.
[0111] Figure 3 3 is a schematic diagram of a computing device 300 provided in an embodiment of the present application. The computing device executes the above method, such as Figure 3As shown, the computing device 300 includes: a processor 310 , a memory 320 , and a communication interface 330 .
[0112] It should be understood that Figure 3 The communication interface 330 in the computing device 300 shown may be used to communicate with other devices, and may specifically include one or more transceiver circuits or interface circuits.
[0113] The processor 310 may be connected to a memory 320. The memory 320 may be used to store the program code and data. Therefore, the memory 320 may be a storage unit inside the processor 310, or an external storage unit independent of the processor 310, or a component including a storage unit inside the processor 310 and an external storage unit independent of the processor 310.
[0114] Optionally, the computing device 300 may further include a bus. The memory 320 and the communication interface 830 may be connected to the processor 310 via the bus. The bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 A line without an arrow is used to represent the bus, but this does not mean that there is only one bus or one type of bus.
[0115] It should be understood that in the embodiment of the present application, the processor 310 can adopt a central processing unit (CPU). The processor can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. Or the processor 310 uses one or more integrated circuits to execute related programs to implement the technical solutions provided in the embodiments of the present application.
[0116] The memory 320 may include a read-only memory and a random access memory, and provides instructions and data to the processor 310. A portion of the processor 310 may also include a non-volatile random access memory. For example, the processor 310 may also store information on the device type.
[0117] When the computing device 300 is running, the processor 310 executes the computer-executable instructions in the memory 320 to perform any operation step of the above method and any optional embodiment thereof.
[0118] It should be understood that the computing device 300 according to the embodiment of the present application can correspond to the corresponding subject in the method according to each embodiment of the present application, and the above-mentioned and other operations and / or functions of each module in the computing device 300 are respectively for realizing the corresponding process of each method of the present embodiment, which will not be repeated here for the sake of brevity.
[0119] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0120] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0121] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0122] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0123] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0124] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0125] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, it is used to execute the above method, which includes at least one of the solutions described in the above embodiments.
[0126] The computer storage medium of the embodiment of the present application can adopt any combination of one or more computer-readable media. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive lists) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing programs, which can be used by instruction execution systems, devices or devices or used in combination with them.
[0127] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0128] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0129] Computer program code for performing the operation of the present application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).
[0130] In addition, the words "first, second, third, etc." or module A, module B, module C and other similar terms in the specification and claims are only used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that the specific order or sequence can be interchanged where permitted so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0131] In the above description, the numbers representing the steps, such as S110, S120, etc., do not necessarily mean that the steps will be executed in this manner. If permitted, the order of the steps can be interchanged or they can be executed simultaneously.
[0132] The term "comprising" as used in the description and claims should not be interpreted as being limited to what is listed thereafter; it does not exclude other elements or steps. Therefore, it should be interpreted as specifying the presence of the features, integers, steps or components mentioned, but does not exclude the presence or addition of one or more other features, integers, steps or components and groups thereof. Therefore, the expression "a device comprising means A and B" should not be limited to a device consisting of components A and B only.
[0133] References to "one embodiment" or "an embodiment" in this specification mean that a particular feature, structure, or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present application. Therefore, the phrases "in one embodiment" or "in an embodiment" appearing in various places in this specification do not necessarily refer to the same embodiment, but may refer to the same embodiment. In addition, in one or more embodiments, the particular features, structures, or characteristics can be combined in any appropriate manner, as would be apparent to one of ordinary skill in the art from this disclosure.
[0134] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may also include more other equivalent embodiments without departing from the concept of the present application, all of which belong to the scope of protection of the present application.
Claims
1. A method for compiling a target tool, characterized in that: The method comprises: Obtaining compilation parameters provided by a user, wherein the compilation parameters include one or more of the following parameters: an identifier of a target tool, an identifier of a list file recording dependent packages of the target tool, and an identifier of a required cross-compilation tool chain; According to the compilation parameters, in a pre-configured library management module, the source code package of the target tool, the source code of each dependent package of the target tool, and the cross-compilation tool chain are obtained; the library management module includes: a package management library, a list library, a tool library, and a cross-compilation tool chain library; The cross-compilation tool chain is used to compile the source codes of the dependent packages of the target tool and the source code package of the target tool to generate a binary file executable by the target tool.
2. The compiling method according to claim 1, characterized in that: The step of obtaining the source code of each dependent package of the target tool includes: According to the list file identifier, read the corresponding dependent package list from the list library; According to the dependent package identifiers recorded in the dependent package list, source codes of each dependent package of the target tool are read from the package management library.
3. The compiling method according to claim 1, characterized in that: The step of obtaining the source code package of the target tool includes: According to the identification of the target tool, a source code package of the corresponding target tool is read from the tool library.
4. The compiling method according to claim 1, characterized in that: The step of obtaining a cross-compilation tool chain includes: According to the required cross-compilation tool chain identifier, the corresponding cross-compilation tool chain is read from the cross-compilation tool chain library.
5. The compiling method according to claim 1, characterized in that: The cross-compilation tool chain is used to compile the source code of each dependent package of the target tool and the source code package of the target tool, including: Using the cross-compilation tool chain, compile the source code of each dependent package of the target tool and the source code package of the target tool respectively; The compiled source codes of the dependent packages of the target tool and the source code package of the target tool are linked.
6. The compiling method according to claim 1, characterized in that: Also includes: When the list file identifier recording the dependent packages of the target tool is not obtained, all source codes are read from the package management library to generate a default list file, wherein the default list file includes all source codes in the package management library; Using the cross-compilation tool chain, compile all source codes in the default list file, and read the source codes of each dependent package of the target tool; The source codes of the dependent packages of the target tool and the source code package of the target tool are compiled to generate a binary file executable by the target tool.
7. A compiling device for a target tool, characterized in that: include: A first acquisition unit is used to acquire compilation parameters provided by a user, wherein the compilation parameters include one or more of the following parameters: an identifier of a target tool, an identifier of a list file recording dependent packages of the target tool, and an identifier of a required cross-compilation tool chain; A second acquisition unit is used to acquire, according to the compilation parameters, a source code package of the target tool, source codes of each dependent package of the target tool, and a cross-compilation tool chain in a pre-configured library management module; the library management module includes: a package management library, a list library, a tool library, and a cross-compilation tool chain library; The generating unit is used to compile the source code of each dependent package of the target tool and the source code package of the target tool by using the cross-compilation tool chain to generate a binary file executable by the target tool.
8. The compiling device according to claim 7, characterized in that: The generating unit is used for: Using the cross-compilation tool chain, compile the source code of each dependent package of the target tool and the source code package of the target tool respectively; The compiled source codes of the dependent packages of the target tool and the source code package of the target tool are linked.
9. A computing device, characterized in that include: processor, and A memory having program instructions stored thereon, wherein when the program instructions are executed by the processor, the processor executes the compiling method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: Program instructions are stored thereon, and when the program instructions are executed by a computer, the computer is caused to execute the compiling method according to any one of claims 1 to 6.