Skip to content

Commit 57a1c65

Browse files
committed
fix(libsodium): disable C11 Annex K declarations to fix build with picolibc
Upstream libsodium's utils.c defines __STDC_WANT_LIB_EXT1__=1, which requests C11 Annex K bounds-checking types (errno_t, rsize_t) from the C library. With ESP-IDF v6.0+ (which uses picolibc instead of newlib), this can cause build failures when sys/_types.h is transitively included by other component headers before utils.c sets the macro. The include guard in sys/_types.h prevents re-inclusion, so the conditional Annex K type definitions (__errno_t, __rsize_t) are never reached. Set __STDC_WANT_LIB_EXT1__=0 as a compile definition so the flag is applied before any header is processed, avoiding the issue regardless of include order. This is safe because libsodium does not use any Annex K functions on ESP-IDF.
1 parent 0d74ee3 commit 57a1c65

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

libsodium/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ target_compile_definitions(${COMPONENT_LIB} PRIVATE
139139
HAVE_WEAK_SYMBOLS
140140
__STDC_LIMIT_MACROS
141141
__STDC_CONSTANT_MACROS
142+
__STDC_WANT_LIB_EXT1__=0
142143
)
143144

144145
# patch around warnings in third-party files

0 commit comments

Comments
 (0)