Re: [netcdfgroup] Error "Can't find or link to the hdf5 library". Almost crazy! Help!

  • To: Ming Tu <tuming90@xxxxxxxxx>
  • Subject: Re: [netcdfgroup] Error "Can't find or link to the hdf5 library". Almost crazy! Help!
  • From: Nick Papior Andersen <nickpapior@xxxxxxxxx>
  • Date: Thu, 26 Feb 2015 09:21:21 +0100
Try this script:

#### COPY TO install.sh ###
#!/bin/bash

# VERY BASIC installation script of required libraries
# for installing these packages:
#   zlib-1.2.8
#   hdf5-1.8.14
#   netcdf-4.3.3
#   netcdf-fortran-4.4.1

# If you have downloaded other versions edit these version strings
z_v=1.2.8
h_v=1.8.14
nc_v=4.3.3
nf_v=4.4.1

# Install path, change accordingly
# You can change this variable to control the installation path
# If you want the installation path to be a "packages" folder in
# your home directory, change to this:
ID=$HOME/local

# First we check that the user have downloaded the files
function file_exists {
    if [ ! -e $(pwd)/$1 ]; then
echo "I could not find file $1..."
echo "Please download the file and place it in this folder:"
echo " $(pwd)"
exit 1
    fi
}

file_exists zlib-${z_v}.tar.gz
file_exists hdf5-${h_v}.tar.gz
file_exists netcdf-${nc_v}.tar.gz
file_exists netcdf-fortran-${nf_v}.tar.gz
unset file_exists

#################
# Install z-lib #
#################
tar xfz zlib-${z_v}.tar.gz
cd zlib-${z_v}
./configure --prefix $ID/zlib/${z_v}
make
make test 2>&1 | tee zlib.test
make install
mv zlib.test $ID/zlib/${z_v}/
cd ../
rm -rf zlib-${z_v}
echo "Completed installing zlib"
[ -d $ID/zlib/${z_v}/lib64 ] && zlib_lib=lib64 || zlib_lib=lib

################
# Install hdf5 #
################
tar xfz hdf5-${h_v}.tar.gz
cd hdf5-${h_v}
mkdir build ; cd build
../configure --prefix=$ID/hdf5/${h_v} \
--enable-shared --enable-static \
--enable-fortran --with-zlib=$ID/zlib/${z_v} \
LDFLAGS="-L$ID/zlib/${z_v}/$zlib_lib -Wl,-rpath=$ID/zlib/${z_v}/$zlib_lib"
make
make check-s 2>&1 | tee hdf5.test
make install
mv hdf5.test $ID/hdf5/${h_v}/
cd ../../
rm -rf hdf5-${h_v}
echo "Completed installing hdf5"
[ -d $ID/hdf5/${h_v}/lib64 ] && hdf5_lib=lib64 || hdf5_lib=lib

####################
# Install NetCDF-C #
####################
tar xfz netcdf-${nc_v}.tar.gz
cd netcdf-${nc_v}
mkdir build ; cd build
../configure --prefix=$ID/netcdf/${nc_v} \
--enable-shared --enable-static \
--enable-netcdf-4 --disable-dap \
CPPFLAGS="-I$ID/hdf5/${h_v}/include -I$ID/zlib/${z_v}/include" \
LDFLAGS="-L$ID/hdf5/${h_v}/$hdf5_lib -Wl,-rpath=$ID/hdf5/${h_v}/$hdf5_lib \
-L$ID/zlib/${z_v}/$zlib_lib -Wl,-rpath=$ID/zlib/${z_v}/$zlib_lib"
make
make install
cd ../../
rm -rf netcdf-${nc_v}
echo "Completed installing C NetCDF library"
[ -d $ID/netcdf/${nc_v}/lib64 ] && cdf_lib=lib64 || cdf_lib=lib

##########################
# Install NetCDF-Fortran #
##########################
tar xfz netcdf-fortran-${nf_v}.tar.gz
cd netcdf-fortran-${nf_v}
mkdir build ; cd build
../configure CPPFLAGS="-DgFortran -I$ID/zlib/${z_v}/include \
-I$ID/hdf5/${h_v}/include -I$ID/netcdf/${nc_v}/include" \
LIBS="-L$ID/zlib/${z_v}/$zlib_lib -Wl,-rpath=$ID/zlib/${z_v}/$zlib_lib \
-L$ID/hdf5/${h_v}/$hdf5_lib -Wl,-rpath=$ID/hdf5/${h_v}/$hdf5_lib \
-L$ID/netcdf/${nc_v}/$cdf_lib -Wl,-rpath=$ID/netcdf/${nc_v}/$cdf_lib \
-lnetcdf -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lz" \
--prefix=$ID/netcdf/${nc_v} --enable-static --enable-shared
make
make check 2>&1 | tee check.serial
make install
mv check.serial $ID/netcdf/${nc_v}/
cd ../../
rm -rf netcdf-fortran-${nf_v}
echo "Completed installing Fortran NetCDF library"

##########################
# Completed installation #
##########################

echo ""
echo ""
echo "##########################"
echo "# Completed installation #"
echo "#   of NetCDF package    #"
echo "#  and its dependencies  #"
echo "##########################"
echo ""
echo ""
########### END COPY ############

Run by:
mkdir install
cd install
<download the 4 files which contains the packages>
./install.sh

done. It uses regular build-utils, so you need those installed (which I
guess is standard in ubuntu).






2015-02-26 9:16 GMT+01:00 Ming Tu <tuming90@xxxxxxxxx>:

> Hi everyone,
>
> I want to use a software which depends on netCDF. My OS is Ubuntu 14.04
> LTS and gcc version is 4.9.2
>
> I first downloaded HDF and built it following
> http://www.hdfgroup.org/HDF5/release/cmakebuild.html. The commands I used
> were:
> ctest -S HDF518LinuxCMake.cmake -C Release -VV -O hdf5.log
> All tests passed.
> Then I went to HDF5-1.8/build directory and ran bash HDF5-1.8.15-Linux.sh.
> Then I had a directory HDF5-1.8.15-Linux. I copied the bin, lib, include
> and share folders to /home/ming/local.
>
> After that, I started to build netCDF. The commands were:
> export LD_LIBRARY_PATH=/home/ming/local
> export CPPFLAGS=-I/home/ming/local/include
> export LDFLAGS=-L/home/ming/local/lib
> ./configure --prefix=/home/ming/local
> But it failed, giving the error
> 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.
>
> I searched the Internet and had spent several hours on this problem. I
> still have no answer now. Hope someone could help me! I appreciate it very
> much!
>
> Ming,
>
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit:
> http://www.unidata.ucar.edu/mailing_lists/
>



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