How to use sccache with the build script

I've been building Swift using the instructions from swift/GettingStarted.md at main · apple/swift · GitHub. When I tried to execute the following (from the actual build section):

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

and see how sccache is doing with sccache --show-stats. It seems that sccache isn't caching:

Compile requests                    625
Compile requests executed             0
Cache hits                            0
Cache misses                          0
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                 625
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average cache read miss           0.000 s
Average cache read hit            0.000 s
Failed distributed compilations       0

Non-cacheable reasons:
multiple -arch                      625

Cache location                  Local disk: "<path to Library>/Caches/Mozilla.sccache"
Cache size                            0 bytes
Max cache size                       10 GiB

It seems that sccache isn't caching the compilation.

Is this expected? Is there a flag(s) that I can use on the build script to ensure sccache? Am I just misinterpreting the output?

I've been using sccache 0.2.15` if that helps.

I did not go back to check this, but when i tried sccache a while ago, it was not able to read a lot of the compilation lines because it thought that there were multiple output files. Sccache was misunderstanding one of the compilation flags as adding another output file if i remember it correctly. It was a problem in sccache at least as i understood it. I might be misremembering, like i said i did not recheck this before writing this.

Can you check the logs of the sccache server process and see if it’s rejecting because it thinks there are multiple output files?

This is a recent issue with newer versions of sccache, you can see [docs] Add warning that sccache isn't caching any commands since version 0.13.4 by ahoppen · Pull Request #35777 · apple/swift · GitHub for some details but the solution is to install 2.13 or earlier for now.

1 Like
Terms of Service

Privacy Policy

Cookie Policy