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

[netCDF #LLV-851787]: netcdf 4.1.2 issue: undefined reference to `netcdf_mp_nf90_open_', etc

> Hi Russ,
> I modified the parameters in the makefile below.
> NETCDF_LIBS=-I$(NETCDF)/include -L$(NETCDF)/lib -lnetcdff
> The error related netcdf_mp* gone, but new occurs.
> ------
> /home/sfeng/src/4chem/netcdf-4.1.2/lib/libnetcdff.so: undefined reference
> to `nc_put_vara_short'
> /home/sfeng/src/4chem/netcdf-4.1.2/lib/libnetcdff.so: undefined reference

Those errors indicate that the C netCDF library is not being linked.  You need 
use instead:

  NETCDF_LIBS=-I$(NETCDF)/include -L$(NETCDF)/lib -lnetcdff -lnetcdf

> I think I built netcdf with shared lib because I didn't specify that as
> compiling.

It would definitely be shared with the latest release, netcdf-, but 
with 4.1.2 it may have been created static only, or without the information
included about where the C library could be found.

If you use the above and get other unsatisfied externals, you'll need to
add more libraries, such as -ldap -lcurl -libz.


> On 2/13/13 12:05 PM, "Unidata netCDF Support"
> <address@hidden> wrote:
> >Hi Sha,
> >
> >I think the problem may be that the  Fortran library must now be
> >explicitly linked,
> >whereas previous releases allowed the Fortran library to be built right
> >into the
> >C library.  That means instead of just linking with "-lnetcdf", you need
> >to use
> >"-lnetcdff" (note the extra "f" in the first library name).
> >
> >If you build with shared libraries (the default) then this is all thatis
> >necessary.
> >If you build with static libraries only, then you must also specify
> >"-lnetcdf" after
> >"-lnetcdff" and any other libraries that were used when netCDF was built.
> >
> >--Russ
> >
> >
> >Russ Rew                                         UCAR Unidata Program
> >address@hidden                      http://www.unidata.ucar.edu
> >
> >
> >
> >Ticket Details
> >===================
> >Ticket ID: LLV-851787
> >Department: Support netCDF
> >Priority: Normal
> >Status: Closed
> >

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

Ticket Details
Ticket ID: LLV-851787
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.