C++ Compiler

Compilation of PSRCHIVE source code requires a C++ compiler that supports useful features of the C++ standard, such as the numeric_limits traits.

For this reason, it is no longer possible to compile PSRCHIVE with GCC version 2.95. This document therefore considers only those issues that arise with GCC Release Series 3 and 4 (and any other supported compilers, as they are discovered).

Known C++ and Fortran 77 conflicts

Mac Users: Please see the special notes on OS X compilers.

Unfortunately, the GNU compilers install the Fortran and C++ libraries in the same sub-directory, making it difficult to link codes that have been compiled with different versions of g77/gfortran and g++. (Why?)

In short:

  • If g77 is used, then you must ensure that gcc and g++ from Release Series 3 are used.
  • If gfortran is used, then you must ensure that gcc and g++ from Release Series 4 are used.

In more detail:

  • Ensure that both gcc and g++ report the desired version number; e.g.
    > g++ -v
    blah blah blah
    gcc version V.x.y ...
    
    where V is the Release Series number.

  • If the defaults are not from the desired GCC Release Series, set your PATH environment variable such that the desired versions are the default, or set the CC and CXX environment variables to the full paths of the desired compilers.

  • If you want to use GCC Release Series 4: By default, the configure script will find g77 before it finds gfortran. Therefore, you must set the F77 environment variable to gfortran. Depending on your PATH environment variable, you may need to specify the full path to gfortran.