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

Compiling WRF4.0.1 with GNU Compiler

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.


New member
I am getting an error when trying to compile WRF4.0.1 with a GNU compiler on a Debian Linux Machine.

The error appears first in line 1670 of the log_gnu.compile file:

diffwrf io_netcdf is being built now.
wrf_io.o: In function `__ext_ncd_support_routines_MOD_netcdf_err.part.0':
wrf_io.f:(.text+0x1f): undefined reference to `nf_strerror_'
wrf_io.o: In function `__ext_ncd_support_routines_MOD_gettimeindex':
wrf_io.f:(.text+0x5a82): undefined reference to `nf_put_vara_text_'
wrf_io.o: In function `ext_ncd_get_var_td_char_':
wrf_io.f:(.text+0xd275): undefined reference to `nf_inq_varid_'
wrf_io.f:(.text+0xd2c8): undefined reference to `nf_inq_var_
makefile:43: recipe for target 'diffwrf' failed
make[2]: [diffwrf] Error 1 (ignored)

The netCDF libraries should all be linked correctly. Has anyone an idea how to fix this error?


  • log_gnu.compile
    705.2 KB · Views: 63
  • configure.wrf
    19.9 KB · Views: 62
These errors typically indicate there is a problem with netCDF. It can be that netCDF was not installed properly, or that netCDF was not built with the same compiler that you are using to build WRF, or that your path is pointing to a different version of netCDF. Take a look at this page:

This is a compilation tutorial page that we put together to help WRF users to get the code compiled on their machines. It helps to ensure that your environment is set up correctly and that everything is up to date. It also helps you to install the libraries, and then to perform compatibility tests. We suggest that even if you have these libraries built already, you follow this word-for-word and rebuild them exactly as is indicated (they don’t take long), to ensure a greater chance of a successful compilation. If you are able to get through this with no errors in the tests, and then still run into trouble with the compilation, then please let us know. If you have any errors with the compatibility tests, you will need to discuss those with your systems administrator because it means there is a problem with your particular environment and/or the libraries (which we do not have the resources to support).