Difference between revisions of "Cross compilation"

From Organic Design wiki
(clarify)
m
Line 1: Line 1:
[[Category:glossary]]
+
Put simply, a compiler takes source code as input and produces a binary executable as output. Cross compilation refers to the case where the binary code produced is designed to execute on a different machine architecture than the host system.
This means being able to build a binary on a ''host'' system that will run on a ''target'' system. Generally the term refers to the case where these systems are of different system architectures. For example compiling the [[Husk.c]] under Linux and producing a binary that will run under windows or mac.
+
 
 +
For example: Using a C compiler on a PPC system to produce code to run on an Intel.
 +
 
 +
A cross-compilation environment (refered to as the ''toolchain'') provides a number of advantages, even when the host and target architectures are the same.  
 +
*Strict control of the version on cc, libc and binutils used
 +
*The build process can be run as a non-root user on the host unix system, preventing damage to the host system if the toolchain misbehaves
 +
 
 +
In our case we use the [http://buildroot.uclibc.org buildroot] toolchain.  
  
 +
*[[w:Cross-compiling|Cross-compiling]]
 
*host enviroment
 
*host enviroment
 
**a version of ''gcc'' and ''binutils'' that supports cross compilation is required in the ''host'' enviroment
 
**a version of ''gcc'' and ''binutils'' that supports cross compilation is required in the ''host'' enviroment
 
**headers to link against are required
 
**headers to link against are required
 
**libraries are required to be present that are compatible with the ''target'' system.
 
**libraries are required to be present that are compatible with the ''target'' system.
 
 
  
 
Related articles
 
Related articles
 +
*[http://buildroot.uclibc.org buildroot]
 
*http://www.airs.com/ian/configure/configure_5.html
 
*http://www.airs.com/ian/configure/configure_5.html
*[http://kegel.com/crosstool/crosstool-0.42/buildlogs/ gcc toolchain cross compilation matrix] - this guy is keen
+
*[http://kegel.com/crosstool/crosstool-0.42/buildlogs/ gcc toolchain cross compilation matrix]
 
*[[Wikipedia:Eat one's own dog food|Eating one's own dog food]]
 
*[[Wikipedia:Eat one's own dog food|Eating one's own dog food]]
 +
 +
[[Category:glossary]]

Revision as of 22:38, 10 November 2006

Put simply, a compiler takes source code as input and produces a binary executable as output. Cross compilation refers to the case where the binary code produced is designed to execute on a different machine architecture than the host system.

For example: Using a C compiler on a PPC system to produce code to run on an Intel.

A cross-compilation environment (refered to as the toolchain) provides a number of advantages, even when the host and target architectures are the same.

  • Strict control of the version on cc, libc and binutils used
  • The build process can be run as a non-root user on the host unix system, preventing damage to the host system if the toolchain misbehaves

In our case we use the buildroot toolchain.

  • Cross-compiling
  • host enviroment
    • a version of gcc and binutils that supports cross compilation is required in the host enviroment
    • headers to link against are required
    • libraries are required to be present that are compatible with the target system.

Related articles