For darwin hosts we use the env command to run a compiler in a modified environment which in turn makes ccache effectively no-op. On master (ae005a647ffa1d457c5c7a0528cb29f3b1937b96):
$ cat /etc/os-release | grep VERSION=
VERSION="22.04 (Jammy Jellyfish)"
$ ccache --version | head -1
ccache version 4.5.1
$ make -C depends HOST=x86_64-apple-darwin
$ ./autogen.sh
$ CONFIG_SITE=$PWD/depends/x86_64-apple-darwin/share/config.site ./configure
$ make clean
$ ccache --zero-stats
$ make
$ ccache --show-stats -v
Summary:
Cache directory: /home/hebasto/.cache/ccache
Primary config: /home/hebasto/.config/ccache/ccache.conf
Secondary config: /etc/ccache.conf
Stats updated: Sun Mar 20 12:33:01 2022
Hits: 0 / 0
Direct: 0 / 0
Preprocessed: 0 / 0
Misses: 0
Direct: 0
Preprocessed: 0
Uncacheable: 734
Primary storage:
Hits: 0 / 0
Misses: 0
Cache size (GB): 1.69 / 5.00 (33.87 %)
Files: 11790
Uncacheable:
Called for linking: 14
Multiple source files: 720
With this PR:
$ make -C depends HOST=x86_64-apple-darwin
$ ./autogen.sh
$ CONFIG_SITE=$PWD/depends/x86_64-apple-darwin/share/config.site ./configure
$ make clean
$ make
$ make clean
$ ccache --zero-stats
$ make
$ ccache --show-stats
Summary:
Hits: 720 / 720 (100.0 %)
Direct: 720 / 720 (100.0 %)
Preprocessed: 0 / 0
Misses: 0
Direct: 0
Preprocessed: 0
Uncacheable: 14
Primary storage:
Hits: 1440 / 1440 (100.0 %)
Misses: 0
Cache size (GB): 1.74 / 5.00 (34.80 %)
Use the -v/--verbose option for more details.
Fixes bitcoin/bitcoin#21552.
Also this PR improves efficiency of the "macOS 10.15" CI task:
master (e09cf64c48286176e7d080edfe901f47baa0a418), https://cirrus-ci.com/task/6266307669655552:

