Keeping Build Output Consistent

One potential drawback to using a shared cache is that your build output can be inconsistent from invocation to invocation, because any given file may be rebuilt one time and retrieved from the shared cache the next time. This can make analyzing build output more difficult, especially for automated scripts that expect consistent output each time.

If, however, you use the --cache-show option, SCons will print the command line that it would have executed to build the file, even when it is retrieving the file from the shared cache. This makes the build output consistent every time the build is run:

      % scons -Q
      cc -c -o hello.o hello.c
      cc -o hello hello.o
      % scons -Q -c
      Removed hello.o
      Removed hello
      % scons -Q --cache-show
      cc -c -o hello.o hello.c
      cc -o hello hello.o
    

The trade-off, of course, is that you no longer know whether or not SCons has retrieved a derived file from cache or has rebuilt it locally.