Repository navigation
espidf: Don't declare flock - #5660
Conversation
ESP-IDF's newlib and picolibc headers declare `flock`, but neither provides an implementation, so using it results in a linker error. An ESP-IDF maintainer confirmed this in rust-lang#4723. Exclude `flock` for ESP-IDF, as is already done for Solaris. Link: https://github.com/espressif/newlib-esp32/blob/437b547d4dcb3255e03e10d1ea0def24a6757da4/newlib/libc/include/sys/_default_fcntl.h#L221-L223 Link: https://github.com/espressif/picolibc/blob/b955d786c04a5375cee4671605a28b498bec738d/newlib/libc/include/sys/_default_fcntl.h#L221-L223 Link: rust-lang#4723 (comment) Assisted-by: LLM
5a4ed13 to
e86cb55
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Cc @ivmarkov, this is what you suggested in #4723 (comment) |
|
@tgross35 Thank you for your fast reaction! Unfortunately, the fix needs to reach Rust STD as well, or in other words, we need a Is there anything I can help with to expedite this? |
|
I added the nominated label (for future reference can be added via rustbot) but what needs to be updated in std? It can't be using |
@tgross35 |
This PR stops declaring
flockfortarget_os = "espidf".Both newlib and picolibc declare
flockinsys/_default_fcntl.h, but I couldn't find an implementation in either library or ESP-IDF. Usingflockon this target would therefore result in a linker error. ivmarkov also confirmed that ESP-IDF does not support it and suggested excluding it for this target (discussion).Fixes rust-lang/libc#4723. Emscripten and Redox will keep
flockin libc, as Ralf suggested that the symbols should remain available even though their implementations are incorrect.I've kept
flockinlibc-test/semver/unix.txt. ESP-IDF isn't built in CI, so the API list isn't checked against that target. Solaris only passes that check because it has astruct flock.Testing
Ran:
libc::flockno longer resolves on ESP-IDF.