|author||Arnout Vandecappelle <email@example.com>||2015-10-04 16:25:32 +0100|
|committer||Peter Korsgaard <firstname.lastname@example.org>||2015-10-04 18:22:21 +0200|
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) <email@example.com> Signed-off-by: Peter Korsgaard <firstname.lastname@example.org>
Diffstat (limited to 'docs/manual/ccache-support.txt')
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
@@ -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
+ccache manual's section on "Compiling in different directories"] for
+more details about this rewriting of absolute paths.