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 https://github.com/wrf-model/WRF/pull/803. 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.