Swift compiler building error after cloning the repo

Swift is regularly built successfully on stable versions of Ubuntu, as you can see from CI logs:

To replicate builds off main locally:

  1. Make sure you have everything checked out in sync with update-checkout from the main scheme. Frequently, when you keep updating only a single repository but not other repositories, they go out of sync due to breaking API changes.
  2. Make sure you have all of the dependencies installed, the exact list of dependencies for building the toolchain is available in the swift-ci directory in Dockerfiles corresponding to the distribution you're building on, for example here's one for Ubuntu 22.04 swift-docker/swift-ci/main/ubuntu/22.04/Dockerfile at main · swiftlang/swift-docker · GitHub.
  3. Make sure you have enough RAM available for the build process, some linker jobs may need 16 GB or more for large binaries.
  4. Build with the exactly same preset and exactly the same invocation of build-script as on CI. For example, on Linux the invocation that produces toolchain distributions ready for installation is this one
./swift/utils/build-script --preset buildbot_linux install_destdir=/home/build-user/swift-nightly-install installable_package=/home/build-user/swift-DEVELOPMENT-SNAPSHOT-2025-04-06-a-ubuntu2204.tar.gz'
  1. Lastly, if you have any trouble replicating the build in your environment, you can use the CI Dockerfile I linked above and build everything in a container to replicate the CI environment as closely as possible.
1 Like