Error When Building the Swift Compiler for the First Time

Thanks for pasting the errors. Those definitely look familiar. Here's a slightly older thread with the same issue (thanks @dan-zheng for helping me find it!) : Is anyone else getting this error when building the compiler from `master` on macOS?

I'm going to try to see what we can do to fix the corresponding JIRA SR-12726. In the meantime, there is a workaround suggested of removing the CommandLineTools (I'd suggest moving it to a temporary directory instead of deleting in case something goes wrong :sweat_smile:).


This morning, I deleted swift-source and started from the beginning with the --release-debuginfo and --debug-swift build flags only to have what I think is the same error again.

That makes sense, since changing the flags affects the optimization/debuginfo settings, whereas the problem is more fundamental; it has something to do with headers/paths.

On a separate note, if a build fails, when I go about building it again, does it write over the failed build? Up 'til now I have just deleted the entire thing and restarted because I'm not sure even though I know that is probably not necessary (just being safe). So I guess my question is, is there anything that I need to do to either get rid of the previous build or tell it to overwrite it in the subsequent build?

There's several different things that could happen here:

  1. If you don't change the build settings, and don't use --reconfigure it will overwrite some things and not others (e.g. some configuration steps might not be re-run because the files haven't changed).
  2. If you don't change the build settings, but use --reconfigure it should I think overwrite everything (or maybe most of it), because the configuration steps will be re-run even if the underlying files haven't changed.
  3. If you change the build settings, like say using --release-debuginfo instead of --debug (but don't supply an explicit --build-dir), then it will create a fresh build directory (the build directory mangles the names of a bunch of flags). If you use the --build-dir flag, it will overwrite stuff. (This is particularly handy when bisecting issues.)

Since clean builds can take a long time, you might also want to check out how to setup caching, so in case you need to do a clean build again for some reason, most of it comes straight from the cache.

2 Likes