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

[netCDF #TXD-183019]: hdf5 shared libraries when installing netcdf-4



> Hello,
>
> I encounter errors when running make check for netcdf-4 on my Ubuntu Linux
> version 8.04 "Hardy":
>
> ./tst_v2: error while loading shared libraries: libhdf5_hl.so.0: cannot open
> shared object file: No such file or directory
>
> Before getting here, I have installed zlib and HDF5 as recommended:
> 1.zlib:
> sudo mv zlib-1.2.3.tar.gz /usr/local
> sudo tar -xvzf zlib-1.2.3.tar.gz
> cd zlib-1.2.3
> sudo ./configure
> sudo make check install
>
> 2.HDF5:
> sudo mv hdf5-1.8.1.tar.gz /usr/local
> sudo tar -xvzf hdf5-1.8.1.tar.gz
> cd hdf5-1.8.1
> sudo FC=/usr/bin/gfortran ./configure --prefix=/usr/local
--with-zlib=/usr/local
> --enable-fortran --enable-cxx
> sudo make install
>
> 3.netCDF:
> sudo mv netcdf-4.0.tar.gz /usr/local
> sudo tar -xvzf netcdf-4.0.tar.gz
> cd netcdf-4.0
> sudo ./configure --enable-netcdf-4 --with-hdf5=/usr/local
--with-zlib=/usr/local
> sudo make check
>
> It is at this point I get the message above.
>
> I also tried adding /usr/local/lib to /etc/ld.so.conf, as well as adding
> /usr/local/lib to /etc/ld.so.conf.d/i486-linx-gnu.conf, but still get the
above
> error after re-executing the netcdf configure script and make check.  While
> setting LD_LIBRARY_PATH to /usr/local/lib (that's where the hdf5 libraries
were
> installed) might remedy this problem, I understand it is not a desirable
> approach.
>
> I have gone ahead and executed make install and get a successful netcdf
> installation, but I get the same error message about not finding the hdf5
> shared libraries at run-time (i.e., executing the out.o file compiled from
> fortran code that uses the netcdf functions).  Below is how I compile:
>
> gfortran -o out.o [myprogram.f90] -I/usr/local/include -L/usr/local/lib
-lnetcdf
> -lhdf5 -lhdf5_hl
>
> I would appreciate any help you can offer.
>
> Thanks,
> Brad Christoffersen
>

Howdy Brad!

Usually I build the netCDF libraries with static HDF5 libraries, but I have
also tested with shared HDF5 libraries and it should work fine.

Are you running make check for hdf5? Or is HDF5 silently failing to build
shared libraries for you? Because my understanding is that if you want to build
shared HDF5 libraries, you need to set CPPFLAGS=-fPIC when building zlib.

Instructions can be found in the netCDF installation manual:
http://www.unidata.ucar.edu/software/netcdf/docs_snapshot/netcdf-install.html#Quick-Instructions

In any case, you can tell by looking for the file: libhdf5_hl.so.0

If that file is not there, you need to get it before you proceed. This is the
shared library for the "high-level" hdf5 library.

If you do have that file, try setting LD_LIBRARY_PATH to that directory and run
it again.

You will often hear people tell you not to use LD_LIBRARY_PATH, and far be it
for me to contradict received wisdom. But I note that all commercial compilers
(like Intel) routinely set LD_LIBRARY_PATH, and no one seems to greatly mind.
But, as you say, you should be able to avoid it by installing the HDF5
libraries in /usr/lib or someplace listed in /etc/ld.so.conf. But system
administration can involve many gotchas, and I would advise testing with
LD_LIBRARY_PATH to see if your modifications to /etc/ld.so.conf are not working
as they should.

If none of these suggestions solves your problem, please let me know.

Thanks,

Ed

Ticket Details
===================
Ticket ID: TXD-183019
Department: Support netCDF
Priority: Normal
Status: Closed