[Scons-users] SCons bug when combining CacheDir and MSVC_BATCH

Mats Wichmann mats at wichmann.us
Wed May 24 10:48:56 EDT 2023


On 5/24/23 06:24, Steve Hill (Wireless) via Scons-users wrote:
> All,
> 
> We have recently switched on CacheDir in our CI machine and, while this 
> has largely been a positive experience, we have seen the odd link 
> failure that we could not explain. I was eventually able to reproduce 
> the issue and produce a minimal SConstruct that illustrates the problem.

Something's broken here.  I've tried to trace this a little bit and it 
looks like things can get removed after they're retrieved.  There are 
other oddities too, in your rebuild log:

> Retrieved `build1\main.obj' from cache
> cl /Fobuild1\\ /c src\main.c src\foo.c /nologo
> main.c
> foo.c
> Generating Code...

If there are two sources, but one object is up to date, SCons should not 
calculate a batched build is needed, in other words it should have emitted:

cl /Fobuild1\foo.o /c src\foo.c /nologo

> Would you like me to raise an issue on GitHub for this?
I'd say yes, but not being wise in the ways of MSVC_BATCH maybe there's 
something I'm missing.

Can you try a couple of tweaks to your reproducer (thanks for taking the 
time to come up with one!) while you're at things?

1) put the MSVC_BATCH initialization in the Environment call.  The msvc 
tool is notoriously sensitive to getting its initialization wrong if it 
doesn't have all its details in hand when it runs.  No idea if that 
moves the goalposts but worth trying.
2) turn on some debugging - add  --cache-debug=-   (the dash argument 
sends the debug to the console)


MSVC_BATCH has several issues already in the tracker about interaction 
with things, didn't look to me like any of them were likely this issue, 
though.


More information about the Scons-users mailing list