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

Unable to install WRF on a fresh install and up-to-date Debian 12 system

pdemelo

New member
I am following the tutorial at Compiling WRF step-by-step.

However, WRF still fails to install, with the error below:

Code:
/usr/bin/ld: /wrf/Build_WRF/LIBRARIES/netcdf/lib/libnetcdff.a(nf_nc4.o): in function `nf_def_var_chunking_':
nf_nc4.f90:(.text+0x5fee): undefined reference to `nc_def_var_chunking_ints'
/usr/bin/ld: /wrf/Build_WRF/LIBRARIES/netcdf/lib/libnetcdff.a(nf_nc4.o): in function `nf_inq_var_chunking_':
nf_nc4.f90:(.text+0x6325): undefined reference to `nc_inq_var_chunking_ints'
/usr/bin/ld: /wrf/Build_WRF/LIBRARIES/netcdf/lib/libnetcdff.a(nf_nc4.o): in function `nf_set_chunk_cache_':
nf_nc4.f90:(.text+0x6d8f): undefined reference to `nc_set_chunk_cache_ints'
/usr/bin/ld: /wrf/Build_WRF/LIBRARIES/netcdf/lib/libnetcdff.a(nf_nc4.o): in function `nf_get_chunk_cache_':
nf_nc4.f90:(.text+0x6dc8): undefined reference to `nc_get_chunk_cache_ints'
/usr/bin/ld: /wrf/Build_WRF/LIBRARIES/netcdf/lib/libnetcdff.a(nf_nc4.o): in function `nf_set_var_chunk_cache_':
nf_nc4.f90:(.text+0x6e5c): undefined reference to `nc_set_var_chunk_cache_ints'
/usr/bin/ld: /wrf/Build_WRF/LIBRARIES/netcdf/lib/libnetcdff.a(nf_nc4.o): in function `nf_get_var_chunk_cache_':
nf_nc4.f90:(.text+0x6eb7): undefined reference to `nc_get_var_chunk_cache_ints'
collect2: error: ld returned 1 exit status
make[1]: [Makefile:29: em_ideal] Error 1 (ignored)

There doesn't seem to be any other errors on the steps prior to installing WRF itself.

From a web search, it seems that this is a problem with HDF5 (Cannot find nc_set_var_chunk_cache_ints & nc_def_var_chunking_ints · Issue #2096 · Unidata/netcdf-c), which is supported by

Code:
Will use NETCDF in dir: /wrf/Build_WRF/LIBRARIES/netcdf
HDF5 not set in environment. Will configure WRF for use without.
PHDF5 not set in environment. Will configure WRF for use without.

but I am unsure about how to proceed.

I have written a couple scripts to take care of all the dependencies automatically.
The script I used to install the dependencies is install-wrf-deps-debian.sh, and its execution log is install-wrf-deps-debian.log
The script I used to test the installed libraries is test-libraries-wrf-debian.sh, and its execution log is test-libraries-wrf-debian.log
The script I used to configure and install WRF itself is install-wrf-debian.sh, and its execution log is install-wrf-debian.log

Some details about my system:

root@localhost:/# uname -a
Linux localhost 6.1.0-17-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.69-1 (2023-12-30) x86_64 GNU/Linux

root@localhost:/# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 9.3.0-22' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-qDpJlL/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
gcc version 9.3.0 (Debian 9.3.0-22)

root@localhost:/# gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 9.3.0-22' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-qDpJlL/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
gcc version 9.3.0 (Debian 9.3.0-22)
 

Attachments

  • test-libraries-wrf-debian.log
    577 bytes · Views: 1
  • install-wrf-deps-debian.log
    1,008.6 KB · Views: 0
  • install-wrf-debian.log
    922.1 KB · Views: 0
  • install-wrf-deps-debian.sh.txt
    5.3 KB · Views: 1
  • install-wrf-debian.sh.txt
    2 KB · Views: 1
  • test-libraries-wrf-debian.sh.txt
    2.1 KB · Views: 0
Okay, I figured it out.

The problem was likely with the flags suggested by the official tutorial to compile WRF, and HDF5 has to be compiled before NETCDF. Also, LD_LIBRARY_PATH was not correctly including $DIR/netcdf/lib.

I updated my script to compile everything with GCC 11 (apt is still providing it) and the latest release of NETCDF-C and NETCDF-Fortran.

I'm attaching the files here in case anyone wants to check them as a reference.
 

Attachments

  • install-all-one-go.log
    3 MB · Views: 14
  • install-all-one-go.sh.txt
    10.8 KB · Views: 34
Dear pdemelo;
Thank you for providing the installation script. For clarity, in your .sh file, these two lines do not match for MPICH:

$ ./configure --prefix=$DIR
$ export PATH="$DIR/mpich/bin:$PATH"

The prefix path for MPICH in the configure line is $DIR, but in the export PATH line, it is written as $DIR/mpich/bin. Could you please confirm which one is better?
 
Top