NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdfgroup] auto linking hdf5 libraries?

  • To: Chris Webster <cjw@xxxxxxxx>
  • Subject: Re: [netcdfgroup] auto linking hdf5 libraries?
  • From: Russ Rew <russ@xxxxxxxxxxxxxxxx>
  • Date: Thu, 08 Apr 2010 12:59:50 -0600
Hi Chris,

> So I notice that on some of my netCDF installations from RPMs if you 
> link against libnetcdf_c++ that it will automatically link to libnetcdf 
> also.  Would it be possible to get the same behavior from the hdf5 
> libraries when/if netCDF is being built against hdf5? 
> 
> My case for this is that software we distribute which depends upon 
> netCDF but not HDF5 does not know whether the target system has the HDF5 
> build of netCDF or not (sorry I am not sophisticated enough to use 
> autoconfig at this time).  So the user will have to tweak Makefile / 
> SConscript files to either add or delete the -lhdf5.
> 
> e.g. ncplot does not require hdf5, but when UWyo downloads the source 
> and builds they may have to tweak the Makefile for -lhdf5 depending on 
> which netCDF version they have.
> 
> So, is what I am asking for possible?  Am I making sense?

Dennis pointed out that if the target system was built from the latest
source with --enable-shared, then the shared netCDF library is supposed
to link to the HDF5 libraries, if needed.

However, using the nc-config utility may work for what you have in mind,
even if the target system has a static build of netCDF libraries.

Compile and link the Fortran application with something like:

 $(FC) `nc-config --fflags` myapp.f90 `nc-config --flibs`

where the particular options to this use of nc-config are

  --fflags  for the Fortran compiler options used

  --flibs   for the libraries needed to link against

--Russ



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: