[go: up one dir, main page]

CN114168153B - Compiling method, computing device and storage medium - Google Patents

Compiling method, computing device and storage medium Download PDF

Info

Publication number
CN114168153B
CN114168153B CN202210123497.0A CN202210123497A CN114168153B CN 114168153 B CN114168153 B CN 114168153B CN 202210123497 A CN202210123497 A CN 202210123497A CN 114168153 B CN114168153 B CN 114168153B
Authority
CN
China
Prior art keywords
file
processor
user space
operating system
virtual user
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210123497.0A
Other languages
Chinese (zh)
Other versions
CN114168153A (en
Inventor
李鹤
赖洪圣
陈会星
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Uniontech Software Technology Co Ltd
Original Assignee
Uniontech Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Uniontech Software Technology Co Ltd filed Critical Uniontech Software Technology Co Ltd
Priority to CN202210123497.0A priority Critical patent/CN114168153B/en
Priority to CN202210374572.0A priority patent/CN114741086A/en
Publication of CN114168153A publication Critical patent/CN114168153A/en
Application granted granted Critical
Publication of CN114168153B publication Critical patent/CN114168153B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a compiling method, a computing device and a storage medium, and the compiling method comprises the following steps: firstly, determining a cross compiler based on an operating system according to a first architecture processor and a simulation processor, wherein the cross compiler can compile applications of other architectures different from the first architecture based on the operating system, and then determining a library file according to the simulation processor; and finally, compiling the application file in the virtual user space according to the cross compiler and the library file so as to run the application in the virtual user space. According to the invention, the cross compiling program in the computing equipment can be called, the application file in the virtual user space is compiled by using the hardware of the computing equipment, the compiling efficiency of the application file in the virtual user space is improved, and the experience of the user in using the application in the virtual user space is improved.

Description

Compiling method, computing device and storage medium
Technical Field
The present invention relates to the field of operating systems, and in particular, to a compiling method, a computing device, and a storage medium.
Background
With the development of computer technology, people sometimes build virtual hardware different from a hardware architecture in a computing device, where the virtual hardware is a hardware architecture different from the computing device and runs a virtual machine based on the virtual hardware, including a virtual machine operating system, an application, and the like. The virtual hardware can support multi-architecture simulation, but cannot achieve the complete performance of an actual computer, the time overhead is large when a cross-platform command is executed, and the time lag is very obvious particularly when large software is compiled.
In the prior art, when a compiling task is executed in a simulation environment, an application file is compiled through a compiler of the simulation environment, and because software execution of the simulation environment is simulated based on a host operating system, the performance is poor, the compiling capability is limited, and the efficiency in compiling the application is not high.
For this reason, a new compiling method is required.
Disclosure of Invention
To this end, the present invention provides a compilation method that seeks to solve, or at least alleviate, the above-identified problems.
According to an aspect of the present invention, there is provided a compiling method suitable for being executed in a computing device, the computing device including a first architecture processor, the computing device further having an operating system running therein and simulating a simulation processor having a second architecture based on the operating system, a virtual machine being constructed based on the simulation processor, the virtual machine including an application file, the method including the steps of: determining an operating system based cross compiler from the first architecture processor and the simulation processor; determining a library file according to the simulation processor; and compiling the application files in the virtual machine according to the cross compiling program and the library files.
Optionally, in a method according to the present invention, the computing device includes a native compiler running on an operating system, and determining an operating system based cross-compiler according to the first architecture processor and the simulation processor includes the steps of: determining a local operating environment according to a first architecture processor; determining a target operating environment according to the simulation processor; and installing a cross compiler based on the operating system according to the local running environment and the target running environment, and replacing the local compiler.
Optionally, in the method according to the present invention, the computing device further emulates a virtual memory based on the operating system, and the process of constructing the virtual machine includes the steps of: determining a folder for running the virtual machine according to the virtual memory, wherein the folder is a root directory for running the virtual machine; and constructing the virtual machine according to the folder and the simulation processor.
Optionally, in the method according to the present invention, the building of the virtual machine according to the folders and the simulation processor comprises the steps of: installing a virtual machine operating system according to a second instruction set supported by the simulation processor; the virtual machine is constructed from a virtual machine operating system, a virtual memory, and a simulation processor.
Optionally, in the method according to the present invention, determining the library file according to the simulation processor comprises the steps of: according to the simulation processor, library files required for compiling the application files are constructed in the virtual machine.
Optionally, in the method according to the present invention, compiling the application file in the virtual machine according to the cross compiler and the library file includes the steps of: obtaining a target file according to the cross compiling program and the application file; and obtaining the executable file according to the target file and the library file.
Optionally, in the method according to the present invention, the operating system includes a kernel, and obtaining the executable file according to the cross compiler and the application file includes: registering the file type of the application file in the kernel so as to compile the application file; and compiling the application file by calling a cross compiling program through the kernel to obtain a target file.
Optionally, in the method according to the present invention, the cross compiler further includes an operating system based linker, and obtaining the executable file according to the object file and the library file includes: and linking the target file and the library file through a linker to obtain an executable file.
According to another aspect of the present invention, there is provided a computing device comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing the compiling method according to the invention.
According to still another aspect of the present invention, there is provided a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform a compiling method according to the present invention.
The invention discloses a compiling method which is suitable for being executed in a computing device. The computing device comprises a first architecture processor, supports a first instruction set, runs an operating system, simulates a simulation processor based on the operating system, and constructs a virtual user space suitable for running an application based on the simulation processor, wherein the virtual user space comprises an application file for running the application, and the method comprises the following steps: firstly, determining a cross compiler based on an operating system according to a first architecture processor and a simulation processor, wherein the cross compiler can compile applications of other architectures different from the first architecture based on the operating system, and then determining a library file according to the simulation processor; and finally, compiling the application file in the virtual user space according to the cross compiler and the library file so as to run the application in the virtual user space. According to the invention, the cross compiling program in the computing equipment can be called, the application file in the virtual user space is compiled by using the hardware of the computing equipment, the compiling efficiency of the application file in the virtual user space is improved, and the experience of the user in using the application in the virtual user space is improved.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 illustrates a schematic diagram of deploying virtual machines in a host machine according to an exemplary embodiment of the invention;
FIG. 2 illustrates a block diagram of a computing device 200, according to an exemplary embodiment of the invention; and
fig. 3 shows a flow diagram of a compiling method 300 according to an exemplary embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art. Like reference numerals generally refer to like parts or elements.
Fig. 1 shows a schematic diagram of constructing a virtual user space in a host according to an exemplary embodiment of the present invention. As shown in FIG. 1, a computing device 200 includes a host hardware layer 150 and a host operating system 140. The host hardware layer 150 is a hardware portion of the computing device 200, including a processor and memory, etc. (not shown). The processors included in host hardware layer 150 are first architecture processors, supporting a first instruction set. The processor architecture of the first architecture processor and the corresponding first instruction set are not limited in this disclosure. According to one embodiment of the invention, the first architecture processor may be implemented as an x86 architecture processor, with the first instruction set accordingly being the x86 instruction set. According to another embodiment of the invention, the first architecture processor may also be implemented as an ARM architecture processor, the respective first instruction set of which is an ARM instruction set and/or a Thumb instruction set. The host operating system 140 is an operating system installed in the computing device 200 as a host, and the present invention is not limited to a specific type of the host operating system 140. According to one embodiment of the invention, host operating system 140 may be implemented as a linux operating system.
In the host computing device 200, a hardware simulator 112 for hardware simulation is built based on the host operating system 140, and the hardware simulator 112 provides virtual hardware. The virtual hardware comprises an analog processor, a virtual memory and the like. The simulation processor executes the second instruction set to simulate the processor with the second architecture. The invention does not limit the architecture type of the analog processor and the instruction set type of the corresponding second instruction set.
A container supporting the second architecture is constructed based on the hardware simulated by the hardware simulator 112, and a virtual user space is constructed based on the container. The virtual user space provides a runtime environment for the application under the second architecture.
According to one embodiment of the invention, the virtual user space can be constructed by installing qemu-user-static, and the specific codes are as follows:
$ sudo apt install qemu-user-static
the specific structure of computing device 200 is shown in FIG. 2. FIG. 2 illustrates a block diagram of a computing device 200, according to an exemplary embodiment of the invention. As shown in FIG. 2, in a basic configuration 202, a computing device 200 typically includes a system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between the processor 204 and the system memory 206.
Depending on the desired configuration, the processor 204 may be any type of processing, including but not limited to: a microprocessor (μ P), a microcontroller (μ C), a digital information processor (DSP), or any combination thereof. The processor 204 may include one or more levels of cache, such as a level one cache 210 and a level two cache 212, a processor core 214, and registers 216. Example processor cores 214 may include Arithmetic Logic Units (ALUs), Floating Point Units (FPUs), digital signal processing cores (DSP cores), or any combination thereof. The example memory controller 218 may be used with the processor 204, or in some implementations the memory controller 218 may be an internal part of the processor 204.
Depending on the desired configuration, system memory 206 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 206 may include an operating system 220, one or more programs 222, and program data 228. In some embodiments, the program 222 may be arranged to execute the instructions 223 of the method 300 according to the invention on an operating system by one or more processors 204 using the program data 228.
Computing device 200 may also include a storage interface bus 234. A storage interface bus 234 enables communication from storage devices 232 (e.g., removable storage 236 and non-removable storage 238) to basic configuration 202 via bus/interface controller 230. Operating system 220, programs 222, and at least a portion of data 224 can be stored on removable storage 236 and/or non-removable storage 238, and loaded into system memory 206 via storage interface bus 234 and executed by one or more processors 204 when computing device 200 is powered on or programs 222 are to be executed.
Computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via the bus/interface controller 230. The example output device 242 includes a graphics processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 252. Example peripheral interfaces 244 can include a serial interface controller 254 and a parallel interface controller 256, which can be configured to facilitate communications with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 258. An example communication device 246 may include a network controller 260, which may be arranged to communicate with one or more other computing devices 200 over a network communication link via one or more communication ports 264.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In a computing device 200 according to the present invention, the program 222 comprises a plurality of program instructions of the compilation method 300 that may instruct the processor 204 to perform some of the steps of the compilation method 300 that are run in the computing device 200 of the present invention such that some of the components in the computing device 200 compile application files to run an application by performing the compilation method 300 of the present invention.
Computing device 200 may be implemented as a server, e.g., a file server, a database, a server, an application server, etc., which may be, for example, a Personal Digital Assistant (PDA), a wireless web-browsing device, an application-specific device, or a hybrid device that include any of the above functions. May be implemented as a personal computer including both desktop and notebook computer configurations, and in some embodiments, the computing device 200 is configured to compile the method 300.
Fig. 3 shows a flow diagram of a compiling method 300 according to an exemplary embodiment of the invention. The compilation method 300 is suitable for execution in a computing device, such as the computing device 200 shown in FIG. 2. The computing device comprises a first architecture processor, a simulation processor and a virtual user space, wherein the first architecture processor supports a first instruction set, an operating system runs in the computing device, the simulation processor simulates based on the operating system, the simulation processor supports a second instruction set, the virtual user space is constructed based on the simulation processor and is suitable for running applications, and the virtual user space comprises application files for running the applications. The simulation processor is a second architecture simulation processor, and the second architecture simulation processor and the first architecture processor are processors of different architectures.
When an application is executed in the virtual user space, the application file needs to be compiled. The virtual user space is based on a second architecture simulation processor, and the virtual user space includes a compiler adapted to the environment provided by the simulation processor of the second architecture type. The hardware resources that the compiler in the virtual user space can call are hardware resources simulated by an operating system of the computing device, and the compiler cannot use all the hardware resources of the computing device to compile the application file. Therefore, the virtual user space compiles the application file and runs the application less efficiently.
The virtual memory is also simulated in the computing equipment based on the operating system, and the construction process of the virtual user space comprises the following steps: determining a folder of a virtual user space according to the virtual memory, wherein the folder is a root directory of the virtual user space. According to one embodiment of the invention, the folder is a chroma environment in which applications in the virtual user space run, and other files and other folders outside the folder are all invisible to the applications therein. Because the application running can face the problem of file system level such as dynamic library, data file/configuration file, it is not beneficial to system file management when directly installed in the local machine. And a target-architecture package management system can be used in the chroma environment, so that convenience is brought to software compiling dependence.
According to one embodiment of the invention, the virtual user space may be constructed by determining folders through the following codes:
$ sudo debootstrap --arch=arm64 --variant=buildd --exclude=debfoster buster
debian-arm64 http://ftp.debian.org/debian
a virtual user space is then constructed from the folders and the simulation processor. Specifically, a container is constructed according to a second instruction set supported by the simulation processor, and a virtual user space is constructed according to the container, so that the application is run in the virtual user space.
In the method 300 of the present invention, step S310 is first executed to determine an os-based cross-compiler according to the first architecture processor and the simulation processor. A native compiler running on an operating system is included in the computing device. The native compiler is adapted to run in a hardware environment provided by a first architecture processor of the first architecture type and based on an operating system run by the first architecture processor. The native compiler compiles other application files stored by the computing device into executable files suitable for processing by the first architecture processor in the computing device to run other applications. The native compiler cannot compile an executable file suitable for processing by the emulated processor of the second architecture type. According to one embodiment of the invention, the native compiler may be implemented as a compiler, which may be determined based on the architecture type of the first architecture processor.
In order to call all hardware resources of the computing equipment, the invention compiles the application files in the virtual machine and improves the compiling efficiency of the application files, the local compiler program is replaced by the cross compiler program, and the cross compiler program can be operated in the hardware environment provided by the first architecture processor of the first architecture type and the operating system operated based on the first architecture processor and compile executable files suitable for processors of other architecture types, such as executable files suitable for analog processors of the second architecture type to process. Cross-compiler a compiler running in one computer environment can compile code that runs in another environment, and such a compiler supports cross-compilation. This compilation process is called cross-compilation.
When determining a cross compiler based on an operating system according to a first architecture processor and a simulation processor, determining a local operating environment according to the first architecture processor; in particular, the local execution environment is determined to include a hardware execution environment constructed by a first architecture processor of a first architecture type according to the first architecture processor.
Determining a target operation environment according to the simulation processor; specifically, the target execution environment is determined from the virtual processors to include a hardware execution environment constructed by the virtual processors of the second architecture type. The local running environment is the running environment of the application in the computing device, and the target running environment is the running environment of the application in the virtual machine.
And then, according to the local running environment and the target running environment, installing an operating system-based cross compiler to replace the local compiler. According to the local running environment and the target running environment, the cross compiler can be determined to be a compiler which is operated under the hardware running environment constructed by the first architecture processor of the first architecture type and compiles an executable file under the hardware running environment constructed by the virtual processor of the second architecture type. When determining the cross compiler, determining the cross compiler according to the software running environment of the target running environment.
According to one embodiment of the invention, the first architecture type is an x86 architecture, the first architecture processor is an x86 architecture processor, and the first instruction set supported by the first architecture processor is an x86 instruction set. The second architecture is an arm architecture, the virtual processor is an arm architecture processor virtualized in the virtual machine, and the second instruction set supported by the virtual processor is an arm instruction set. The x86 architecture processor and the arm architecture processor can determine that the cross compiler is a compiler which is suitable for the hardware operation environment constructed by the arm architecture processor and is compiled under the hardware operation environment constructed by the x86 architecture processor. Determining a cross compiler according to a virtual operating system of the virtual machine according to a software running environment of the virtual machine; when the virtual operating system is a linux system, it may be determined that the cross compiler is an arm-linux-gcc cross compiler. The arm-linux-gcc cross compiler is suitable for compiling an executable file which is suitable for running in a hardware running environment constructed by an arm architecture processor and a virtual machine of which the linux system is a software running environment in the hardware running environment constructed by the x86 architecture processor. Then, the arm-linux-gcc cross compiler is installed in the operating system, replacing the native compiler.
According to one embodiment of the invention, the following code installation cross-compiler may be executed, replacing the native compiler:
$ sudo cp -r /usr/bin/aarch64-linux-gnu-* debian-arm64/usr/bin/
$ sudo cp -r /usr/lib/gcc-cross debian-arm64/usr/lib/
$ sudo cp -r /usr/aarch64-linux-gnu debian-arm64/usr/
subsequently, step S320 is performed to determine a library file according to the simulation processor. Specifically, according to the simulation processor, library files required for compiling the application files are constructed in the virtual user space.
According to an embodiment of the present invention, when the simulation processor is an arm architecture processor, it may be determined that a library file required for compiling the application file is an arm library file, and the arm library file is constructed in the virtual machine so as to compile the application file from the arm library file.
According to one embodiment of the invention, the library file required for compiling the application file can be constructed in the virtual machine by the following codes:
$ ldd /usr/bin/aarch64-linux-gnu-gcc-8
finally, step S330 is executed to compile the application file in the virtual user space according to the cross-compiler and the library file. Specifically, an object file is obtained according to the cross compiler and the application file, and then an executable file is obtained according to the object file and the library file.
When the target file is obtained according to the cross compiling program and the application file, the file type of the application file is firstly registered in the kernel so as to compile the application file, and the cross compiling program is called by the kernel to compile the application file to obtain the target file.
The cross compiler cannot compile the application file directly because the file type of the application file is an application file that cannot be processed by the operating system based on the first architecture processor. For this reason, the file type of the application file needs to be registered in the kernel of the operating system.
According to one embodiment of the invention, when the operating system is a linux system, the kernel is a linux kernel that includes a binfmt misc mechanism that allows the kernel to recognize any type of executable file format and pass it to specific user-space applications such as emulators and virtual machines. When the file type of the application file is registered in the kernel, namely the file type of the application file is registered in the binfmt _ misc, so that the application file can be processed by calling a cross compiler program through the kernel, and a target file is obtained through compiling.
The cross compiler also comprises a linker based on an operating system, and when the executable file is obtained according to the target file and the library file, the target file and the library file are linked through the linker to obtain the executable file.
According to one embodiment of the invention, the library file is an arm library file, the target file is linked with the arm library file to obtain the executable file, so that the executable file can be suitable for being executed on a virtual processor of an arm architecture, the compiling time of the application file is shortened, and the compiling efficiency of the application file is improved.
The invention discloses a compiling method which is suitable for being executed in a computing device. The computing device comprises a first architecture processor, supports a first instruction set, runs an operating system, simulates a simulation processor based on the operating system, and constructs a virtual user space suitable for running an application based on the simulation processor, wherein the virtual user space comprises an application file for running the application, and the method comprises the following steps: firstly, determining a cross compiler based on an operating system according to a first architecture processor and a simulation processor, wherein the cross compiler can compile applications of other architectures different from the first architecture based on the operating system, and then determining a library file according to the simulation processor; and finally, compiling the application file in the virtual user space according to the cross compiler and the library file so as to run the application in the virtual user space. According to the invention, the cross compiling program in the computing equipment can be called, the application file in the virtual user space is compiled by using the hardware of the computing equipment, the compiling efficiency of the application file in the virtual user space is improved, and the experience of the user in using the application in the virtual user space is improved.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects.
Those skilled in the art will appreciate that the modules or units or groups of devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. Modules or units or groups in embodiments may be combined into one module or unit or group and may furthermore be divided into sub-modules or sub-units or sub-groups. All of the features disclosed in this specification, and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except that at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification may be replaced by an alternative feature serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the compiling method of the invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer-readable media includes both computer storage media and communication media. Computer storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of computer readable media.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to practitioners skilled in this art. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention.

Claims (9)

1. A compiling method adapted to be executed in a computing device including a first architecture processor, the computing device further having an operating system running therein and a simulation processor having a second architecture based on the operating system, a virtual user space adapted to run an application being constructed based on the simulation processor, the virtual user space including an application file for running the application, the method comprising the steps of:
determining, from the first architecture processor and the simulation processor, a cross compiler based on the operating system;
determining a library file according to the simulation processor;
compiling the application file in the virtual user space according to the cross compiler and the library file;
wherein, the computing device is also simulated with a virtual memory based on the operating system, and the construction process of the virtual user space comprises the following steps:
determining a folder of the virtual user space according to the virtual memory, wherein the folder is a root directory of the virtual user space;
and constructing a virtual user space according to the folder and the simulation processor.
2. The method of claim 1, wherein a native compiler program running on the operating system is included in the computing device, and wherein determining the operating system based cross compiler program from the first architecture processor and the emulated processor comprises:
determining a local operating environment according to the first architecture processor;
determining a target operating environment according to the simulation processor;
and installing a cross compiler based on the operating system according to the local running environment and the target running environment, and replacing the local compiler.
3. The method of claim 1, wherein said constructing a virtual user space from said folders and said simulation processor comprises the steps of:
constructing a container from a second set of instructions supported by the simulation processor;
and constructing a virtual user space according to the container.
4. The method of any of claims 1-3, wherein said determining a library file from said simulation processor comprises the steps of:
and constructing a library file required for compiling the application file in the virtual user space according to the simulation processor.
5. The method of claim 4, wherein said compiling the application files in the virtual user space from the cross compiler and the library file comprises the steps of:
obtaining a target file according to the cross compiling program and the application file;
and obtaining an executable file according to the target file and the library file.
6. The method of claim 5, wherein the operating system includes a kernel, and said obtaining an executable file from the cross-compiler and the application file comprises:
registering a file type of the application file in the kernel so as to compile the application file;
and calling the cross compiling program through the kernel to compile the application file to obtain a target file.
7. The method of claim 6, wherein said cross-compiler further comprises a linker based on said operating system, said deriving an executable file from said object file and said library file comprising the steps of:
and linking the target file and the library file through the linker to obtain an executable file.
8. A computing device, comprising:
one or more processors;
a memory; and
one or more apparatuses comprising instructions for performing the method of any of claims 1-7.
9. A computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform the method of any of claims 1-7.
CN202210123497.0A 2022-02-10 2022-02-10 Compiling method, computing device and storage medium Active CN114168153B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210123497.0A CN114168153B (en) 2022-02-10 2022-02-10 Compiling method, computing device and storage medium
CN202210374572.0A CN114741086A (en) 2022-02-10 2022-02-10 A compiling method, computing device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210123497.0A CN114168153B (en) 2022-02-10 2022-02-10 Compiling method, computing device and storage medium

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202210374572.0A Division CN114741086A (en) 2022-02-10 2022-02-10 A compiling method, computing device and storage medium

Publications (2)

Publication Number Publication Date
CN114168153A CN114168153A (en) 2022-03-11
CN114168153B true CN114168153B (en) 2022-05-20

Family

ID=80489587

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202210374572.0A Pending CN114741086A (en) 2022-02-10 2022-02-10 A compiling method, computing device and storage medium
CN202210123497.0A Active CN114168153B (en) 2022-02-10 2022-02-10 Compiling method, computing device and storage medium

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202210374572.0A Pending CN114741086A (en) 2022-02-10 2022-02-10 A compiling method, computing device and storage medium

Country Status (1)

Country Link
CN (2) CN114741086A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116125838A (en) * 2023-02-13 2023-05-16 中国联合网络通信集团有限公司 Control method and device of field monitoring unit and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885264A (en) * 2005-06-21 2006-12-27 国际商业机器公司 Software package constructing method and system for embedded system
CN109165010A (en) * 2018-08-15 2019-01-08 中国人民解放军国防科技大学 Software radio development method for Android system
CN111309451A (en) * 2020-03-24 2020-06-19 广西梯度科技有限公司 Method for realizing cross compilation of Docker mirror images
CN112363728A (en) * 2020-11-20 2021-02-12 浪潮软件科技有限公司 Cross-platform compiling method and system supporting continuous integration construction
CN113064595A (en) * 2021-03-22 2021-07-02 北京北信源软件股份有限公司 QT application program compiling method and device based on Docker mirror image
US11163559B1 (en) * 2020-12-28 2021-11-02 Temper Systems, Inc. Cross-publishing software libraries to module repositories
CN113672342A (en) * 2021-08-02 2021-11-19 上海交通大学 Embedded virtualization system, construction method, test method, terminal and medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010061538A (en) * 2008-09-05 2010-03-18 Toshiba Tec Corp Program developing device and method, and program for cross development
US10073687B2 (en) * 2016-08-25 2018-09-11 American Megatrends, Inc. System and method for cross-building and maximizing performance of non-native applications using host resources
CN106502695A (en) * 2016-10-26 2017-03-15 合肥润客软件科技有限公司 One kind is based on embedded software development method
CN113687913B (en) * 2021-08-05 2024-08-23 浪潮云信息技术股份公司 Lightweight application adaptation method for edge computing heterogeneous environment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885264A (en) * 2005-06-21 2006-12-27 国际商业机器公司 Software package constructing method and system for embedded system
CN109165010A (en) * 2018-08-15 2019-01-08 中国人民解放军国防科技大学 Software radio development method for Android system
CN111309451A (en) * 2020-03-24 2020-06-19 广西梯度科技有限公司 Method for realizing cross compilation of Docker mirror images
CN112363728A (en) * 2020-11-20 2021-02-12 浪潮软件科技有限公司 Cross-platform compiling method and system supporting continuous integration construction
US11163559B1 (en) * 2020-12-28 2021-11-02 Temper Systems, Inc. Cross-publishing software libraries to module repositories
CN113064595A (en) * 2021-03-22 2021-07-02 北京北信源软件股份有限公司 QT application program compiling method and device based on Docker mirror image
CN113672342A (en) * 2021-08-02 2021-11-19 上海交通大学 Embedded virtualization system, construction method, test method, terminal and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于Linux 的嵌入式交叉编译环境的建立及实现;刘永林 等;《电脑开发与应用》;20111231;全文 *

Also Published As

Publication number Publication date
CN114168153A (en) 2022-03-11
CN114741086A (en) 2022-07-12

Similar Documents

Publication Publication Date Title
JP6122493B2 (en) Adaptively portable library
US10768916B2 (en) Dynamic generation of CPU instructions and use of the CPU instructions in generated code for a softcore processor
CN111290952B (en) Tracking method and device for dynamic link library function
CN113127100B (en) Heterogeneous program execution method and device, computing device and readable storage medium
US8997066B2 (en) Emulating pointers
CN104246695B (en) Nesting emulation and dynamic link environment
CN114217886A (en) Function calling method, computing device and storage medium
CN113282301B (en) Assembly instruction conversion method based on correlation between high-level language and assembly language
CN112667352A (en) Multi-CPU instruction cross compiling unified construction method, equipment and medium
CN114816417B (en) Cross compiling method, device, computing equipment and storage medium
Shuja et al. Case of ARM emulation optimization for offloading mechanisms in mobile cloud computing
WO2015020655A1 (en) Migration of executing processes
CN114168153B (en) Compiling method, computing device and storage medium
Zhong et al. Using arm scalable vector extension to optimize open mpi
CN114003289B (en) Application program running method, computing device and storage medium
EP3738028B1 (en) Reduced instructions to generate global variable addresses
CN115061693B (en) In-memory computing code and micro-architecture optimization method and device and computing equipment
KR101083271B1 (en) System and method for converting active x control
CN114217904A (en) Multi-version application operation method, computing device and storage medium
CN116089019B (en) Hexagon architecture-oriented fine-grained CPU simulator
CN112579169B (en) Method and device for generating processor trace stream
Kreiner et al. A novel codesign approach based on distributed virtual machines
Yang et al. Implementing and Optimizing of Entire System Toolkit of VLIW DSP Processors for Embedded Sensor‐Based Systems
CN114036066A (en) A unit testing method, apparatus, computing device and readable storage medium
CN118132170A (en) Heterogeneous processor dynamic adaptation method, device and system

Legal Events

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