Can’t build libswiftDispatch.so

That's good, that means swift-frontend is unlikely to be the issue as we originally suspected.

Likely the latter, I have not previously looked into exactly which process launches the swift-frontend process, swiftc or swift-driver, but it probably is the latter. Given the early swift-driver flakiness you already reported, it is probably the point of failure. Unfortunately, that is currently tough to debug, as the verbose output does not list the swift-driver invocation it is using.

Try this: run the exact swiftc command spit out by CMake but add the flags -v -disallow-use-new-driver. That invokes the legacy Driver written in C++, so if that works, you know where the problem is.

You can then avoid the early swift-driver altogether by passing --skip-early-swift-driver to build-script, after deleting the one you already built, rm /swift/swift-project/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift-driver.