You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Local.md
+9-13
Original file line number
Diff line number
Diff line change
@@ -10,27 +10,25 @@ The local storage only supports a single sccache server at a time. Multiple conc
10
10
11
11
This is inspired by [ccache's direct mode](https://ccache.dev/manual/3.7.9.html#_the_direct_mode) and works roughly the same.
12
12
13
-
It can be set with by setting the variable:
14
-
```
15
-
SCCACHE_DIRECT=true
16
-
```
13
+
[preprocessor cache] mode is controlled by a configuration option which is true by default, as well as additional conditions described below.
17
14
18
-
In preprocessor cache mode, sccache caches the preprocessor step for C/C++ whenever possible. This can make the compilation a lot faster, since the preprocessor accounts for a non-negligible amount of time in the entire compile chain.
15
+
In preprocessor cache mode, sccache caches the preprocessor step for C/C++ whenever possible. This can make the compilation much faster, since the preprocessor step takes a non-negligible amount of the entire compile time.
19
16
20
-
In order to cache the preprocessor stepsccache needs to remember, among other things, all files included by the given input file. To quote ccache's documentation:
17
+
In order to cache the preprocessor step, [sccache] needs to remember, among other things, all files included by a given input file. To quote ccache's documentation:
21
18
22
-
> There is a catch with the [preprocessor cache] mode: header files that were used by the compiler are recorded, but header files that were not used, but would have been used if they existed, are not. So, when [sccache] checks if a result can be taken from the cache, it currently can’t check if the existence of a new header file should invalidate the result. In practice, the [preprocessor cache] mode is safe to use in the absolute majority of cases.
19
+
> There is a catch with the [preprocessor cache] mode: header files that were used by the compiler are recorded, but header files that were not used, but would have been used if they existed, are not. So, when [sccache] checks if a result can be taken from the cache, it currently can’t check if the existence of a new header file should invalidate the result. In practice, the [preprocessor cache] mode is safe to use in the vast majority of cases.
23
20
24
21
Preprocessor cache mode will be disabled if any of the following holds:
25
22
26
-
- the configuration setting `use_preprocessor_cache_mode` is false
27
-
- a modification time of one of the include files is too new (needed to avoid a race condition)
28
-
- a compiler option not supported by the preprocessor cache mode is used. Currently, this is only `-Xpreprocessor` and `-Wp,*`, but if/when sccache grows to handle options then more could be added to this list.
23
+
- the configuration option is false
24
+
- not using GCC or Clang with local storage (only implemented for these)
25
+
- the modification time of one of the include files is too new (this avoids a race condition)
26
+
- a compiler option not supported by [preprocessor cache] mode is used; this is usually because the compilation has inputs or outputs which [sccache] does not model well enough
29
27
- the string `__TIME__` is present in the source code
30
28
31
29
Configuration options and their default values:
32
30
33
-
-`use_preprocessor_cache_mode`: `true`. Whether to use preprocessor cache mode entirely.
31
+
-`use_preprocessor_cache_mode`: `true`. Whether to use [preprocessor cache] mode. This can be overridden for an sccache invocation by setting the environment variable `SCCACHE_DIRECT` to `true`/`on`/`1` or `false`/`off`/`0`).
34
32
-`file_stat_matches`: `false`. If false, only compare header files by hashing their contents. If true, will use size + ctime + mtime to check whether a file has changed. See other flags below for more control over this behavior.
35
33
-`use_ctime_for_stat`: `true`. If true, uses the ctime (file status change on UNIX, creation time on Windows) to check that a file has/hasn't changed. Can be useful to disable when backdating modification times in a controlled manner.
36
34
@@ -42,8 +40,6 @@ Configuration options and their default values:
42
40
43
41
See where to write the config in [the configuration doc](Configuration.md).
44
42
45
-
*Note that preprocessor caching is currently only implemented for GCC and Clang and when using local storage.*
46
-
47
43
## Read-only cache mode
48
44
49
45
By default, the local cache operates in read/write mode. The `SCCACHE_LOCAL_RW_MODE` environment variable can be set to `READ_ONLY` (or `READ_WRITE`) to modify this behavior.
0 commit comments