Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the exact difference between cross-compiling and native compiling?

share|improve this question

You use a cross compiler to produce executables (or objects) for a platform other than the local host. The native compiler only produces native binaries.

share|improve this answer
Just an additional note. Cross compiling may require some library installation on the target(MSYS possibly) – hbdgaf Feb 7 '11 at 13:46
@aking1012 — I don't think that's necessarily an issue with cross-compiling itself. – mattdm Feb 7 '11 at 17:33
@mattdm - if we are talking cross compiling across architecture it is not. if we are talking about cross compiling from linux to windows...maybe I'm interpreting cross-compiling differently. – hbdgaf Feb 7 '11 at 17:38
@aking1012 — I think it's an implementation detail in either case. – mattdm Feb 7 '11 at 17:53

Cross compiling is compiling something for different CPU type than the one you are running on. An example is compiling ARM binaries under an i386 system, or compiling 64-bit executables under a 32-bit system.

You normally won't be able to run what you've just compiled when you cross compile it, until you ship the binaries to the system they belong to.

Native compiling is when you compile for the same architecture you're running under, which is the normal situation.

share|improve this answer
Cross-compiling is more generally compiling for a different platform, not just a different CPU type. For example, MinGW can be used as a cross-compiler to build MS Windows executables on Linux — x86 in both cases. – mattdm Feb 7 '11 at 17:36
which one is too slow? – Renjith G Feb 8 '11 at 4:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.