LibcOverlayShims.h compile failure

When attempting to compile my app, I’m getting an error from the SDK itself:

Code Block language
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "LibcOverlayShims.h"
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/shims/LibcOverlayShims.h:66:10: error: use of undeclared identifier 'errno'
  return errno;
         ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "LibcOverlayShims.h"
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/shims/LibcOverlayShims.h:70:3: error: use of undeclared identifier 'errno'
  errno = value;
  ^
<unknown>:0: error: could not build Objective-C module 'SwiftOverlayShims'

It almost seems like errno.h isn’t included, but I can see that it is on line 33 of that file. I’ve tried the usual derived data delete, product clean, reinstall Xcode, reboot. I’ve tried stripping parts out of the app to try to see what’s causing it, but haven’t gotten very far.

Edit: An archive of the app appears to trigger it. Running in debug mode is perfectly fine, then I archive and it breaks it. Trying to run from debug again fails. Making random changes to the project file, then running a git reset --hard then allows debug to work again until I try to archive. It seems like something is wrong with the release settings that then carries over into subsequent debug builds (even with a clean)

Accepted Reply

I ended up figuring this out months later. Our software ships with this folder /usr/local/opt/company_name that contains a few libraries, software packages, etc. Our Swift code links with a number of them, so it was easiest to set Xcode to recursively search that directory for both headers and libraries rather than individually specifying them.

For some rather painful reasons, a copy of python is actually shipped in that folder. Well turns out some header file in that python directory was making Xcode very unhappy and triggering that compiler error. I manually specified the libraries we needed to link against and problem solved.

Replies

I ended up figuring this out months later. Our software ships with this folder /usr/local/opt/company_name that contains a few libraries, software packages, etc. Our Swift code links with a number of them, so it was easiest to set Xcode to recursively search that directory for both headers and libraries rather than individually specifying them.

For some rather painful reasons, a copy of python is actually shipped in that folder. Well turns out some header file in that python directory was making Xcode very unhappy and triggering that compiler error. I manually specified the libraries we needed to link against and problem solved.