Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

wrf compiling/installation

nishantbehera

New member
While setting NetCDF library, running the command
./configure --prefix=$DIR/netcdf --disable-dap
--disable-netcdf-4 --disable-shared

I am getting,
configure: error: Can't find or link to the hdf5 library. Use --disable-netcdf-4, or see config.log for errors.

How to resolve this??
 
While setting NetCDF library, running the command
./configure --prefix=$DIR/netcdf --disable-dap
--disable-netcdf-4 --disable-shared

I am getting,
configure: error: Can't find or link to the hdf5 library. Use --disable-netcdf-4, or see config.log for errors.

How to resolve this??
Hello,

The error message suggests that the NetCDF library cannot find or link to the HDF5 library. To resolve this issue, you can follow these steps:

Ensure that the HDF5 library is installed on your system. You can check if it is installed by running the following command in your terminal:
hdf5-config --version

If the command returns a version number, it means HDF5 is installed. If it is not installed, you will need to install it before proceeding. Refer to the HDF5 documentation or your operating system's package manager for installation instructions. PrepaidGiftBalance

If HDF5 is installed, it is possible that the library's location is not being properly detected by the NetCDF configuration script. In this case, you can try specifying the location explicitly by adding the --with-hdf5 option to the configure command. Replace <HDF5_DIR> with the actual path to the HDF5 installation directory:
./configure --prefix=$DIR/netcdf --disable-dap --disable-netcdf-4 --disable-shared --with-hdf5=<HDF5_DIR>

For example, if HDF5 is installed in the "/usr/local/hdf5" directory, the command would be:
./configure --prefix=$DIR/netcdf --disable-dap --disable-netcdf-4 --disable-shared --with-hdf5=/usr/local/hdf5

After specifying the HDF5 location, run the ./configure command again. This should enable the NetCDF library to find and link to the HDF5 library correctly.

If the issue persists, you may want to check the config.log file mentioned in the error message for more detailed error information. It can provide insights into why the HDF5 library is not being detected properly. I hope this helps you.
 
configure: error: Can't find or link to the hdf5 library. Use --disable-netcdf-4, or see config.log for errors.
H5flush....no


Can anyone tell me what is the right procedure to install, netCDF linked with hdf5?
I have tried all the instructions and information I can find on the internet. no luck.
Anyone who has successfully done it can share their system information and configuration.

Thank you.
 
@alfred-jose
@Rosellahayes
@nishantbehera


HDF5
Code:
CC=$MPICC FC=$MPIFC F77=$MPIF77 F90=$MPIF90 CXX=$MPICXX CFLAGS=$CFLAGS ./configure --prefix=$DIR/grib2 --with-zlib=$DIR/grib2 --enable-hl --enable-fortran


NETCDF-C
Code:
CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 CFLAGS=$CFLAGS ./configure --prefix=$DIR/NETCDF --disable-dap --enable-netcdf-4 --enable-netcdf4 --enable-shared --enable-static

Code:
export LIBS="-lhdf5_hl -lhdf5 -lz -lcurl -lgfortran -lgcc -lm -ldl

NETCDF-Fortran:
Code:
    CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 CFLAGS=$CFLAGS ./configure --prefix=$DIR/NETCDF --enable-netcdf-4 --enable-netcdf4 --enable-shared --enable-static --enable-hdf5 2>&1 | tee configure.log

Code:
    export LIBS="-lnetcdf -lcurl -lhdf5_hl -lhdf5 -lz -lm -ldl -lgcc -lgfortran"
 
@alfred-jose
@Rosellahayes
@nishantbehera


HDF5
Code:
CC=$MPICC FC=$MPIFC F77=$MPIF77 F90=$MPIF90 CXX=$MPICXX CFLAGS=$CFLAGS ./configure --prefix=$DIR/grib2 --with-zlib=$DIR/grib2 --enable-hl --enable-fortran


NETCDF-C
Code:
CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 CFLAGS=$CFLAGS ./configure --prefix=$DIR/NETCDF --disable-dap --enable-netcdf-4 --enable-netcdf4 --enable-shared --enable-static

Code:
export LIBS="-lhdf5_hl -lhdf5 -lz -lcurl -lgfortran -lgcc -lm -ldl

NETCDF-Fortran:
Code:
    CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 CFLAGS=$CFLAGS ./configure --prefix=$DIR/NETCDF --enable-netcdf-4 --enable-netcdf4 --enable-shared --enable-static --enable-hdf5 2>&1 | tee configure.log

Code:
    export LIBS="-lnetcdf -lcurl -lhdf5_hl -lhdf5 -lz -lm -ldl -lgcc -lgfortran"
You have mentioned both --enable-shared --enable-static here. It can only be shared or static isnt it?
 
@alfred-jose
@Rosellahayes
@nishantbehera


HDF5
Code:
CC=$MPICC FC=$MPIFC F77=$MPIF77 F90=$MPIF90 CXX=$MPICXX CFLAGS=$CFLAGS ./configure --prefix=$DIR/grib2 --with-zlib=$DIR/grib2 --enable-hl --enable-fortran


NETCDF-C
Code:
CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 CFLAGS=$CFLAGS ./configure --prefix=$DIR/NETCDF --disable-dap --enable-netcdf-4 --enable-netcdf4 --enable-shared --enable-static

Code:
export LIBS="-lhdf5_hl -lhdf5 -lz -lcurl -lgfortran -lgcc -lm -ldl

NETCDF-Fortran:
Code:
    CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 CFLAGS=$CFLAGS ./configure --prefix=$DIR/NETCDF --enable-netcdf-4 --enable-netcdf4 --enable-shared --enable-static --enable-hdf5 2>&1 | tee configure.log

Code:
    export LIBS="-lnetcdf -lcurl -lhdf5_hl -lhdf5 -lz -lm -ldl -lgcc -lgfortran"
Thank-you so much for this reply, I will try it out and will let you know
If I'm wrong just correct me. Here in this configuration you shared zlib libpng Jasper and later hdf5 is linked to the grib2 folder.
I am using Ubuntu 20.04. focal
gcc 9.04
 
Thank-you so much for this reply, I will try it out and will let you know
If I'm wrong just correct me. Here in this configuration you shared zlib libpng Jasper and later hdf5 is linked to the grib2 folder.
I am using Ubuntu 20.04. focal
gcc 9.04
@alfred-jose Yes I put all of them into the grib2 folder and netcdf into it's own folder. But that can be changed based on your own requirements
 
I'll double check it
It worked, finally.

Combination of libraries I used:

mpich-4.1.2
zlib-1.2.11
hdf5-1.13.2
netcdf-c-4.7.2
netcdf-fortran-4.5.2
jasper-1.900.1
curl-7.83.1

System config: Ubuntu 20.04.6, gcc 9.4
Thank you so much, William. Hope to return the favor.
 
Last edited:
Top