cache 3.2.2 calls the compiler with a relative path if CCACHE_BASEDIR is set

Alessio Massaro <[email protected]> Fri, 22 May 2015 15:10:15 +0100
Newsgroups gmane.comp.compilers.ccache
Message-ID <CAL_VXbbyw-JD+DXBCj8xPXeFXzqDkEMtu1B0PhpvtX-7zNMEDQ@mail.gmail.com>
Hi All

I've attached a little reproducer for the following problem.

If CCACHE_BASEDIR is set, under certain conditions ccache will invoke
the compiler with a relativized path to the source file. This breaks
certain mechanisms I have in the code that rely on __FILE__ being an
absolute path.

I use CMake to build, which always uses absolute paths when invoking
the compiler (unless you ask it to "try" not to)

Am I doing something wrong? Is there a workaround to the problem?

Thank you very much in advance for any light you can shed on this!

-alessio

Here's how to reproduce the problem:

export CCACHE_DIR=/tmp/ccache_testexport CCACHE_UMASK=002export
CCACHE_BASEDIR=/path/to/reproducer_CCACHE_BASEDIR/code


/path/to/reproducer_CCACHE_BASEDIR/build $
/tp64/ccache/3.2.2/bin/ccache /usr/bin/c++ -o main.cpp.o -c
/path/to/reproducer_CCACHE_BASEDIR/code/main.cpp/path/to/reproducer_CCACHE_BASEDIR/build
$   /tp64/ccache/3.2.2/bin/ccache /usr/bin/c++ main.cpp.o  -o
test__FILE__ -rdynamic/path/to/reproducer_CCACHE_BASEDIR/build $
./test__FILE____FILE__ = ../code/main.cpp

_______________________________________________
ccache mailing list
[email protected]
https://lists.samba.org/mailman/listinfo/ccache
reproducer_CCACHE_BASEDIR.zip (application/zip, 1.7 KB) - not displayed