Cross_compiler Cross_compiler

Cross compiler - Definition and Overview

A cross compiler is a compiler capable of creating executable code for another platform than the one on which the cross compiler is run. Such a tool is handy when you want to compile code for a platform that you don't have access to, or because it is inconvenient or impossible to compile on that platform (as is the case with embedded systems.)

Compiling a gcc cross compiler

gcc is a free cross compiler that supports dozens of platforms and a handful of languages. However, due to limited volunteer time and the huge amount of work it takes to maintain working cross compilers, in many releases some of the cross compilers are broken.

gcc relies upon the binaries of binutils for the targeted platform to be available. Especially important is as - the GNU Assembler. Therefore, binutils first has to be compiled correctly with the switch --target=some-target sent to the configure script. gcc also has to be configured with the same --target option. Then gcc can be compiled as normal provided that the tools binutils creates are available in the path. On unix-like OS:es with bash, that can be accomplished with the following:

 PATH=/path/to/binutils/bin:$PATH make

Cross compiling gcc requires that a portion of the C standard library is available for the targetted platform on the host platform. Atleast the crt0, ... components of the library has to be available in some way. You can either choose to compile the full C library but it can be to large for many platforms. The alternative is then to use newlib, which is a small C library containing just the most essential components required to get C source code compiled. To configure gcc with newlib use the switch --with-newlib to the configure script.

External links

Example Usage of compiler

imoracle: Javascript compiler by Google-Compress Javascript with Closure compiler http://su.pr/2BlImm #google @BloggingDev
bloggingdev: Javascript compiler by Google-Compress Javascript with Closure compiler http://su.pr/2BlImm
computergroups: a compiler for managed c++: I am asking a beginner's question. Is there any free compiler (or toolchain) for.. http://bit.ly/8MY0bk
Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.