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

[netCDF #LSR-639549]: netcdf-4.2 compilation errors with gcc



Hi Said,

Rather than using netcdf-4.2, could you instead use the more
recent supported version netcdf-4.3.0, available from

  https://github.com/Unidata/netcdf-c/releases/tag/netcdf-4.3.0

The older netcdf-4.2 that you're using, from May 2012, had some
bugs and portability problems that were fixed in later releases.

Also, netcdf-4.2 and all later releases are C only.  The Fortran 
netCDF library was separated into its own release in October 2011,
after netcdf-4.3.1, to simplify building and installing it.

The process is now to first build and install the netCDF C library,
then get, build, and install the separate netCDF Fortran library,
which uses the netCDF C library.

Here are the instructions for building the netCDF C library and then
the netCDF Fortran library:

  http://www.unidata.ucar.edu/netcdf/docs/building.html

> I am trying to compile netcdf-4.2 for C library
> by runing
> export CC=gcc44
> export CXX=g++44
> export CFLAGS='/home/said/cosmo_pgi/src/netcdf/local/include'

As you'll see from the documentation above, that CFLAGS doesn't
identify where the header files are installed.  Instead you need
to use

  export CPPFLAGS=-I/home/said/cosmo_pgi/src/netcdf/local/include

> export CPPFLAGS='-DNDEBUG'
> export LDFLAGS='/home/said/cosmo_pgi/src/netcdf/local/lib'

As you'll see from the documenation above, to specify where other
libraries needed by netCDF are installed, you need to use something
like

  export LDFLAGS=-L/home/said/cosmo_pgi/src/netcdf/local/lib

> export FCFLAGS='-O'
> export CFLAGS='-O'
> export CXXFLAGS='-O'
> export FC=gfortran44
> export F77=gfortran44
> export F90=gfortran44
> export FFLAGS='-O -Wno-globals'

When building the C library for netCDF version 4.2 and later,
none of the following flags are used: FCFLAGS, CXXFLAGS, FC, 
F77, F90, FFLAGS

> export NCBYTE_T="integer(selected_int_kind(2))"
> export NCSHORT_T="integer*2"
> export NF_INT1_T="integer(selected_int_kind(2))"
> export NF_INT2_T="integer*2"
> export NF_INT1_IS_C_SHORT=1
> export NF_INT2_IS_C_SHORT=1
> export NF_INT_IS_C_INT=1
> export NF_REAL_IS_C_FLOAT=1
> export NF_DOUBLEPRECISION_IS_C_DOUBLE=1

You should not need to set any of the above flags.  They are
all determined automatically when you run the configure scripts
for the C and Fortran libraries.

--Russ

> ./configure  --prefix=/home/said/cosmo_pgi/src/netcdf/local/
> --enable-netcdf-4
> it is done succesfully
> but make check
> give me errors that are  :
> included file
> /home/said/cosmo_pgi/src/netcdf/netcdf-4.2/man4/tutorial.doc is not
> found. Check your EXAMPLE_PATH
> Could not open file
> /home/said/cosmo_pgi/src/netcdf/netcdf-4.2/man4/html//home/said/cosmo_pgi/src/netcdf/netcdf-4.2/man4/tutorial.doc.html
>  for writing
> make[3]: *** [doxyfile.stamp] Error 1
> make[3]: Leaving directory
> `/home/said/cosmo_pgi/src/netcdf/netcdf-4.2/man4'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory
> `/home/said/cosmo_pgi/src/netcdf/netcdf-4.2/man4'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/said/cosmo_pgi/src/netcdf/netcdf-4.2'
> make: *** [all] Error 2
> 
> 
> --
> _SAID AL-SARIRI_
> 
> _NWP SECTION _
> 
> _DGMAN_
> 
> __
> 
> 
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: LSR-639549
Department: Support netCDF
Priority: Normal
Status: Closed