Is anyone else getting this error when building the compiler from `master` on macOS?

When building the compiler on macOS locally (I was able to reproduce this on Catalina 10.15.4 and Mojave 10.14.6, both with Xcode 11.4.1), I started getting this error a couple of weeks ago, which only pops up when building swift/lib/Immediate/Immediate.cpp:

/Applications/Xcode-11.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:325:9: 
error: no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Applications/Xcode-11.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:326:9: 
error: no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Applications/Xcode-11.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:327:9: 
error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Applications/Xcode-11.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:328:9: 
error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode-11.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:329:9: 
error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
13 errors generated.

Interestingly enough, when building swift-5.2-branch checkout scheme instead of master the error goes away and everything builds fine.

The other factor apparently is the presence of headers in /Library/Developer/CommandLineTools/usr/include/c++, as this invocation for compiling Immediate.cpp includes this flag:

-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include

If I copy the compiler invocation from the build log, remove the flag, and run that as a single command in terminal, this succeeds. I've been able to infer that by building master on GitHub Actions, where the error doesn't occur. I compared my local and CI invocation, and the -isystem flag seems to be the only difference. I assume that GitHub Actions host don't have this Command Line Tools package installed, or somehow it isn't picked up by the compiler's build system if it's installed

The summary is, some time between swift-5.2-branch and master there was a change introduced that makes the build system detect Command Line Tools headers, which breaks the build only when those headers are installed. Apparently these headers aren't installed on CI hosts, neither swift-ci, nor GitHub Actions, that's why this wasn't detectable on CI.

For the reference, I get this info for the tools package on Catalina:

% pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 11.4.1.0.1.1586360307
volume: /
location: /
install-time: 1587060077
groups: com.apple.FindSystemFiles.pkg-group 

I hope someone else was able to reproduce this locally? I wasn't able to find anything relevant on bugs.swift.org unfortunately.

1 Like

I encountered the same errors recently!

The errors appeared for me after I installed command line tools, which I needed only temporarily. I fixed it by deleting /Library/Developer/CommandLineTools and running sudo xcode-select -s /Applications/Xcode.app (11.4). Maybe there's a more robust solution.

2 Likes

Thanks, at least I'm not alone, which means it's not my local misconfiguration. I've reported this as SR-12726.

1 Like

Unbelievable, but deleting /Library/Developer/CommandLineTools and running sudo xcode-select -s /Applications/Xcode.app for me did solve building error.

Is such surgery with deleting /Library/Developer/CommandLineTools safe for my local install?

Will this problem be somehow addressed in changing build-script?

Not particularly useful answers, but here goes:

Deleting /Library/Developer/CommandLinesTools should be relatively safe in that it is reversible - you can always reinstall it via sudo xcode-select --install fwiu.

I suppose SR-12726 tracks a robust fix for this issue in build-script. I see you're already following the issue, so you should be notified if anyone makes progress.

1 Like

Thank you for posting this! Wasted hours on wondering about this error, given the very slow build times on my old MBP.

1 Like
Terms of Service

Privacy Policy

Cookie Policy