1

I have two identical projects with the same file

/Users/Steve/Desktop/foo/a.cpp
/Users/Steve/Desktop/bar/a.cpp

I use ccache to speedup the compilation across directory boundaries, so I defined CCACHE_BASEDIR

export CCACHE_BASEDIR=/Users/Steve/Desktop/

I compile the file with the following command:

export CCACHE_NOHASHDIR=true
export CCACHE_BASEDIR=/Users/Steve/Desktop
ccache clang++ -c /Users/Steve/Desktop/foo/a.cpp
ccache clang++ -c /Users/Steve/Desktop/bar/a.cpp

Is there any reason why the object file for bar/a.cpp doesn't get pulled from the cache?

Daniel Stephens
  • 2,371
  • 8
  • 34
  • 86
  • What is `b.cpp` and which folder is it in? How does it relate to the two `a.cpp` files? – crayzeewulf Oct 02 '18 at 04:10
  • Sorry, I fixed it. It was `a.cpp` – Daniel Stephens Oct 02 '18 at 04:14
  • 4
    Why `CCACHE_BASEDIR` in the question, but `CCACHE_DIR` in the title? Also, how are you determining that it's not pulling in the object file from the cache? Does `a.cpp` `#include` files that are next to it? If so, are they also identical? – Ken Thomases Oct 02 '18 at 04:21
  • 1
    In addition to @KenThomases's question, also check if [this](https://stackoverflow.com/a/25303281/1062948) helps (but you have set `CCACHE_NOHASHDIR`, so that might not be relevant). – crayzeewulf Oct 02 '18 at 04:24
  • Can you provide an answer to your own question (presuming it was solved)? [Self-answered questions are encouraged](https://meta.stackexchange.com/questions/17463/can-i-answer-my-own-questions-even-if-i-knew-the-answer-before-asking) (but it is a good idea anyway to leave a comment on the answer to explain it (as not all (down-)voters are aware of it). You can use the reference I provided here.). – Peter Mortensen Jan 22 '19 at 15:51
  • I didn’t solve my problem. I fixed my question – Daniel Stephens Jan 22 '19 at 15:56

0 Answers0