meson icon indicating copy to clipboard operation
meson copied to clipboard

Ability to disable sccache detection

Open intelfx opened this issue 3 years ago • 3 comments

This is an equivalent of #2991 but for sccache.

For original ccache, a workaround exists in form of setting CCACHE_DISABLE=1. However, for sccache no such workaround exists. In addition, Meson unconditionally prefers sccache to ccache, however:

  1. sccache is slower than ccache (much more overhead, which is noticeable on relatively slow machines);
  2. sccache is much less configurable/flexible than ccache

This behavior thus makes Meson counterproductive (and it cannot be disabled/overridden at all, short of removing sccache from PATH which is not an option on a developer's machine). There has to be a way to disable/override this behavior.

intelfx avatar Nov 30 '22 09:11 intelfx

Seems reasonable although I think your env var should be called SCCACE_DISABLE.

Although I wonder if @jpakkane has any feedback on environment variables vs using a builtin option to disable this.

tristan957 avatar Nov 30 '22 18:11 tristan957

Yes, it's a mistake in the commit message, the actual code checks ${,S}CCACHE_DISABLE.

Actually I wrote that patch and now I actually doubt that it's a good solution, that's why I didn't post it as a PR. On one hand, it allows me to set it as a system-wide env var and forget about the issue, but on the other hand it is non-discoverable and quite cumbersome to use in other contexts.

intelfx avatar Nov 30 '22 18:11 intelfx

It has the advantage at least for ccache in that it's "discoverable" in the sense that ccache itself says that it uses that variable.

I'm a bit curious though, when someone would want to disable sccache but automatically detect ccache?

eli-schwartz avatar Dec 01 '22 22:12 eli-schwartz

@eli-schwartz

I'm a bit curious though, when someone would want to disable sccache but automatically detect ccache?

Two main reasons:

  1. sccache has noticeably more overhead than ccache (this matters on relatively slow systems, where a sccache run with hot cache can sometimes be nearly as slow as if cache was not used at all)
  2. sccache is significantly less flexible/configurable than ccache, the user might want to use ccache because they have non-trivial ccache configuration that suits their needs

At the same time, the user might want to keep sccache on their system e. g. for purposes of caching Rust builds (which ccache cannot do, and where per-invocation overhead of sccache does not matter because of larger build times with Rust).

intelfx avatar Dec 31 '22 12:12 intelfx