Overzealous Caching core.a - mhightower83/Arduino-ESP8266-misc GitHub Wiki

Aggressively cache compiled core

This feature is on by default. It is a problem for any Sketch builds that use build option files that alter the built contents of core.

See ~/.arduino15/preferences.txt

compiler.cache_core=true

It is responsible for caching the compiled archive core.a on the 1ST build. And, reusing that cached copy for every subsequent Sketch built.

1ST build shows:

Archiving built core (caching) in: /tmp/arduino_cache_435098/core/core_62c943b4b5d2e650148140921e4af2c7.a

Every build after shows:

Compiling core...
Using precompiled core: /tmp/arduino_cache_435098/core/core_62c943b4b5d2e650148140921e4af2c7.a

When an item under the "Tools" pull-down menu is changed, a forced rebuild of core.a will occur. And the cached copy is updated. This sketch is now the new owner of the cached core.a. Its version is now shared with all the other sketches. This all works fine and saves a lot of time. (These are my observations there is always room for error.)

However, when you introduce build.opt into the mix, things get complicated. build.opt can contain defines that require core.a to be recompiled. When multiple Sketches are open, they can no longer reliably share one cached core.a. To use build.opt reliably you need to set compiler.cache_core=false. Then each sketch will compile its own copy of core.a. The alternative when using compiler.cache_core=true, is to close all Arduino IDE sketch windows. Start and run only one instance of the IDE, while building a Sketch that uses build.opt.

References:

⚠️ **GitHub.com Fallback** ⚠️