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

macos clang implicit function error

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 recently updated my xcode tools to 12.4, and that seems to have caused cc (now at 12.0.0; clang-1200.0.32.29) to start treating implicit functions as errors instead of just warnings as before (with clang 11). For example,

reg_parse.c:229:15: error: implicitly declaring library function 'tolower' with type 'int (int)' [-Werror,-Wimplicit-function-declaration]
         x = tolower(tokens[F_DIMS][i]) ;
reg_parse.c:229:15: note: include the header <ctype.h> or explicitly provide a declaration for 'tolower'

I am compiling with ifort+clang (and also updated from Mojave to Catalina). One solution is to add a -Wno-error flag in arch/config.defaults:

#ARCH    Darwin (MACOS) intel compiler with clang EDIT FOR OPENMPI #serial smpar dmpar dm+sm
CC_TOOLS        =      cc -Wno-error=implicit-function-declaration

A heavy-handed option is to add "-w" to suppress all warnings. I don't know if there is some odd setting on my system that is causing this behavior, as I haven't found any other complaints about it. So this post is for anybody else who happens to run into this.
Thank you for the information and I'm sure it will be useful for others using these options. Out of curiosity, which version of WRF are you compiling? Thanks!
Oh, yeah, it is 4.3.1. I haven't tried others, but it doesn't seem to be specific to WRF, since there are no options set to treat that as an error instead of a warning. Maybe most Mac users are using gcc+gfortran and wouldn't see this?