Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Error can't find of link to hdf5 libary while installing Netcdf 4

I’m trying to install Netcdf 4 which supports an air quality model that I will compile after finishing this netcdf installation.

However, I faced the "error: Can’t find or link to the hdf5 library" which I found several solutions from your website and others, however, all do not work.

My steps to install include:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

#install zlib:
tar xvzf zlib-1.2.11.tgz
cd zlib-1.2.11
mkdir /usr/local/zlib-1.2.11
./configure --prefix=/usr/local/zlib-1.2.11
make
make install
#install hdf5
tar xvzf hdf5-1.12.0.tar.gz
cd hdf5-1.12.0
mkdir /usr/local/hdf5-1.12.0
exportLDFLAGS=-L/usr/local/zlib-1.2.11
export FC=gfortran
./configure --prefix=/usr/local/hdf5-1.12.0 --enable-fortran
make
make install
#Install netcdf
tar xvzf netcdf-4.6.2.tar.gz
cd netcdf-4.6.2
mkdir /usr/local/netcdf-4.6.2
export CFLAGS=-I/usr/local/hdf5-1.12.0/include
export LDFLAGS=-L/usr/local/hdf5-1.12.0/lib
export LD_LIBRARY_PATH=/usr/local/hdf5-1.12.0/lib/
export FC=gfortran
./configure --prefix=/usr/local/netcdf-4.6.2

then faced the error message:

"checking for library containing H5Fflush... no
configure: error: Can't find or link to the hdf5 library. Use --disable-netcdf-4, or see config.log for errors."

My laptop information is:

Static hostname: it-Precision-7520
     Icon name: computer-laptop
       Chassis: laptop
  Operating System: Ubuntu 20.04.3 LTS
        Kernel: Linux 5.11.0-27-generic
  Architecture: x86-64

Please advise me what could be the problem? How could I solve it?
Thank you very very much.
Chi

>Solution :

You should not force Ubuntu to be LFS. You should remove all locally installed stuff by using commands below:

cd /usr/local/zlib-1.2.11
sudo make uninstall

cd /usr/local/hdf5-1.12.0
sudo make uninstall

cd /usr/local/netcdf-4.6.2
sudo make uninstall

And then use official Ubuntu repositories. They provide needed zlib, hdf5 and netcdf.
So to install all of them you have to open terminal and execute the following commands:

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install zlib1g-dev libhdf5-dev libnetcdf-dev

and then you’ll be able to compile any application involving these libraries.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading