Riu*_*iuo 3 continuous-integration caching build ccache gitlab
在 GitLab CI 中,ccache 的缓存命中为零,即使源没有改变并且缓存被持久化。
此外,每次构建运行时缓存的大小都会增加,这意味着它会一遍又一遍地重建。
问题是 ccache 检查编译器是否相同的默认方式 - 通过其时间戳。由于每个 GitLab CI 实例运行一个全新的 Docker 容器,这个时间戳总是不同的,因此总是构建新的缓存。
要解决此问题,请设置CCACHE_COMPILERCHECK为content而不是默认值mtime。
从 ccache 文档:
compiler_check (CCACHE_COMPILERCHECK)
By default, ccache includes the modification time (“mtime”) and size of the compiler in the hash to ensure that results retrieved from the cache are accurate. This setting can be used to select another strategy. Possible values are:
content
Hash the content of the compiler binary. This makes ccache very slightly slower compared to the mtime setting, but makes it cope better with compiler upgrades during a build bootstrapping process.
mtime
Hash the compiler’s mtime and size, which is fast. This is the default.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
641 次 |
| 最近记录: |