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 error compilation

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 all.

I'm trying to compile WRF with GNU. I have seen several recent topics with compilation errors, but I can not find the solution for my case.

With Intel I can compile without problem, and about 4 months ago I compiled on another machine with GNU and without problem, now I am unable to do it.

Attached in the mail the configure.wrf and the compile.log



  • compile.log
    749.4 KB · Views: 50
  • configure.wrf.log
    21.3 KB · Views: 47
The recent modifications to the WRF code includes an effort to make the Fortran more compliant to the standard. Part of the standardization is removing some extensions that tried to detect NaN values. There is an IEEE intrinsic module (described in the 2003 standard) that has a large number of functions, and one of those detects NaN values.

The problem is that once we made this modification, the standard GNU compiler version on a number of Linux platforms is not new enough to support the usage of the IEEE_arithmetic capability. It is fairly easy for users to upgrade the GNU compiler (for example, GNU 7). However, once that is done, there are a few locations inside of WRF and WPS that utilize the "USE association" technique to bring in module data (such as for MPI or NETCDF). These libraries (and importantly, the module files associated with the compiled Fortran files) were built with the original GNU compiler on the machine. At compile time, the GNU compiler identifies the module files from MPI or NETCDF as being built with a different version of the compiler, and stops.

There are two solutions:
1. Rebuild the impacted libraries. For WRF, this would be NETCDF and your particular MPI choice.
2. For WRF, there is a set of modifications that replaces the modern Fortran way of bringing symbols into a subroutine with the old style (for example, "use mpi" is sort of replaced by "include mpif.h"). I have found that I can build and run WRF with a new compiler (GNU 7) and still use the NETCDF and MPI libs built with the older GNU compiler. Take a look at This PR uses release-v4.1 as the base branch, so the changes should go into your version of the WRF code without much trouble. Note that this will not address the WPS build, if you are also having troubles with WPS.
Thank you very much, great answer!

I understood perfectly what happens, in my case I think it will be easier to update the compiler and recompile the libraries.