Build failure on Apple MacBook Pro with Apple M1 Chip

I had some problems compiling Swift Toolchains on macbook pro Apple M1 Chip, compiling swift-5.5.1-RELEASE, and here are the commands I executed:

git clone swift
cd swift
utils/update-checkout --clone-with-ssh
utils/update-checkout --tag swift-5.5.1-RELEASE
./utils/build-toolchain com.demo

Then,I got the next error message:

Undefined symbols for architecture arm64:
  "___isPlatformVersionAtLeast", referenced from:
      swift::initializeProtocolLookup() in ImageInspectionMachO.cpp.o
      swift::initializeProtocolConformanceLookup() in ImageInspectionMachO.cpp.o
      swift::initializeTypeMetadataRecordLookup() in ImageInspectionMachO.cpp.o
      swift::initializeDynamicReplacementLookup() in ImageInspectionMachO.cpp.o
ld: symbol(s) not found for architecture arm64
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

My iTerm doesn't have to tick "Open with Rosetta"

Here are some other stats that may be useful to know:

macOS 12.0.1
cmake 3.21.4
python 3.10.0
ninja 1.10.2
sccache 0.2.15

Thanks for the help

Ping, having the same issue.

Disabling dynamic swift stdlib helps bypass the issue partially, but this seems merely a hack to me