Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is cross compilation?

People also ask

What does cross compilation mean?

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.

What is cross compilation and native compilation?

A Cross compiler is a compiler that generates executable code for a platform other than one on which the compiler is running. For example a compiler that running on Linux/x86 box is building a program which will run on a separate Arduino/ARM. Difference between Native Compiler and Cross Compiler : Native Compiler.


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.


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


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?


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.