The pre-compiling and caching is really convenient most of the time, but what can I do to force the IDE to compile everything again, including all libs, and core, and what have you?
As for libraries, just switch to a different board, compile, then switch back to the previous board and compile again.
The situation is more difficult with the core because the core is cached for each board so compiling for a different board doesn't clear the previously cached core. With the classic Arduino IDE, the core cache is deleted after you exit, so you could just restart the IDE but Arduino IDE 2.x doesn't clear the core cache and continues to use it the next time it is loaded. So I think your only option is to delete the cache. You can see the location in the verbose output.
I think I got into this trap of caching. An option to clear the complete cache is definitively something needed in the IDE!
What do you mean by that?
I made a change to some "core" values, and now they seem to be kept in the cache, and I can't change them back.
Am I mistaken, or is a change in Tools-->Core Debug Level also forcing a complete re-compile of the core?
That is a little bit easier to do?
In order to make all relevant information available to all who are interested in this subject, I'll share a link to the related discussion at:
Yes, but it doesn't clear the previous cache. So if you switch back to the previous setting then the cache for that FQBN is used.
So this workaround is limited both to boards that have custom board options that are trivial enough to select arbitrarily and also the number of such options.
My current "solution" on Ubuntu Linux is to delete everything
arduino-* in directory
/tmp. Inconvenient, but it is the least inconvenient.
I also ended up determining that this is the only way to clear the compilation caches.
Arduino CLI does have an
arduino-cli compile --clean flag:
--clean Optional, cleanup the build folder and do not use any cached build.
But that's only for Arduino CLI, not Arduino IDE as you are asking about.
Doesn't it make you wonder why other people also found it necessary to have such an option? No surprise, really, since all compilers have a "clean" option.
So, the function already exist. You are only trying to make it impossible to access this from the IDE, and force people to delete cached files from the file system. Why that? I guess it is a not so rare occurrence for any programmer that you think you have cornered yourself and want to restart with a clean plate.
Not even close to true. The “clean” option is typically added by the build system - make, cmake, ant, or whatever…. (Also the “caching” is not done by the compiler.)
The thing that makes the Arduino IDE special and valuable is its focus on providing a gentle learning curve. This is accomplished by a UI that doesn't overwhelm the new user with zillions of cryptic options they have no use for, yet don't know enough to know that they have no use for. This means that there must be a clear need or significant benefit for adding any additional UI component. You still have not made a compelling case for why this UI component is needed. If we added every UI component that anyone requested over the years, it would just be another Visual Studio by now. We already have Visual Studio, Eclipse, Keil, etc., so Arduino producing yet another would not offer anything of value to the world.
The situation is different when it comes to Arduino CLI. Arduino CLI is only intended to be used directly by advanced users (everyone else will use it via the IDEs or Arduino Web Editor). Although it is still important to provide an intuitive UI, we are much more free to add advanced options that will only be of interest to the advanced users it is intended for.
I hear the message: "Move elsewhere if you want a full IDE". Too bad.
Unfortunately that's the message I got too.
Ii would like to "start over" with a clean slate in Arduino-land. I've been doing Arduino things for just a few weeks, and I noticed (via the 'verbose' compilation option) that lots of my library or header files are coming from weird places like my MATLAB directories, which I never "told" Arduino about. I wanted to just start over with a clean slate, so I renamed my Arduino folder to 'OLDArduinoStuff' and then downloaded and installed a brand-new version of the IDE (1.18.16, formerly 1.18.13). But the new IDE still automatically "knows" and insists on using lots of old stuff. I gather from this Forum thread that part of the problem is related to the cache. I'd like to clear it, but where is it? Also, in verbose compilation mode, does it really tell you where the cache directory is? And if I get rid of everything, I'd even like the 'recent' program list to go away, but that's not a big problem.
I guess I'll try (again) to clear the compilation/build cache using the '--clean' flag in the Arduino CLI (as recommended by the very authoritative-soundig 'pert'), but that's tough for us newbies. Ordinarily, with nicely sanitized 'consumer' programs, if you delete the entire thing, vestiges of the old stuff don't come back to haunt you. I do agree with 'pert' that it's desirable to keep the IDE simple for us non-expert users, but there needs to be some way to get rid of old stuff that doesn't require great expertise. In the short term, is there anything simple I can do to start over other than switching to a new computer? I'm on MacOS Catalina.
I don't think that's the case for your situation. In very rare cases (note that nobody in this discussion was even able to provide an explanation for why they would need to clear the cache), the cache could result in undesirable behavior from one compilation to another in Arduino IDE 1.8.16, but it is cleared every time you close the IDE. so there's no chance a problematic state could persist across a whole new IDE installation.
Unfortunately, I don't have any experience with the MATLAB Arduino IDE integration and don't own an Arduino Engineering Kit. I know the MATLAB folks didn't use one of the standard mechanisms for interfacing with the IDE, but I don't know how it works.
One thing you should be aware of is that there are multiple folders used by the Arduino IDE. You only mention one "Arduino" folder, and I'm not sure which of them it was.
- Arduino IDE installation folder
- Sketchbook folder - location is shown in the IDE at File > Preferences > Sketchbook location
- Data folder - location is shown in the IDE at the line following File > Preferences > More preferences can be edited directly in the file
I can give a valid reason to clear the cache. Try changing the name of a header file. That one gave me fits, ended up deleting it and creating it anew.
The Arduino build system automagically recompiles when the files have changed. If it doesn't, then there is a bug in the caching system and the bug should be fixed rather than requiring the user to work around the bug by clearing the cache manually.
I agree it should of been automatic(don't get me started on "magic") and if it is a bug it should be reported. should be easy to duplicate.
So, I've had trouble getting a clean compile for a set of esp32-cam modules where the only differences in the compile is changing the SSID ID for each module. I am going to try again, but I'm pretty sure a "clean caches" would fix this. Trying to find another way and researching compiling on the command line, but Instructions I've seen don't cover ESP32 modules. Since a "clean" is a simple concept and common developer task, I think a clean caches option would be good.