gcc Overview

The GNU Compiler Collection (GCC) includes front ends for C, C++, Objective-C, Fortran, Java, Ada, Go, and libraries for many more. GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user’s freedom. Cray provides the GNU compilers as part of several programming environments. Titan has GNU versions as part of the PrgEnv-gnu environment, and gcc in /usr/bin. Note that Cray Systems have two different types of nodes, with implications to compiling code on each.
  1. Compute nodes running the CNL OS.
    • To build code for the compute nodes, you should use the Cray wrappers cc, CC, and ftn.
    • The wrappers will call the appropriate GNU compiler which will use the appropriate header files and link against the appropriate libraries.
  2. Service and login nodes running Linux.
    • To build code for the Linux service nodes, you can call the GNU compilers directly. (See list below.)
    • We strongly suggest that you don't call the GNU compilers directly if you are building code to run on the compute nodes.
The Cray wrappers cc, CC, and ftn will automatically link against MPI (-lmpi) and SciLib (-lsci). This is not true when calling the GNU compilers directly. See the cc, CC, and ftn man pages for more information on their usage. To see man pages on GNU compilers with a full list of compiler options, first make sure the "PrgEnv-gnu" module is loaded, and then do a man on any of the following:
  • gcc
  • g++
  • gfortran
For more detailed information, see GNU documentation and Cray's documentation.


It is best to review the gcc, g++, and gfortran man pages for a list of their options. To use the Cray wrappers with the GNU compilers, the PrgEnv-gnu module should be loaded:
module avail PrgEnv
module swap PrgEnv-pgi PrgEnv-gnu   # this loads the current version of gcc
To just use the GNU compilers directly, just load the gcc module you want:
module avail gcc
module load gcc/4.5.3  # Note that this does not change/update the Cray wrappers.
It is possible to use the GNU compiler versions directly without loading the Cray Programming Environments, but note that the Cray wrappers will probably not work as expected if you do that. The following information is available by running module help gcc
----------- Module Specific Help for 'gcc/4.9.0' ------------------

gcc 4.9.0

Release Date:
June 5, 2014

The gcc 4.9.0 release. 
The additional cray-set-gcc-libs rpm sets up the 
linking infrastructure for gnu shared libraries.

The following bug is fixed in the gcc 4.9.0 release.
  808706  NAMD GPU version segfaults when compiled with gcc/4.8.2 [GCC Bug 58800]

Product and OS Dependencies:
The gcc 4.9.0 release is supported on the following Cray systems:
* Cray XE and XK systems with CLE 4.2 and CLE 5.2.
* Cray XC systems with CLE 5.1 and CLE 5.2.

gcc 4.9.0 is not supported with Cuda 5.5. 
The Cuda runtime header will show an error when compiling with nvcc. 
It is recommended to only install gcc 4.9.0 as non-default on 
XK systems for this reason.


module load gcc/4.9.0

This modulefile defines the system paths and environment variables 
needed to use gcc, gfortran and g++ on Cray systems. The gcc modulefile 
can be swapped for other gcc versions. This modulefile may be loaded 
as a standalone modulefile or as part of the GNU Programming Environment, 
PrgEnv-gnu. The CrayPE drivers, cc, CC, and gfortran, are recommended for 
use with PrgEnv-gnu to generate compilation and link lines.

The following modulefiles support the GNU 4.9.0 based Programming Environment:
For Cray XE and XK systems:
  xt-asyncpe               5.27    or later
For Cray XC systems:
  craype                   2.1.2   or later
For Cray XE, XK, and XC systems:
  cray-mpich               7.0.0   or later
  cray-libsci             13.0.0   or later
  libsci_acc               3.0.2   or later
  cray-tpsl                1.4.1   or later
  cray-petsc      or later
  cray-trilinos  or later
  cray-hdf5                1.8.13  or later
  cray-hdf5-parallel       1.8.13  or later
  cray-netcdf              4.3.2   or later
  cray-netcdf-hdf5parallel 4.3.2   or later
  cray-parallel-netcdf     1.4.1   or later
  cray-ga         or later
  fftw2           or later
  fftw            or later

Installation instructions:
rpm -ihv cray-set-gcc-libs-1.0.0-02.x86_64.rpm
rpm -ihv cray-gcc-4.9.0-09.x86_64.rpm

To change the product version to default after installation:

Certain components, files or programs contained within this package or product are Copyright -2014 Cray Inc. All rights reserved.

To re-display gcc/4.9.0 release information,
type:    less /opt/gcc/4.9.0/release_info


  • 4.3.4
  • 4.7.2
  • 4.8.1
  • 4.8.2
  • 4.9.3
  • 5.2.0
  • 5.3.0
  • 6.1.0
  • 6.2.0
  • 6.3.0
  • 7.1.0


  • 3.4.6
  • 4.3.3
  • 4.4.4
  • 4.4.7
  • 4.6.3
  • 4.7.1
  • 4.8.2
  • 5.3.0
  • 6.2.0


  • 4.3.4
  • 4.6.1
  • 4.7.2
  • 4.8.1
  • 4.8.2
  • 4.9.0
  • 4.9.2
  • 4.9.3
  • 5.1.0
  • 5.3.0
  • 6.1.0
  • 6.2.0
  • 6.3.0