Score:0

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

bf flag

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:

#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

N0rbert avatar
zw flag
Which application do you need to compile? How it is named? Where its sources are located?
Ha Chi Nguyen avatar
bf flag
CAMx, from website www.CAMx.com
Score:0
zw flag

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.

Ha Chi Nguyen avatar
bf flag
great. thank you very much. I follow your guideline, and set the path /usr for netcdf path of makefile of my soffware, and it's installed successfully. Thanks
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.