diff options
author | Arnout Vandecappelle <arnout@mind.be> | 2015-10-04 16:25:32 +0100 |
---|---|---|
committer | Peter Korsgaard <peter@korsgaard.com> | 2015-10-04 18:22:21 +0200 |
commit | 1e97b2787331c5f4452d8c9a76961a89ec355d9d (patch) | |
tree | 3650a31a1a9b2fa3b9955823839057fa7b91ac89 /docs/manual/ccache-support.txt | |
parent | f4682cf933a3e0e1017aa8827a8c57fdd79e30f3 (diff) | |
download | buildroot-1e97b2787331c5f4452d8c9a76961a89ec355d9d.tar.gz buildroot-1e97b2787331c5f4452d8c9a76961a89ec355d9d.zip |
ccache: support changing the output directory
When building in a different output directory than the original build,
there will currently be a lot of ccache misses because in many cases
there is some -I/... absolute path in the compilation. Ccache has an
option CCACHE_BASEDIR to substitute absolute paths with relative paths,
so they wil be the same in the hash (and in the output).
Since there are some disadvantages to this path rewriting, it is made
optional as BR2_CCACHE_USE_BASEDIR. It defaults to y because the
usefulness of ccache is severely reduced without this option.
In addition to CCACHE_BASEDIR, we also substitute away the occurences
of $(HOST_DIR) in the calculation of the compiler hash. This is done
regardless of the setting of BR2_CCACHE_USE_BASEDIR because it's
quite harmless.
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'docs/manual/ccache-support.txt')
-rw-r--r-- | docs/manual/ccache-support.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/manual/ccache-support.txt b/docs/manual/ccache-support.txt index 992471dbf7..f6746ad7d8 100644 --- a/docs/manual/ccache-support.txt +++ b/docs/manual/ccache-support.txt @@ -33,3 +33,23 @@ make CCACHE_OPTIONS="--max-size=5G" ccache-options # zero statistics counters make CCACHE_OPTIONS="--zero-stats" ccache-options ----------------- + ++ccache+ makes a hash of the source files and of the compiler options. +If a compiler option is different, the cached object file will not be +used. Many compiler options, however, contain an absolute path to the +staging directory. Because of this, building in a different output +directory would lead to many cache misses. + +To avoid this issue, buildroot has the +Use relative paths+ option +(+BR2_CCACHE_USE_BASEDIR+). This will rewrite all absolute paths that +point inside the output directory into relative paths. Thus, changing +the output directory no longer leads to cache misses. + +A disadvantage of the relative paths is that they also end up to be +relative paths in the object file. Therefore, for example, the debugger +will no longer find the file, unless you cd to the output directory +first. + +See https://ccache.samba.org/manual.html#_compiling_in_different_directories[the +ccache manual's section on "Compiling in different directories"] for +more details about this rewriting of absolute paths. |