Skip to content

[docs] Sccache bug has been fixed #40873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2022
Merged

Conversation

philipturner
Copy link
Contributor

In v2.15.0, the target duplication problem has supposedly been addressed. I have not verified it's actually fixed because I haven't built Swift from source yet. Here is the sequence of events surrounding the fix:


I have one question though: the commit goes to the file gcc.rs, yet (based on my limited and likely flawed understanding) Clang is often used for Swift instead of GCC. Does that mean the patch fixes builds using GCC, but Clang builds are still broken? For reference, I plan to use Xcode instead of Ninja to build the Swift compiler from source, and am still reading the beginner documentation on how to do it.

@CodaFi
Copy link
Contributor

CodaFi commented Jan 16, 2022

We are still seeing instances of this in sccache 0.2.15 with clang builds. I believe this bug is fixed on their mainline branch as building from source appears to fix the issue. We would probably need another formal release from Mozilla to remove this caveat text.

@philipturner
Copy link
Contributor Author

I just did an incremental build of the Swift compiler using Ninja and it was definitely faster the second time.

@CodaFi
Copy link
Contributor

CodaFi commented Jan 17, 2022

Try running sccache --show-stats. I have sccache 0.2.15 installed and this is what it says:

Compile requests                   5394
Compile requests executed            84
Cache hits                           84
Cache hits (C/C++)                   84
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                5310
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.002 s
Failed distributed compilations       0

Non-cacheable reasons:
multiple -arch                     5310

@philipturner
Copy link
Contributor Author

philipturner commented Jan 17, 2022

I just compiled the Swift toolchain and it took a few minutes (it was an incremental build with no changes). I ran sccache --show-stats both before and after, and this is what I got:

Compile requests                      0
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                   0
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
Cache location                  Local disk: "/Users/philipturner/Library/Caches/Mozilla.sccache"
Cache size                            3 MiB
Max cache size                       10 GiB

Next, I'll modify a source code file and see if anything pops up. I did NOT set the max cache size to 10 GiB when starting the server; I set it to 50 GiB.

@philipturner
Copy link
Contributor Author

I got the following after slightly modifying one C++ file and rebuilding:

Compile requests                      1
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                   1
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                        1

Cache location                  Local disk: "/Users/philipturner/Library/Caches/Mozilla.sccache"
Cache size                            3 MiB
Max cache size                       10 GiB

@CodaFi
Copy link
Contributor

CodaFi commented Jan 17, 2022

Non-cacheable reasons:
multiple -arch 1

So then it seems that this isn't fixed. Looks like @ahoppen got some code in to improve the situation, but it missed the tag by two months 😞

@philipturner philipturner changed the title Sccache bug has been fixed [WIP] Sccache bug has been fixed Jan 17, 2022
@ahoppen
Copy link
Member

ahoppen commented Jan 19, 2022

The sccache issue actually still exists in 0.2.15. mozilla/sccache#898 is the PR that introduced the issue and I submitted mozilla/sccache#959 to fix the issue introduced by that PR. However, sccache hasn’t release a new version since.

Regarding gcc vs. clang: I’m no sccache expert but I believe that gcc and clang have sufficiently similar compiler arguments that sccache can use the same rules to determine whether a particular compiler invocation can be cached.

@philipturner philipturner changed the title [WIP] Sccache bug has been fixed [DNM] [WIP] Sccache bug has been fixed Jan 19, 2022
@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented May 7, 2022

sccache release 0.3.0 version which include the fix PR.
https://github.com/mozilla/sccache/releases/tag/v0.3.0

@philipturner
Copy link
Contributor Author

If this is an external dependency that people download separately from the Swift compiler, then people might already be using the new Sccache with the bug fix. We need to have someone validate that the newer version is being used.

@philipturner philipturner reopened this May 7, 2022
@ahoppen
Copy link
Member

ahoppen commented May 7, 2022

I would like to hold this until sccache 0.3.0 has been published on Homebrew because I think that’s the dominant way people install sccache.

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented May 7, 2022

I would like to hold this until sccache 0.3.0 has been published on Homebrew because I think that’s the dominant way people install sccache.

Homebrew/homebrew-core#101009

@philipturner
Copy link
Contributor Author

I have set up notifications so that I’ll be pinged when that PR is merged. Then we should be able to get this reviewed.

@philipturner philipturner marked this pull request as draft May 7, 2022 10:22
@philipturner philipturner changed the title [DNM] [WIP] Sccache bug has been fixed [docs] Sccache bug has been fixed May 7, 2022
@philipturner philipturner marked this pull request as ready for review May 7, 2022 16:06
@philipturner
Copy link
Contributor Author

@CodaFi please review

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that version 0.3.0 of sccache installed via homebrew correctly caches compilation commands again.

@ahoppen
Copy link
Member

ahoppen commented May 9, 2022

@swift-ci Please smoke test

@ahoppen ahoppen self-assigned this May 9, 2022
@ahoppen ahoppen merged commit 29639f1 into swiftlang:main May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants