What C COMPILERS are available
On all Athena platforms, the preferred C compiler is gcc - the GNU C
Compiler. On Sun machines, the "cc" compiler is also available in
/usr/athena/bin, and will run the Sunsoft cc compiler. On Linux, the
"cc" command is merely a symbolic link to gcc.
Some platforms do have a choice of compilers. This allows you to switch
if you are looking for an ANSI-C compiler where the native compiler is
not ANSI. Also, some compilers optimize better than others. Supported
compilers are ones that Athena believes will work well, that someone is
willing to take bug reports about, and that you can get some help with.
These are the supported C compilers on the various platforms:
Platform Compiler ANSI POSIX
Sun gcc Yes Yes
suncc Yes No
SGI cc Yes Yes
gcc Yes Yes
Linux gcc Yes Yes
These compilers span the range from traditional Kernighan and Ritchie C
to strict ANSI C.
* GCC is the GNU C Compiler. -- This comes from the gnu project of the
Free Software Foundation. Bugs or problems encountered with it should
be sent to "bugs@mit.edu". The gcc compiler is fully ANSI
compliant, and with a variety of command line switches one can vary how
strict it is. For example, "gcc -ansi -Wall -pedantic" will help you
verify that your code is strictly ANSI compliant. You can also use
the "-traditional" flag, which causes it to accept traditional
(Kernighan & Ritchie 1st edition) C instead of ANSI C. To use gcc:
On Linux
- /usr/bin/gcc
On Solaris
- /usr/gcc/bin/gcc
(In Athena 9.2, this is expected to move to /usr/athena/bin/gcc)
gcc also exists in the "gnu" locker, however it may not be
the latest version. It is therefore recommended that you use the
local version first.
You can then compile as usual, using "gcc" in place of the command
"cc". So instead of typing:
cc -c myfile.c
you would type:
gcc -c myfile.c
If you use a makefile, you could put "CC=gcc" into your Makefile.
On the Suns, Sunsoft has provided a compiler which is called suncc on
Athena to avoid confusion with cc. To use first type:
add sunsoft
and then compile as you would with cc or gcc. (/usr/athena/bin/cc on
the Suns will run the same compiler). gcc is also available, and is the
recommended compiler on the Suns.
The native Silicon Graphics C compiler "cc", is the best compiler to use
for the SGI workstations. It is custom-tailored for the SGI's.
By default, "cc" behaves as if the option "-xansi" were set on the
command line. Other available options include:
-cckr traditional K&R C
-ansi ANSI/ISO C
-xansi ANSI/ISO C with same defines as -cckr
-ansiposix ANSI/ISO C and POSIX compliance
The highest level of optimization is specified with the "-O3" flag. You
may also want to use the "-mips2" option, which generates code using the
MIPS 2 instruction set (MIPS 1 plus R4000-specific extensions). For
more information about the MIPS 2 instruction set, and the
/usr/lib/mips2 libraries, see the "mips2 (5)" manual page:
athena% man 5 mips2
see the answer:
22* SGI Answers
7 What COMPILERs are on the SGI
for more information.
last updated: 17 March 2003
|