Swift build is failing when using Xcode

I'm trying to build the Swift project on my machine. I'm using the Xcode option and I've followed the instructions on GettingStarted.md.

I've also faced the problems in the following posts:

Configurations of my machine

  • A MacBook Pro (Apple m1 pro chip)
  • MacOS Monterey (12.2.1)
  • Xcode 13.2.1
  • cmake version 3.22.3
  • Python 3.8.9
  • Ninja 1.10.2
  • sccache 0.2.13

Command with options

utils/build-script --skip-build-benchmarks \        
  --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
  --sccache --release-debuginfo --swift-disable-dead-stripping --test \
  --xcode --skip-test-cmark --bootstrapping=off

Output

The log is pretty big and I wasn't able to create a public gist with the whole output (Github wouldn't create it). Here I'm posting the final parts of it.

From what I understood, it is not able to find the headers of some of the libraries. The errors happen during the test phase.

Ninja

I was able to build the project with Ninja. What is the development flow when using this option? I would like to inspect the standard library. I like the user experience that Xcode offers (that's why I was trying to build it using Xcode).

I felt the exact same way when I started with compiler development. But ultimately, Ninja is much more ergonomic and robust than Xcode for this kind of thing. I use Xcode for editing individual source files (by double-clicking them in Finder), but not as the full-fledged IDE with .xcodeproj files. Your best bet may be to learn Ninja despite the learning curve.

I have talked with an expert who manages to use Xcode for debugging the compiler, so it's not entirely impossible.

2 Likes

Many folks (including myself) use VS Code for editing. Here’s a relevant thread: Improving `GettingStarted.md` - #3 by filip-sakel

1 Like