[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 
require
separate installations.  Even before that (in versions 4.1.1 through 4.1.3) the 
Fortran
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 
something
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 
"netcdf.mod",
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:

  lt_cv_ld_force_load=no

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

  
http://www.unidata.ucar.edu/software/netcdf/docs/known_problems.html#intel-fortran-macosx

--Russ


  


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