-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Investigate sccache for Travis/AppVeyor builds #38119
Comments
For Linux/Mac sccache should be pretty much a drop-in replacement. You just need to have S3 buckets configured (we configure one per AWS region that we use, so we're not making cross-region requests), have AWS credentials available on the builder, and set the environment variable It's worth trying it out on a local build first to see if anything breaks--we haven't implemented proper support for all the gcc/clang options out there, just enough to build Firefox. If you just use it locally without setting any options it'll use a local disk cache in For Windows we do a little fiddling with the compiler options because sccache doesn't currently support debug info in PDB files (hence the |
Does sccache speed build up when used over wide area network? That would be necessary for "Maybe being useful for contributors". |
We don't have data on that yet, that is somewhat blocked by the My gut feeling is that it will depend on the individual circumstances of how fast your machine can download files from S3 vs. compile them locally. If local compilation is faster than downloading then no, it would not be a win. I have plans to make sccache smarter such that it could still help in these circumstances--asking it to run as many compiles in parallel as the system can support while fetching other objects from cache in the background ought to provide a benefit except in a case where a developer has a very fast CPU and very slow network access to S3. |
Ok I've been seeing quite a few timeouts on AppVeyor/Travis all associated with compiling LLVM when they should have it cached, so I've taken renewed interest in looking into this. So far my findings are:
So far the only real blocker so far being mozilla/sccache#43. Next comes the fun with MSVC. Unlike Firefox we have to use CMake for LLVM, and that's just where the fun begins...
So my conclusion for now is that I was unable to hook together our MSVC builds and sccache. With CMake I couldn't get the Visual Studio build generator to use sccache at all, with Ninja it uses unsupported arguments, and with NMake it also uses unsupported arguments. It turns out NMake doesn't support parallelism anyway, though! My proposal for next steps would be:
I think those steps will get us to at least a workable state on Windows to the point where I can start testing on AppVeyor. Along the way, I was surprised by the handling of environment variables in sccache (which makes sense in retrospect). The server process dictates all the environment variables for all compilations, which for MSVC has big ramifications due to The Normally this should work just fine. We're only using sccache for LLVM and we're only going to build LLVM once. In theory, however, we could compile LLVM for both 32 and 64-bit Windows in one compile (e.g. configure two host targets). It looks like this wouldn't be supported with sccache, though? The second compile would fail because it'd use a compiler with the wrong env vars in theory. @luser do you have thoughts on fixing this? Perhaps sccache could ship env vars to the server and configure all processes to run with the same suite of env vars? I originally thought this'd be a caching hazard, but in retrospect I think not. On MSVC at least you've got different compilers for each target (e.g. 32/64-bit have entirely different compiler binaries) so that should be sufficient enough of a cache key for invalidation. Now I'd just be worried about getting it to work! To be clear, though, this isn't a blocker, just something I was thinking about. None of our AppVeyor builds do more than one host. |
Presumably this is because something is parsing the -showIncludes output to produce dependency files. I'm not actually sure why we refuse to cache compiles with this other than it being a little fiddly to get the output right. I filed mozilla/sccache#47 to support it.
There's no reason that sccache can't send the environment from each compiler invocation over to the server and use that for invoking the real compiler. We might have to include some relevant vars in the hash key (like |
Oh oops right I forgot to file sccache issues, but both of those sound great to me, thanks @luser! |
rustbuild: Add sccache support This commit adds support for sccache, a ccache-like compiler which works on MSVC and stores results into an S3 bucket. This also switches over all Travis and AppVeyor automation to using sccache to ensure a shared and unified cache over time which can be shared across builders. The support for sccache manifests as a new `--enable-sccache` option which instructs us to configure LLVM differently to use a 'sccache' binary instead of a 'ccache' binary. All docker images for Travis builds are updated to download Mozilla's tooltool builds of sccache onto various containers and systems. Additionally a new `rust-lang-ci-sccache` bucket is configured to hold all of our ccache goodies. --- Note that this does not currently change Windows [due to previously written up issues](#38119 (comment)). Despite that, however, I was curious to get timings for the builds on Travis to see what ranges we're working with. As a result, this is a WIP PR I'm using to gauge build times and such.
We've done this and this has landed, so closing! |
sccache is being used to great success in Firefox, and is essentially (as I understand) a
ccache
that stores the cache in S3. Our travis builds rely on ccache for speedy LLVM builds, but they're all building the same thing all the time and the cache is massively duplicated and taking up tons of space. Additionally, we can unify our "LLVM caching strategies" by using ssccache on Windows where we're doing a different caching strategy with AppVeyor.The benefits of such a transition I see are:
cc @luser
The text was updated successfully, but these errors were encountered: