[Nexthop] Support building with sccache #593
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
sccachein Docker image--extra-cmake-definesargument todocker-build.pyso the callercan pass
CMAKE_C_COMPILER_LAUNCHERetc. to the build.Motivation
Building FBOSS requires significant resources, the translation units are huge, often taking 1-4G of RAM, sometimes 6-8G, and linking requirements are even more onerous. On a machine with AMD EPYC 9655P (96 cores, 192 threads), in a VM using only 64 cores and 512GB of RAM, the FBOSS builds takes about 22min, but using
sccacheand with the cache warm from a previous build, build time can be as low as 2min with a 100% cache hit rate.Test Plan
Building with
--extra-cmake-defines {"CMAKE_C_COMPILER_LAUNCHER":"sccache","CMAKE_CXX_COMPILER_LAUNCHER":"sccache"}works. By default the build process is unchanged. This PR allows injectingsccacheor other similar tool into the build.