Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new major release of the ESP-IDF (V5) has extended the
time_t
type from 32 to 64 bits. Unfortunately, this brings the challenge how to simultaneously support older ESP-IDF releases (current stable is V4.4.2) and the V5 one with thelibc
(and Rust STD) crates.After dismissing the option to introduce 5 (or more) additional ESP-IDF targets, we settled on the introduction of a
rustc
cfg flag, as the most lightweight option:espidf_time64
:[build]
section of.config/cargo.toml
or using one of the other methods to pass flags to the Rust compiler);The good news in all that is that it is impossible for the user to set the flag to the wrong value as his/her build will simply fail. This is because compiling for the ESP-IDF framework does require a hard dependency on the
esp-idf-sys
crate, which - besides exposing autogenerated (with bindgen) APIs which are a super-set of thelibc
APIs - also does the heavy-lifting of compiling the ESP-IDF framework itself and emitting the relevant Rust linker flags and a lot of other things. So when compilingesp-idf-sys
, we are checking the compatibility of the libc'stype_t
with the bindgen-ed one insideesp-idf-sys
where the latter is the source of truth, so to say.