Error building toolchain (unknown option --color-diagnostics)

When I run:

./swift/utils/build-toolchain

I'm getting an error reported a few other times. Here's the complete contents of CMakeError.log:

Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Performing C++ SOURCE FILE Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS failed with the following output:
Change Dir: /Users/archisgore/go/src/github.com/polyverse-security/polymorphing-swift-builder/build/buildbot_osx/swift-macosx-x86_64/CMakeFiles/CMakeTmp

Run Build Command(s):/Users/archisgore/go/src/github.com/polyverse-security/polymorphing-swift-builder/build/buildbot_osx/ninja-build/ninja cmTC_7d32b && [1/2][ 50%][0.029s] Building CXX object CMakeFiles/cmTC_7d32b.dir/src.cxx.o
[2/2][100%][0.048s] Linking CXX executable cmTC_7d32b
FAILED: cmTC_7d32b 
: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-class-memaccess -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -DLINKER_SUPPORTS_COLOR_DIAGNOSTICS -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/openssl@1.1/lib -Wl,--color-diagnostics CMakeFiles/cmTC_7d32b.dir/src.cxx.o  -o cmTC_7d32b   && :
ld: unknown option: --color-diagnostics
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test CXX_SUPPORTS_WE4062 failed with the following output:
Change Dir: /Users/archisgore/go/src/github.com/polyverse-security/polymorphing-swift-builder/build/buildbot_osx/swift-macosx-x86_64/CMakeFiles/CMakeTmp

Run Build Command(s):/Users/archisgore/go/src/github.com/polyverse-security/polymorphing-swift-builder/build/buildbot_osx/ninja-build/ninja cmTC_74fcc && [1/2][ 50%][0.016s] Building CXX object CMakeFiles/cmTC_74fcc.dir/src.cxx.o
FAILED: CMakeFiles/cmTC_74fcc.dir/src.cxx.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++    -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-class-memaccess -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -Werror=switch -DCXX_SUPPORTS_WE4062 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk   /we4062 -o CMakeFiles/cmTC_74fcc.dir/src.cxx.o -c src.cxx
clang: error: no such file or directory: '/we4062'
ninja: build stopped: subcommand failed.


Source file was:
int main() { return 0; }

What's confusing is the first line which seems to want the GCC assembler:

Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)"

But it seems to build the toolchain along with all the SDKs, it needs the XCode build toolchain (sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer)

I'm a bit confused here. I'm literally just following exactly what I read in the README.md.

Never mind. I fixed it. I had to synchronize all repos to the release tag of the build I was making.

update-checkout --tag

Hi, I encountered exactly the same problem. Could you be more specific that how you solved this error? I tried update-checkout but it didn't work. Thank you very much!!

Same problem, when building swift-5.1.2-RELEASE