-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Unnecessary build of library file #1991
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
Comments
Do you mean for every start of the Arduino IDE, or for every build? I know that between runs of the Arduino IDE, everything is rebuilt normally (because builds normally happen in a temporary directory - you can set the Within a single run of the IDE, the IDE should only rebuild the files that are actually changed. However, it could be that the generation of the .a file from the .o files happens unconditionally? I remember something like this. As for caching with a tag, the (1.5) IDE currently writes the build options used into the build directory, so it can do a force rebuild when any build options change (it's a bit pessimistic here, though). Also, it isn't currently smart to keep multiple sets of cached builds - but frankly I don't think that a complete build takes so long that you'd want to cache multiple copies, but YMMV. |
Below is a typical sequence when rebuilding without any changes. The "avr-ar rcs core.a xxx.o" command is repeated for all the object files even though none of them are recompiled. The build should not create a new "core.a" in this case. There is no change and it is just a waste of time. |
I would like to suggest the following.
|
Ah, indeed, the .a file is apparently rebuilt every time. I noticed that as well at some point, we should definately fix that (I might have a look at this later. If you want to look, I think it's in the Compiler.java file). As for your extended proposal - to keep a compiled core library per-board cached. It sounds like a solid proposal, but I'm not so sure we should want this. It would require significant changes to the current architecture to keep these cached copies around (currently the build products are stored in a temporary directory). Also, deciding when to remove the cache is a complex problem. What's you're usecase for this? Do you think the recompile is too much when you switch from one project to another? Or are you compiling one project/sketch for multiple boards and quickly switching between them? Or something else? |
My 2 cents Best regards |
I am considering delivering re-built core libraries for the boards supported by Cosa with the release. I would also modify the IDE build so that it uses the libraries and does not compile the core source code at all. This removed a lot of build time and the scale of Cosa does not become an obstacle. A short comment on @jantje remark. The number of board variants has actually not changed in the IDE. It is only the menu structure to handle the options/variants of the same board. The clean up is only a problem if you allow users to "tinkle" in the core source code library. AND this should never happen if they are not core developers. Best regards, Mikael |
@mikaelpatel, right, so the incentive for this is the bigger size of Cosa. As I said, I don't think that the build time for the Arduino core is enough motivation for a feature like this, but if Cosa takes a lot longer to compiler, I can imagine you'd want to cache that. Perhaps this is something to discuss on the dev mailling list? The changes needed to support something like you suggest are fairly invasive, so I think the list might be a better place for this. You'll also want to get the opinion of the Arduino dev team, since they'll have the final word (I'm just an interested contributor). |
I have already solved this for Cosa build using traditional makefiles. It is a question about improving the Arduino IDE to scale for larger projects with more files. They could be files in an improved Arduino core with more support out if the box as needed for the new boards or files from libraries. Anyway it seems like I need to discuss what industry quality software and build is all about first. I will close this and move the discussion to the dev mailing list. Thanks for your effort and comments. |
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
For each build the core library is created. This seems unnecessary especially if there is only a minor change to a sketch.
Improvements could be:
Cheers!
The text was updated successfully, but these errors were encountered: