什么是交叉编译?

发布于 2024-07-20 22:16:20 字数 15 浏览 6 评论 0原文

什么是交叉编译?

what is cross compilation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

白馒头 2024-07-27 22:16:20

交叉编译是为一台计算机系统(通常称为目标)编译代码的行为一个不同的系统,称为主机。

这是一种非常有用的技术,例如当目标系统太小而无法托管编译器和所有相关文件时。

常见的示例包括许多嵌入式系统,但也包括典型的游戏控制台。

Cross-compilation is the act of compiling code for one computer system (often known as the target) on a different system, called the host.

It's a very useful technique, for instance when the target system is too small to host the compiler and all relevant files.

Common examples include many embedded systems, but also typical game consoles.

掐死时间 2024-07-27 22:16:20

交叉编译器将源代码从一种体系结构编译到另一种体系结构。

例如: hello.c

  1. gcc hello.c (gcc 是 x86 架构的编译器。)
  2. arm-cortexa8-linux-gnueabihf-gcc hello.c< /代码>
    (arm-....-gcc 是适用于arm 架构的编译器。)您将在主机上为目标板(例如rpi、beaglebone、wega 板)进行编译。 在此示例中,arm-cortexa8-linux-gnueabihf-gcc 称为“交叉编译器”。

这个过程称为交叉编译。
请参阅链接了解更多信息交叉编译

A cross-compiler is compiles the source code from one architecture to another architecture.

For example: hello.c

  1. gcc hello.c (gcc is a compiler for x86 architecture.)
  2. arm-cortexa8-linux-gnueabihf-gcc hello.c
    (arm-....-gcc is a compiler for the arm architecture.) This you are compiling on the host pc for a target board (e.g rpi, beaglebone, wega board). In this example arm-cortexa8-linux-gnueabihf-gcc is called the 'cross compiler'.

This process is called cross compilation.
see the link for more info cross compilation

半﹌身腐败 2024-07-27 22:16:20

“交叉编译”是指在 Linux 机器上编译源代码,并打算在 MAC 或 Windows 机器上运行它。 这通常是使用交叉编译插件来完成的,该插件可以从网络上的各种 Web 服务器轻松获得。 如果要在 Linux 机器上安装一个交叉编译插件,该插件旨在为 Windows 机器进行编译。 然后,他们可以为 Linux/*NIX 机器进行编译,也可以选择编译和链接 Windows 就绪的可执行文件。 这对于只能访问一个 Linux/Windows/MAC 机器的自由程序员来说非常方便。 请注意,各种交叉编译插件将允许多种应用程序,其中一些您可能会或可能不会认为有用,因此请仔细阅读插件的自述文件。

您是否有一个想要应用交叉编译方法的特定项目?

To "cross compile" is to compile source on say a Linux box with intent on running it on a MAC or Windows box. This is usually done using a cross compilation plugin, which are readily available from various web servers across the net. If one is to install a cross compilation plugin onto their Linux box that is designed to compile for Windows boxes. Then they may compile for either a Linux/*NIX box as well as have the option to compile and link a Windows-ready executable. This is extremely convenient for a freelance programmer whom has access to no more than a single Linux/Windows/MAC box. Note that various cross compilation plugins will allow for multitudes of applications, some of which you may or may not perceive as useful, thus a thorough perusal of the plugin's README file.

Did you have a particular project in mind that you would like to apply the method of cross compilation to?

著墨染雨君画夕 2024-07-27 22:16:20

从严格意义上讲,它是在一台主机上编译旨在在另一台主机上运行的代码。

最常见的是,它用于参考与主机不二进制兼容的架构的编译——例如,在 CISC CPU 平台上构建 RISC 二进制文件,或在 32 位系统上构建 64 位二进制文​​件。 或者,例如,构建旨在在基于 Intel PC 的操作系统上的嵌入式设备(可能使用 ARM CPU 架构)上运行的固件。

In a strict sense, it is the compilation of code on one host that is intended to run on another.

Most commonly it is used with reference to compilation for architectures that are not binary-compatible with the host -- for instance, building RISC binaries on a CISC CPU platform, or 64-bit binaries on a 32-bit system. Or, for example, building firmware intended to run on embedded devices (perhaps using the ARM CPU architecture) on Intel PC-based OSs.

娜些时光,永不杰束 2024-07-27 22:16:20

交叉编译器是一种能够为编译器运行平台以外的平台创建可执行代码的编译器。
例如,在 Windows 7 PC 上运行但生成在 Android 智能手机上运行的代码的编译器就是交叉编译器。

要从一台机器为多个平台进行编译,需要交叉编译器。
编译器运行的平台可能不可行,例如嵌入式系统的微控制器,因为这些系统不包含操作系统。
在半虚拟化中,一台机器运行许多操作系统,交叉编译器可以从一个主要来源为每个操作系统生成可执行文件。

A Cross Compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running.
For e.g. a compiler that runs on a Windows 7 PC but generates code that runs on Android smartphone is a cross compiler.

A cross compiler is necessary to compile for multiple platforms from one machine.
A platform could be infeasible for a compiler to run on, such as for the microcontroller of an embedded system because those systems contain no operating system.
In paravirtualization one machine runs many operating systems, and a cross compiler could generate an executable for each of them from one main source.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文