Hi,
Does IDE 2.x have a force re-compile/build/verify option?
(I am looking for 'everything' to be recompiled irrespective of any lack of changes.) Many thanks.
I have never seen that option. If a file needed recompilation and didn't, that would be a bug, so if that is happening, then report it; otherwise, it is not needed.
There is no functionality implemented in IDE 2.x to do a clean build.
You can however clear the cache. On Windows you will find it in C:\Users\yourUsername\AppData\Local\arduino, I have no idea where it is in other operating systems.
@sonofcy, there are bugs. E.g. see Previous file persists in build folder after renaming non-`.ino` sketch code file · Issue #1240 · arduino/arduino-cli · GitHub (and I think a few more).
You can see the location of the cache if you have the preferences set to show verbose output during compile. The compiler will show multiple lines staring with "Using previously compiled file: " followed by the file location, which will be in the cache folder for that particular sketch.
Would be nice to have a "clear caches" option somewhere, so that you don't end up consuming a huge amount of disk space saving cached files for code you compiled month ago.
You can change the file name using the "save as" option to drop cached information. I anyway tag a version number onto the end of the file name so I'd simply increment the version number for a clean start.
Right
I did forget anout that ![]()
If not mistaken there is a request somewhere on github.
It should get deleted after 30 days; never tested it. The settings are in arduino-cli.yaml
build_cache:
compilations_before_purge: 10
ttl: 720h0m0s
Thanks all
The need is that I want to go through documentation for the libraries that were utilised. For that I need the IDE to spoon-feed me definitely which libraries were used/resolved-through during compilation. I don't have the experience to be able to even begin to usefully infer or reason which libraries/include paths were probably referred to in which order of #icnlude or #include_next's, and that includes piecing it together from the '-iwithprefixesbefore' paths that are visible in the verbose outptut.
Can I just delete 'literally' everything in that folder, and it will be sufficient to force recompiling of not just the sketeches, but also the non sketch libraries which were in turn included? (cuase it is actually the non sketch libraries that I am interested in. For example in this case I wan't to find out what was included to resolve an #include_next <time.h> within the ESP32 time.h that is first resolved to in the sketch I am building.
Looks like it.
Looks like its not, there will be other cpp.o files in other folders like arduino15 that are used. There is quite a lot to trawl through by the looks of things.
As a beginner, and an extremely rusty user of C/C++ (I couldn't call myself a coder/devloper/programmer in) I do have to say that some kind of a thorough combination of 'clean' options would be very useful to help prevent me having to second guess my understanding, because my understanding is not much use as of yet.
When you can't assume much about either the sate you might be in, or if there might even 'not' be a path out of that state, there is a lot to be said for being able to hit the reset button.
That said I'm far too much of a beginner to be able to post a [suggestion], so it's going to stay just a thought.
Especially for a "beginner friendly" platform like Arduino, the problem with having an explicit "clean" option is that it will become part of the "magic incantation" to diagnose/fix issues; and it will be suggested when it won't matter, wasting time and wearing SSDs for no benefit, almost every time.
Noting the content of a cache directory, there are subdirectories, ending with /
$ ls -1p /tmp/arduino/sketches/9199B5D73C2699C222BFB3E43C52B8DA
build_opt.h
build.options.json
compile_commands.json
core/
file_opts
includes.cache
libraries/
libraries.cache
partitions.csv
sdkconfig
sketch/
sketch_jul13a.ino.bin
sketch_jul13a.ino.bootloader.bin
sketch_jul13a.ino.elf
sketch_jul13a.ino.map
sketch_jul13a.ino.merged.bin
sketch_jul13a.ino.partitions.bin
for the sketch itself, the libraries, and the core in use. You can correlate those with the verbose compiler output. However
$ ls -1p /tmp/arduino/sketches/9199B5D73C2699C222BFB3E43C52B8DA/*/
/tmp/arduino/sketches/9199B5D73C2699C222BFB3E43C52B8DA/core/:
/tmp/arduino/sketches/9199B5D73C2699C222BFB3E43C52B8DA/libraries/:
Network/
WiFi/
/tmp/arduino/sketches/9199B5D73C2699C222BFB3E43C52B8DA/sketch/:
sketch_jul13a.ino.cpp
sketch_jul13a.ino.cpp.d
sketch_jul13a.ino.cpp.o
The core is not there. A closer look at the compiler output
Compiling core...
/usr/bin/env bash -c "echo -DARDUINO_CORE_BUILD > '/tmp/arduino/sketches/9199B5D73C2699C222BFB3E43C52B8DA/file_opts'"
Using precompiled core: /tmp/arduino/cores/399caf11cfd615765611244e607ffb04/core.a
They're elsewhere
$ ls /tmp/arduino/cores/*/
/tmp/arduino/cores/399caf11cfd615765611244e607ffb04/:
core.a
/tmp/arduino/cores/e3ca6f3e2a6a901ebaa5d6be0fea9e32/:
In fact
$ ls -1p /tmp/arduino
cores/
sketches/
So nuking both cache directories will force a clean compile.
For any additional discussion on that subject please use @orthogonaleety's previous topic:
Discussion in this topic must be confined exclusively to discussion about forcing a full recompile.
@orthogonaleety it is fine to create separate topics for discussions of distinct subject matter, but you must be careful not to cause them to converge into parallel discussions.
The reason is that generating multiple forum topics on the same subject matter can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Thanks in advance for your cooperation.
Arduino IDE does not cache anything in that location. If you see object or archive files there, they were installed as part of the Arduino boards platform or toolchain.
Providing precompiled files may be done for the purpose of efficiency; so that the user never needs to wait for a large component to be compiled from source.
It is also done sometimes when the source code is proprietary. This usually occurs in the case of manufacturer-provided "drivers" for chips. The manufacturer must provide such things in order to make it possible for people to use their chip, so that they will buy the product, but they want to keep the chip's interface a secret (I guess because the information could be useful to competitors?) so they can't provide source code.
Thank you for your advice. I will keep all spin off conversations under the same topic.
I am used to a more of a Jira approach where deliverables are separated out, but there is no way of linking for context here if it comes up as it did very early on in this thread.
Like I say, I'll keep spin off conversations under the same thread, its easy enough to comply with.
Thanks pert
As I said, it is perfectly fine to create separate forum topics for distinct subjects, just as you would create a separate Jira issue for each distinct task.
You did just that with your two topics:
- One on the subject of finding information about the library dependencies of a sketch
- One on the subject of forcing a full recompile
However, unlike Jira, Arduino forum is a discussion platform. In cases where you create separate topics for distinct aspects of a project or goal, even if you start out with a clean separation between the two, the discussion has a tendency to converge into significant overlap over time. You must be vigilant to avoid that, just as you would be vigilant to avoid creating duplicate Jira issues.
You were not vigilant here. Your reply in post #8 pushed this discussion into significant overlap with the discussion in Understanding libraries RE C vs C++ vs Arduino vs Cores.
There absolutely is a way. Just post the link.