Previous Next Contents

3. GCC installation and setup

3.1 GCC versions

You can find out what GCC version you're running by typing gcc -v at the shell prompt. This is also a fairly reliable way to find out whether you are set up for ELF or a.out. On my system it does

$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-box-linux/2.7.2/specs
gcc version 2.7.2

The key things to note here are

So, in summary, I have gcc 2.7.2 producing ELF code. Quelle surprise.

3.2 Where did it go?

If you installed gcc without watching, or if you got it as part of a distribution, you may like to find out where it lives in the filesystem. The key bits are

3.3 Where are the header files?

Apart from whatever you install yourself under /usr/local/include, there are three main sources of header files in Linux:

3.4 Building cross compilers

Linux as the target platform

Assuming you have obtained the source code to gcc, usually you can just follow the instructions given in the INSTALL file for GCC. A configure --target=i486-linux --host=XXX on platform XXX followed by a make should do the trick. Note that you will need the Linux includes, the kernel includes, and also to build the cross assembler and cross linker from the sources in ftp://tsx-11.mit.edu/pub/linux/packages/GCC/.

Linux as the source platform, MSDOS as the target

Ugh. Apparently this is somewhat possible by using the "emx" package or the "go" extender. Please look at ftp://sunsite.unc.edu/pub/Linux/devel/msdos.

I have not tested this and cannot vouch for its abilities.


Previous Next Contents