scons incremental compilation does not appear to be working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By StewartNJohnston

The scons incremental compilation does not appear to be working. (building main development trunk)

When I run:

scons platform=x11

and then run the same line again it appears to rebuild everything again.

Doesn’t scons support incremental compilation? I would expect the second build to run very very fast. Is my build maybe broken?

Any suggestions would be greatly appreciated.

Thank you,

Stewart

On Windows, if I run SCons from scratch, it takes about 10 minutes to build. But the second time is a lot faster if nothing changed (about 10-20 seconds at most).
I don’t know about X11 though.

Zylann | 2018-11-01 20:13

:bust_in_silhouette: Reply From: Calinou

Incremental builds in Godot are likely less efficient than they could be, possibly because some files are including unnecessary headers (include-what-you-use could be used to optimize this).

There’s still a few other ways to speed up incremental builds: installing ccache and using gold for linking, which can be done by adding LINKFLAGS="-fuse-ld=gold" at the end of the SCons command line.

Also, since this is related to engine development, I would advise opening an issue on Godot’s GitHub repository.

:bust_in_silhouette: Reply From: RobD6

I had the same problem, and found that there were a couple of environment variables that needed to be set.

One is SCONS_CACHE, which is a directory to store the cache in. e.g.

set SCONS_CACHE=c:\dev\godot\.scons_cache

That sort of works, but there’s also a default 1GB cache size limit, which wasn’t big enough. Fix that with:

set SCONS_CACHE_LIMIT=5000

(Obviously you can set these in the environment variables in the Windows advanced system settings window instead).

Having done that, mine now builds entirely from the cache if there’s no changes.