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

Error in compiling em_real (WRF-3.8.1)

Dasol Kim

New member
Hi all,
I'm trying to compile em_real with WRF-3.8.1.
I already built the libraries - zlib-1.2.7, hdf5-1.8.9, netcdf-4.1.3, libpng-1.5.12, and jasper-1.900.1.
Also, I enabled netcdf-4 option.

However, these error messages are given to me.
-> In function ' nc4..... ': undefined reference to 'H5.....'
So I guess I should fix error from hdf5 and netcdf-4, but I don't know where I should fix them.

Here are the attatchments.
Please, I need your help.
Thank you.
 

Attachments

  • log_compile.txt
    438.8 KB · Views: 5
  • configure_wrf.txt
    23.2 KB · Views: 4
  • bashrc.txt
    1.6 KB · Views: 4
I can take a look at this for you.

Is there a specific reason you are using v3.8.1?
 
Yes, all of our lab members are using that version of WRF.
Okay that's understandable

Can you enter this command in the terminal.

env | sort

It looks like the location of hdf5 is not in the ld library path or path variable.

The env | sort command will lost all the variables and exports in the bash profile so that will help me see if it is in the proper path
 
Okay that's understandable

Can you enter this command in the terminal.

env | sort

It looks like the location of hdf5 is not in the ld library path or path variable.

The env | sort command will lost all the variables and exports in the bash profile so that will help me see if it is in the proper path
Do you need the only part of LD_LIBRARY_PATH and PATH variable?
Then
LD_LIBRARY_PATH=/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/mic/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/ipp/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mkl/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64/gcc4.7:/opt/intel/debugger_2017/iga/lib:/opt/intel/debugger_2017/libipt/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/daal/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/mic/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/ipp/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mkl/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64/gcc4.7:/opt/intel/debugger_2017/iga/lib:/opt/intel/debugger_2017/libipt/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/daal/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/mic/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/ipp/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mkl/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64/gcc4.7:/opt/intel/debugger_2017/iga/lib:/opt/intel/debugger_2017/libipt/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/daal/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/daal/../tbb/lib/intel64_lin/gcc4.4:/home/dasol/Build_WRF/LIBRARIES/zlib/lib:/home/dasol/Build_WRF/LIBRARIES/libpng/lib:/home/dasol/Build_WRF/LIBRARIES/jasper/lib:/home/dasol/Build_WRF/LIBRARIES/udunits/lib:/home/dasol/Build_WRF/LIBRARIES/hdf5/lib:/home/dasol/Build_WRF/LIBRARIES/netcdf/lib:/home/dasol/Build_CMAQ/ioapi-3.1/Linux2_x86_64ifort:/home/dasol/Build_WRF/LIBRARIES/zlib/lib:/home/dasol/Build_WRF/LIBRARIES/libpng/lib:/home/dasol/Build_WRF/LIBRARIES/jasper/lib:/home/dasol/Build_WRF/LIBRARIES/udunits/lib:/home/dasol/Build_WRF/LIBRARIES/hdf5/lib:/home/dasol/Build_WRF/LIBRARIES/netcdf/lib:/home/dasol/Build_CMAQ/ioapi-3.1/Linux2_x86_64ifort:/home/dasol/Build_WRF/LIBRARIES/zlib/lib:/home/dasol/Build_WRF/LIBRARIES/libpng/lib:/home/dasol/Build_WRF/LIBRARIES/jasper/lib:/home/dasol/Build_WRF/LIBRARIES/udunits/lib:/home/dasol/Build_WRF/LIBRARIES/hdf5/lib:/home/dasol/Build_WRF/LIBRARIES/netcdf/lib:/home/dasol/Build_CMAQ/ioapi-3.1/Linux2_x86_64ifort

And
PATH=/opt/intel/compilers_and_libraries_2017.8.262/linux/bin/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/bin:/opt/intel/debugger_2017/gdb/intel64_mic/bin:/opt/intel/compilers_and_libraries_2017.8.262/linux/bin/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/bin:/opt/intel/debugger_2017/gdb/intel64_mic/bin:/opt/intel/compilers_and_libraries_2017.8.262/linux/bin/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/bin:/opt/intel/debugger_2017/gdb/intel64_mic/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/dasol/Build_WRF/LIBRARIES/libpng/bin:/home/dasol/Build_WRF/LIBRARIES/jasper/bin:/home/dasol/Build_WRF/LIBRARIES/udunits/bin:/home/dasol/Build_WRF/LIBRARIES/hdf5/bin:/home/dasol/Build_WRF/LIBRARIES/netcdf/bin:/home/dasol/.local/bin:/home/dasol/bin:/home/dasol/Build_WRF/LIBRARIES/libpng/bin:/home/dasol/Build_WRF/LIBRARIES/jasper/bin:/home/dasol/Build_WRF/LIBRARIES/udunits/bin:/home/dasol/Build_WRF/LIBRARIES/hdf5/bin:/home/dasol/Build_WRF/LIBRARIES/netcdf/bin:/home/dasol/Build_WRF/LIBRARIES/libpng/bin:/home/dasol/Build_WRF/LIBRARIES/jasper/bin:/home/dasol/Build_WRF/LIBRARIES/udunits/bin:/home/dasol/Build_WRF/LIBRARIES/hdf5/bin:/home/dasol/Build_WRF/LIBRARIES/netcdf/bin
 
Do you need the only part of LD_LIBRARY_PATH and PATH variable?
Then
LD_LIBRARY_PATH=/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/mic/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/ipp/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mkl/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64/gcc4.7:/opt/intel/debugger_2017/iga/lib:/opt/intel/debugger_2017/libipt/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/daal/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/mic/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/ipp/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mkl/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64/gcc4.7:/opt/intel/debugger_2017/iga/lib:/opt/intel/debugger_2017/libipt/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/daal/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/mic/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/ipp/lib/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/mkl/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/tbb/lib/intel64/gcc4.7:/opt/intel/debugger_2017/iga/lib:/opt/intel/debugger_2017/libipt/intel64/lib:/opt/intel/compilers_and_libraries_2017.8.262/linux/daal/lib/intel64_lin:/opt/intel/compilers_and_libraries_2017.8.262/linux/daal/../tbb/lib/intel64_lin/gcc4.4:/home/dasol/Build_WRF/LIBRARIES/zlib/lib:/home/dasol/Build_WRF/LIBRARIES/libpng/lib:/home/dasol/Build_WRF/LIBRARIES/jasper/lib:/home/dasol/Build_WRF/LIBRARIES/udunits/lib:/home/dasol/Build_WRF/LIBRARIES/hdf5/lib:/home/dasol/Build_WRF/LIBRARIES/netcdf/lib:/home/dasol/Build_CMAQ/ioapi-3.1/Linux2_x86_64ifort:/home/dasol/Build_WRF/LIBRARIES/zlib/lib:/home/dasol/Build_WRF/LIBRARIES/libpng/lib:/home/dasol/Build_WRF/LIBRARIES/jasper/lib:/home/dasol/Build_WRF/LIBRARIES/udunits/lib:/home/dasol/Build_WRF/LIBRARIES/hdf5/lib:/home/dasol/Build_WRF/LIBRARIES/netcdf/lib:/home/dasol/Build_CMAQ/ioapi-3.1/Linux2_x86_64ifort:/home/dasol/Build_WRF/LIBRARIES/zlib/lib:/home/dasol/Build_WRF/LIBRARIES/libpng/lib:/home/dasol/Build_WRF/LIBRARIES/jasper/lib:/home/dasol/Build_WRF/LIBRARIES/udunits/lib:/home/dasol/Build_WRF/LIBRARIES/hdf5/lib:/home/dasol/Build_WRF/LIBRARIES/netcdf/lib:/home/dasol/Build_CMAQ/ioapi-3.1/Linux2_x86_64ifort

And
PATH=/opt/intel/compilers_and_libraries_2017.8.262/linux/bin/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/bin:/opt/intel/debugger_2017/gdb/intel64_mic/bin:/opt/intel/compilers_and_libraries_2017.8.262/linux/bin/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/bin:/opt/intel/debugger_2017/gdb/intel64_mic/bin:/opt/intel/compilers_and_libraries_2017.8.262/linux/bin/intel64:/opt/intel/compilers_and_libraries_2017.8.262/linux/mpi/intel64/bin:/opt/intel/debugger_2017/gdb/intel64_mic/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/dasol/Build_WRF/LIBRARIES/libpng/bin:/home/dasol/Build_WRF/LIBRARIES/jasper/bin:/home/dasol/Build_WRF/LIBRARIES/udunits/bin:/home/dasol/Build_WRF/LIBRARIES/hdf5/bin:/home/dasol/Build_WRF/LIBRARIES/netcdf/bin:/home/dasol/.local/bin:/home/dasol/bin:/home/dasol/Build_WRF/LIBRARIES/libpng/bin:/home/dasol/Build_WRF/LIBRARIES/jasper/bin:/home/dasol/Build_WRF/LIBRARIES/udunits/bin:/home/dasol/Build_WRF/LIBRARIES/hdf5/bin:/home/dasol/Build_WRF/LIBRARIES/netcdf/bin:/home/dasol/Build_WRF/LIBRARIES/libpng/bin:/home/dasol/Build_WRF/LIBRARIES/jasper/bin:/home/dasol/Build_WRF/LIBRARIES/udunits/bin:/home/dasol/Build_WRF/LIBRARIES/hdf5/bin:/home/dasol/Build_WRF/LIBRARIES/netcdf/bin
Okay so the hdf5 library is built and linked properly in the path and ld_library_path. So that isn't the error I thought it was.
Let me try to dive deeper into the compile commands and see what I can find.
 
@Dasol Kim

So in the log_compile I see a lot of this type of error:

/home/dasol/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libnetcdf4_la-nc4file.o): In function `NC4_create':
/home/dasol/Build_WRF/Downloads/netcdf-4.1.3/libsrc4/nc4file.c:350: undefined reference to `H5Eset_auto1'
/home/dasol/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libnetcdf4_la-nc4file.o): In function `nc4_create_file':
/home/dasol/Build_WRF/Downloads/netcdf-4.1.3/libsrc4/nc4file.c:210: undefined reference to `H5check_version'
/home/dasol/Build_WRF/Downloads/netcdf-4.1.3/libsrc4/nc4file.c:210: undefined reference to `H5check_version'
/home/dasol/Build_WRF/Downloads/netcdf-4.1.3/libsrc4/nc4file.c:316: undefined reference to `H5Fclose'
/home/dasol/Build_WRF/Downloads/netcdf-4.1.3/libsrc4/nc4file.c:233: undefined reference to `H5open'
/home/dasol/Build_WRF/Downloads/netcdf-4.1.3/libsrc4/nc4file.c:233: undefined reference to `H5P_CLS_FILE_ACCESS_g'

This error typically occurs when there are missing or unresolved references to functions from the HDF5 library (libhdf5). The HDF5 library is a dependency of the NetCDF library, and these undefined references indicate that the linker cannot find the necessary functions from the HDF5 library.

So what was the order that you built the libraries? Was hdf5 built before or after netcdf?

where these linkers add to the netcdf build:

Code:
-lhdf5_hl -lhdf5
 
@Dasol Kim

So in the log_compile I see a lot of this type of error:



This error typically occurs when there are missing or unresolved references to functions from the HDF5 library (libhdf5). The HDF5 library is a dependency of the NetCDF library, and these undefined references indicate that the linker cannot find the necessary functions from the HDF5 library.

So what was the order that you built the libraries? Was hdf5 built before or after netcdf?

where these linkers add to the netcdf build:

Code:
-lhdf5_hl -lhdf5
Thank you for your help.
I did install hdf5 first.
Also, I added '--with-hdf5=$DIR/hdf5' when I configured netcdf.
Is something else necessary to add here?
 
@Dasol Kim

Given I don't have the exact system that you have I can't tailor my commands that I use to install WRF EXACTLY to your system but I can share what I have and see if that helps you. Note I am using the newer versions of NETCDF-C and NETCDF-Fortran so they are separate files but hopefully these commands can help you. If not message me directly though here and I can find out more about your system.

Bash:
    cd $WRF_FOLDER/Downloads
    tar -xzvf v4.9.2.tar.gz
    cd netcdf-c-4.9.2/
    export CPPFLAGS=-I$DIR/grib2/include
    export LDFLAGS=-L$DIR/grib2/lib
    export LIBS="-lhdf5_hl -lhdf5 -lz -lcurl -lgfortran -lgcc -lm -ldl -lpnetcdf"
    autoreconf -i -f 2>&1 | tee autoreconf.log

    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 --enable-pnetcdf --enable-cdf5 --enable-parallel-tests 2>&1 | tee configure.log
    automake -a -f 2>&1 | tee automake.log
    make -j $CPU_HALF_EVEN 2>&1 | tee make.log
    make -j $CPU_HALF_EVEN install 2>&1 | tee make.install.log
    #make check

    export PATH=$DIR/NETCDF/bin:$PATH
    export NETCDF=$DIR/NETCDF
    echo " "
    ##############################NetCDF fortran library############################
    cd $WRF_FOLDER/Downloads
    tar -xvzf v4.6.0.tar.gz
    cd netcdf-fortran-4.6.0/
    export LD_LIBRARY_PATH=$DIR/NETCDF/lib:$LD_LIBRARY_PATH
    export CPPFLAGS="-I$DIR/NETCDF/include -I$DIR/grib2/include"
    export LDFLAGS="-L$DIR/NETCDF/lib -L$DIR/grib2/lib"
    export LIBS="-lnetcdf -lpnetcdf -lcurl -lhdf5_hl -lhdf5 -lz -lm -ldl -lgcc -lgfortran"
    autoreconf -i -f 2>&1 | tee autoreconf.log

    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-parallel-tests --enable-hdf5 2>&1 | tee configure.log
    automake -a -f 2>&1 | tee automake.log
    make -j $CPU_HALF_EVEN 2>&1 | tee make.log
    make -j $CPU_HALF_EVEN install 2>&1 | tee make.install.log
    #make check

    echo " "
 
Top