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.