簡體   English   中英

在GitLab CI中沒有找到ccache

[英]No hits in GitLab CI for ccache

即使源未更改且緩存已持久,ccache在GitLab CI中的緩存命中率為零。

此外,每次運行構建時,高速緩存的大小都會增加,這意味着將一遍又一遍地對其進行重建。

問題是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.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM