-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Don't rebuild core.a when not needed #2003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't rebuild core.a when not needed #2003
Conversation
Completely agree with this. When doing other things, like sorting programmers or board definitions, it just slows things down - couple of minutes for a build - even for an empty sketch, then 2 seconds for the test. |
Not sure what you by the last part - The IDE already lets the compiler generate .d files with dependencies and only compiles a source file if it or its dependencies change? |
Open project, verify, then do upload. It does a rebuild (compiling sketch). Similarly, upload, then without doing anything else, do upload again results in the same. If the IDE knows that no source files have been changed, why even call the compiler at all ?. |
After you open the IDE, a full compile is expected - the compiler keeps the object files in a temporary directory, which gets cleaned up when the IDE quits. However, within a single IDE session, it shouldn't recompile everything. Just tested this (with verify, not upload, I don't have an Arduino attached right now) and indeed, the first verify compiles everything. The second one compiles just the sketch itself, and re-assembles the core.a file (which is fixed by this pullrequest). If things are different for you, perhaps you can put the (verbose) output of the first and second run up at e.g. http://pastebin.com? |
OK, with a bit more detail then ..
|
@tchilton, thanks for the additional detail.
|
(Something that just occured to me - is you system clock set correctly? Was it perhaps set to a (far) future time in the past?) |
d4a4e6e
to
a470e1d
Compare
Before, the ar command was just ran for all .o files that should end up in core.a, which should replace any old code in core.a. However, it seems that in the unlikely event that functions or entire source files are deleted, they might linger in the core.a file.
This prevents a half-finished core.a file from lingering around. Currently, this should not make a difference since core.a is rebuilt every time, but this prepares for skipping this build step if possible.
a470e1d
to
48f0fe6
Compare
I just rebased this PR to current ide-1.5.x |
If I select the Arduino Due board the second build fails with:
with the latest 1.5.x instead (without the improvement for core.a) the output of the second run is;
Not sure what's happening here... still investigating... |
Ah, I think the variant file is compiled only after it decided not to build core.a, and the variant file was moved out of core.a recently (I had some conflicts with that change). Hold on - I'll fix right away. |
Before, core.a would be rebuilt on every build, even when none of the core .o files changed. Now, the timestamps are checked against the timestamp on core.a first, skipping the build if nothing changed. Because this uses the current list of .o files, there is a corner case when a source file is deleted, but no other source file is modified. In that case, core.a is not rebuilt, even though it should be. However, this is such a narrow and unrealistic case, that it should pose a real problem. This fixes part of arduino#1991
48f0fe6
to
b783392
Compare
Fixed by moving the variant compilation up a bit . |
Great, thanks! |
hey, it seems that ArduinoBot is really happy :-) |
As pointed out in #1991, the core.a file was always rebuilt, even when nothing about it changed. This fixes that by only rebuilding it when needed. Note that the .o files for the core were already reused, this concerns just the .a file.