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

[netCDF #RTU-667260]: undefined reference to `netcdf_mp_nf90_inq_varid_'

Hi Ahsan,

> I am getting following error while compilation of an application.
> Seems like something related to netcdf and mpif90. Although I have
> compiled netcdf with mpif90 option, dont why this error is happening.
> Any hint would be highly appreciated.
> /home/pmdtest/cosmo/source/cosmo_110525_4.18/obj/src_obs_proc_cdf.o:
> In function `src_obs_proc_cdf_mp_obs_cdf_read_org_':
> /home/pmdtest/cosmo/source/cosmo_110525_4.18/src/src_obs_proc_cdf.f90:(.text+0x17aa):
> undefined reference to `netcdf_mp_nf90_open_'
> /home/pmdtest/cosmo/source/cosmo_110525_4.18/obj/src_obs_proc_cdf.o:
> In function `src_obs_proc_cdf_mp_obs_cdf_read_temp_pilot_':
> /home/pmdtest/cosmo/source/cosmo_110525_4.18/src/src_obs_proc_cdf.f90:(.text+0x1000e):
> undefined reference to `netcdf_mp_nf90_inq_varid_'
> /home/pmdtest/cosmo/source/cosmo_110525_4.18/src/src_obs_proc_cdf.f90:(.text+0x10039):
> undefined reference to `netcdf_mp_nf90_inq_varid_'

I'm not sure which version of netCDF you are using, but with version 4.2 and 
later, the
C and Fortran libraries were split into separate software distributions, and 
separate installations.  Even before that (in versions 4.1.1 through 4.1.3) the 
libraries were installed in a separate library file, which required Fortran 
builds to
link with the Fortran library using an additional library specification, as in 
like (depending on where your libraries were installed)

   gfortran ... -L/usr/local/lib -lnetcdff -lnetcdf

to search in both the Fortran netCDF library and the C netCDF library.

You also need to indicate where the Fortran-90 module, usually something like 
was installed, with a "-I" or "-M" flag, such as

   gfortran ... -I/usr/include ...

Finally, I have seen the kind of error you are seeing on MacOS X 10.7 (Lion) 
systems, when
ifort is the Fortran compiler.  In that case, setting the following environment 
variable is
required for successful linking:


when running "configure" to build the netCDF libraries, as described here:




Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu

Ticket Details
Ticket ID: RTU-667260
Department: Support netCDF
Priority: Normal
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.