I keep different versions of one project in different directories. (This does make sense in this project. Sadly.) As there are only minor differences between the versions, I hope I can speed all builds after the first one by using a common cache directory for all builds.
Unfortunately I had to realise that, when building an object file from the same sources in different directories, SCons 2.3.3 stores the result on different locations in the cache. (The location is equal to the build signature, I assume.) The same sources are recompiled for each and every directory. So why does SCons determine different build signatures although
- the compile commands are identical and
- the sources and the include files are the same (identical output of of the preprocessor phase,
gcc -E ...) - I'm using the decider "MD5-timestamp"
Even the resulting object files are identical!
For a trivial example (helloworld from the SCons documentation) re-using the cache works. Though in the big project I'm working on, it does not. Maybe the "SCons build environment" influences the build signature, even if it does not have any effect on the compile command?
Are there any debug options that could help besides --cache-debug=-? Which method of SCons determines the build signature?
The folders look somewhat like this:
<basedir1>/
SConstruct
src/something.cpp …
include/header.hpp …
<basedir2>/
SConstruct
src/something.cpp …
include/header.hpp …
/SharedCache/
0/ 1/ 2/ … F/
I check out the project in both basedir1 and basedir2 and call scons --build-cache-dir=/SharedCache in both of them. (EDIT: --build-cache-dir is a custom option, implemented in the SConstruct file of this project. It maps to env.CacheDir('/SharedCache').
EDIT2: Before I realized this problem, I did some tests to evaluate the effects of using --cache-implicit or SCons 2.4.0.
g++ -o <target>.o -c -m64 -I<global_include_path> -fmessage-length=0 -D_LARGEFILE64_SOURCE … -fno-strict-aliasing -Wall -Werror -Wsign-promo … -DXOC_FILE_ID=\"ProtocolUnitTester:ate_ext_td_ProtocolFrameworkTests_generated.cpp\" -fPIC -Iinclude -Iinclude-uda -I. <src>.cpp. - hagello--build-cache-dirdoesn't exist in SCons, neither in v2.3.5 nor in the latest trunk. When I specify the cache dir explicitly in each SConstruct, things work as expected. Based on the infos and examples you've given so far, I'm not able to reproduce the problem on my side... - dirkbaechle