tags:

views:

90

answers:

2

The way I understand gcc, /usr/bin/gcc (and other bits related to gcc, like ld) is a small wrapper that delegates to a platform-specific binary somewhere else on the system.

So does compilation still work correctly if you have a cross compiler that is a couple of versions behind /usr/bin/gcc?

+2  A: 

Yes, the whole Idea is to allow gcc to be installed in different versions and for different target platforms (in any combination) to be installed in parallel.

/usr/bin/gcc just uses fork+exec to call the actual compiler. The command line arguments given to gcc are just passed to the actual compiler with two exceptions: -V and -b. The latter selects the target platform the former the version of the compiler.

bothie
A: 

You won't use /usr/bin/gcc to cross-compile. Instead you'll install another compiler in another prefix. For instance if you're on debian/ubuntu you can install a ming (win32) cross-compiler by doing:

apt-get install mingw32

Which will work perfectly fine side by side with the normal gcc.

Johan Dahlin