Using ccache for speeding up the build
- Dominant language
- Shell
- Stars
- 12.6k
- Forks
- 2.9k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 62
Description
Hi, team! I'm wondering whether is it possible or relevant to add support for using persistent `ccache` for building C++ fuzzers? It can be added both to the `/infra/helper.py` and your actions for CIFuzz. Reason - it should significantly speed up rebuilding binaries for each PR because they are not changed so often. For example in ClickHouse CI we store the internals of `ccache` directory on S3, download it before building and then upload the new version of cache back.
While I was debugging build failures here I just added a volume for cache into the container and it helped me a lot.
```
diff --git a/infra/helper.py b/infra/helper.py
index 44956668..b258cc04 100755
--- a/infra/helper.py
+++ b/infra/helper.py
@@ -703,6 +703,10 @@ def build_fuzzers_impl( # pylint: disable=too-many-arguments,too-many-locals,to
'%s:%s' % (_get_absolute_path(source_path), workdir),
]
+ command += [
+ '-v', '/tmp/ccache:/root/.ccache'
+ ]
+
command += [
'-v', f'{project_out}:/out', '-v', f'{project.work}:/work', '-t',
f'gcr.io/oss-fuzz/{project.name}'
```
Contributor guide
Research direction
Start by reading infra/helper.py around build_fuzzers_impl and then inspect the CIFuzz actions mentioned in the issue. Determine how persistent ccache storage should be provided to fuzzer builds and reused across pull requests. Done means the helper and CIFuzz actions use the cache without breaking builds and demonstrably reduce repeated compilation work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, github-actions, python
- Domain
- build-system, ci-cd
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100