[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20020207: building netCDF on Linux using g77 with "-DpgiFortran"

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: 20020207: building netCDF on Linux using g77 with "-DpgiFortran"
  • Date: Thu, 07 Feb 2002 09:16:49 -0700

Dear Dr Lobo,

Because the Fortran-77 netCDF interface is actually written in C, it
is necessary for the C compiler to know the calling-conventions of
the Fortran-77 compiler. This is done by defining the C macro that
corresponds to the calling conventions used by the Fortran-77 compiler.
Because you used the Fortran-77 compiler "g77", the C macro "f2cFortran"
should have been defined instead of the C macro "pgiFortran".

If you want to use the "g77" compiler, then please try the following:

    1.  Go to the top-level source diretory.

    2.  Perform steps 3 through 5 mentioned near the end of the file
        INSTALL.html.

    3.  Ensure that the environment variable FC is set to the
        (preferably absolute) pathname of the "g77" compiler.

    4.  Ensure that the environment variable CPPFLAGS contains the
        string "-Df2cFortran",  e.g.

            export CPPFLAGS="-Df2cFortran"

        or

            setenv CPPFLAGS "-Df2cFortran"

        depending on your shell. the file INSTALL.html has more
        examples.

    5.  Perform steps 6 through 9 mentioned near the end of the file
        INSTALL.html.

If you want to use a different Fortran-77 compiler, then you need to
adjust steps 3 and 4 above accordingly.  The file INSTALL.html has
examples.

Please let me know if this helps.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>