Hi folks,
I've been trying to use ccache with the CCACHE_BASEDIR option so that my fellow
team members can take advantage of compiles that have already been done by each
other from a different directory. I'm seeing ccache do inappropriate
replacements of absolute paths with relative paths. Here is an example:
I have CCACHE_BASEDIR set to "/opt/eblau/comcol/Tcm6" and I'm trying to compile
from within a sub directory under that path. I have a directory with a bunch of
header files in "/opt/eblau/comcol/Tcm6/prod/include". When I do a build under,
for example, "/opt/eblau/comcol/Tcm6/src/core/comm/mx" I see this in the ccache
log:
[2012-06-05T11:33:20.022515 21600] Working directory:
/opt/eblau/comcol/Tcm6/src/./core/comm/mx
[2012-06-05T11:33:20.022520 21600] Base directory: /opt/eblau/comcol/Tcm6
[2012-06-05T11:33:20.022525 21600] Unify mode enabled
[2012-06-05T11:33:20.022530 21600] Direct mode disabled
[2012-06-05T11:33:20.022551 21600] -g used; disabling unify mode
[2012-06-05T11:33:20.022582 21600]
dirname=/opt/eblau/comcol/Tcm6/src/./core/comm
[2012-06-05T11:33:20.022594 21600] full
path=/opt/eblau/comcol/Tcm6/src/./core/comm/mx
[2012-06-05T11:33:20.022620 21600] Source file: MxServerLink.cxx
[2012-06-05T11:33:20.022625 21600] Object file: MxServerLink.o
[2012-06-05T11:33:20.022636 21600] Running preprocessor
[2012-06-05T11:33:20.022655 21600] Executing /usr/bin/g++ -c -fno-exceptions
-Wall -Wno-deprecated -Wno-trigraphs -Wno-strict-aliasing -march=x86-64 -g
-Dlinux -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -Wno-invalid-offsetof -D_REENTRANT
-fPIC -I. -I../../../../../prod/include -I/usr/src/LiS/include
-I/usr/lib/g++-include -I/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include -E
MxServerLink.cxx
[2012-06-05T11:33:20.022729 21601] Unlink
/opt/cache/ccache/tmp/MxServerLi.tmp.cmdev3.21600.ii (as-tmp)
[2012-06-05T11:33:20.022815 21601] Unlink
/opt/cache/ccache/tmp/tmp.cpp_stderr.cmdev3.21600 (as-tmp)
[2012-06-05T11:33:20.058076 21600] Unlink
/opt/cache/ccache/tmp/MxServerLi.tmp.cmdev3.21600.ii (as-tmp)
[2012-06-05T11:33:20.058232 21600] Unlink
/opt/cache/ccache/tmp/tmp.cpp_stderr.cmdev3.21600 (as-tmp)
[2012-06-05T11:33:20.058257 21600] Preprocessor gave exit status 1
[2012-06-05T11:33:20.058266 21600] Failed; falling back to running the real
compiler
ccache is misinterpreting the "." in the absolute path and adding on extra ".."
to the -I path in the compile, causing it to fail to find the header header
files under "/opt/eblau/comcol/Tcm6/prod/include".
The buggy code looks to be in get_relative_path() in util.c:
common_prefix_len = common_dir_prefix_length(from, to);
for (p = from + common_prefix_len; *p; p++) {
if (*p == '/') {
x_asprintf2(&result, "../%s", result);
}
}
This code is not considering if there is a "/./" in the absolute path, but is
blindly replacing this with "..". Has anyone else hit this? Would a patch be
accepted for this problem if I fixed it? Any other suggestions?
Thanks,
Eric
_______________________________________________
ccache mailing list
[email protected]
https://lists.samba.org/mailman/listinfo/ccache