NCAR / wrf_hydro_docker

Docker containers for the WRF-Hydro modeling system
https://hub.docker.com/u/wrfhydro
22 stars 24 forks source link

libnetcdf not found in wrfhydro/dev:base #151

Open sporella opened 6 months ago

sporella commented 6 months ago

Hello:

I had a functional workflow with the wrfhydro/dev:base image two years ago. I'm using the model again, but I have this error message:

error while loading shared libraries: libnetcdf.so.19: cannot open shared object file: No such file or directory

I exported the netcdf path and compile again, but now I have this error:

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

My folder is a simple test case that worked with the old version of the image. What I'm missing?

Thanks!

scrasmussen commented 5 months ago

Hi, thanks for letting us know about this, I'll take a look into this. We had to update the Dockerfile recently so this is probably from those changes. Just to double check you're using the wrfhydro/dev:base image and trying to build the current WRF-Hydro main branch? If the setup is different please let us know, thanks

sporella commented 5 months ago

Hi, thanks for your answer. My workflow uses version 5.1.1. I tested it also with version 5.2.0 and I had the same issue

scrasmussen commented 5 months ago

Hi, so I ran the newer Docker container and the issue is that the apt-get installation installs the NetCDF library in a different path than the previous method. You can use the command $ nf-config --flibs to see the command line argument to point to the library. From there you can double check the path to add the library location with ls.

docker@642d30d31452:~/wrf_hydro_nwm_public/src/Run$ ls /usr/local/lib/
libfmpich.so  libmpi.so.12.3.1  libmpicxx.la         libmpifort.la         libnetcdf.a         libnetcdf.so.19.2.2  libnetcdff.so.7
libmpi.a      libmpich.so       libmpicxx.so         libmpifort.so         libnetcdf.la        libnetcdff.a         libnetcdff.so.7.2.0
libmpi.la     libmpichcxx.so    libmpicxx.so.12      libmpifort.so.12      libnetcdf.settings  libnetcdff.la        libopa.so
libmpi.so     libmpichf90.so    libmpicxx.so.12.3.1  libmpifort.so.12.3.1  libnetcdf.so        libnetcdff.settings  pkgconfig
libmpi.so.12  libmpicxx.a       libmpifort.a         libmpl.so             libnetcdf.so.19     libnetcdff.so        python3.10

Then by adding the path to the environment variable LD_LIBRARY_PATH the runtime will know where to look to include it. The following command should work for this Docker image:

$ export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
sporella commented 5 months ago

Hi, the command above solves the issue! Thanks!