We have an iOS project that, when built with XCode 12.5, will error with something similar the following:
Module file '/Users/revolt/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/J3JDK8UPXZ4K/Foundation-39SXNSRMYWPGZ.pcm' is out of date and needs to be rebuilt: signature mismatch
This does not happen on the first build, but after the cache has been generated and can be 'solved' by deleting the DerivedData folder.
This is a bug in XCode. It doesn't appear to happen in the XCode 13 beta, at the time of writing. Workaround is to "...disable the global module index by adding -fno-modules-global-index to OTHER_CFLAGS.".