Skip to content

Commit 69d1feb

Browse files
committedAug 28, 2023
8315060: Out of tree incremental build fails with ccache
Reviewed-by: kbarrett, dholmes
1 parent 8e2a533 commit 69d1feb

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed
 

‎make/autoconf/build-performance.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,11 @@ AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
243243
fi
244244
fi
245245
246+
# The CCACHE_BASEDIR needs to end with '/' as ccache will otherwise think
247+
# directories next to it, that have the base dir name as a prefix, are sub
248+
# directories of CCACHE_BASEDIR.
246249
CCACHE="CCACHE_COMPRESS=1 $SET_CCACHE_DIR \
247-
CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS CCACHE_BASEDIR=$TOPDIR $CCACHE"
250+
CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS CCACHE_BASEDIR=$WORKSPACE_ROOT/ $CCACHE"
248251
249252
if test "x$SET_CCACHE_DIR" != x; then
250253
mkdir -p $CCACHE_DIR > /dev/null 2>&1

‎make/common/NativeCompilation.gmk

+5-2
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,12 @@ endif
224224
# object files while CCACHE_BASEDIR will make ccache relativize all paths for
225225
# its compiler. The compiler then produces relative dependency files.
226226
# make does not know a relative and absolute filename is the same so it will
227-
# ignore such dependencies.
227+
# ignore such dependencies. This only applies when the OUTPUTDIR is inside
228+
# the WORKSPACE_ROOT.
228229
ifneq ($(CCACHE), )
229-
REWRITE_PATHS_RELATIVE = true
230+
ifneq ($(filter $(WORKSPACE_ROOT)/%, $(OUTPUTDIR)), )
231+
REWRITE_PATHS_RELATIVE = true
232+
endif
230233
endif
231234

232235
ifeq ($(REWRITE_PATHS_RELATIVE), true)

0 commit comments

Comments
 (0)
Please sign in to comment.