How to Compile Software on Suns and Linux Machines

There are two compilers available on Solaris: CC and GCC. On Linux/x86, only GCC is available. The appropriate choice of editor and options depends on where the code will run and what you want it to do.

After reading this page you may want to consult the RVL computing guide to compare performance for different types of code run on different systems.

Compiling on Sun UltraSPARC

UltraSPARC is a 64-bit architecture, but it can run both 32-bit SPARC and 64-bit UltraSPARC code. 32-bit code has an address space limited to 232, or 4 GB. If your process needs a larger address space (maybe you are building a server, or anything using large data sets), you will have to specify 64-bit code, and then run it on an UltraSPARC. Both CC and GCC produce 32-bit code by default when compiling on an UltraSPARC (and they can only produce 32-bit code when compiling on a SPARC!).

Here is how to compile 32-bit and 64-bit code. Note that the options are confusingly similar! "-O3" vs "-O5", and "-mcpu=v9" vs "-xarch=v9".

GCC options
Options Meaning
gcc 32-bit code
gcc -O3 Optimized 32-bit code
gcc -O3 -mcpu=v9 Optimized 64-bit code
CC options
Options Meaning
CC 32-bit code
CC -O5 Optimized 32-bit code
CC -O5 -xarch=v9 Optimized 64-bit code

Compiling on Linux/x86 or BSD/x86

Things are much simpler here because the Intel x86 processor is a 32-bit architecture. No worrying about which options to use, but the process is always limited to an address space of 232.

GCC options
Options Meaning
gcc 32-bit code
gcc -O3 Optimized 32-bit code

Compiling on Linux/Alpha or BSD/Alpha

If you happen to have an Alpha platform available, and you're running Linux or BSD, you have GCC. In this case all binaries will be 64-bit, and of course the floating-point math will go very fast!

RVL Computing Benchmarks

Here is a page comparing performance for different types of code, compiled in different ways, run on different platforms in the lab.