From 5cde211fc8ef236764655a6811534ff1d75a9c3d Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Sat, 3 Dec 2022 00:09:24 +0900 Subject: [PATCH] [nrf noup] config: nrfconnect: Define _DEFAULT_SOURCE This commit updates the chip-module build configurations to define `_DEFAULT_SOURCE` when compiling Matter because it uses non-standard functions that are only available when `_DEFAULT_SOURCE` is defined. Note that this used to be not necessary only because of a quirk in the way Newlib handles the feature test macro, which resulted in Newlib defining `_DEFAULT_SOURCE` when compiling with `-std=gnu`. For more details, refer to the issue zephyrproject-rtos/zephyr#52739. Signed-off-by: Stephanos Ioannidis --- config/nrfconnect/chip-module/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index cef54d4bd0..0ca4a816f5 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -92,6 +92,8 @@ set(CHIP_GN_ROOT_TARGET ${CHIP_ROOT}/config/nrfconnect/chip-gn) # Prepare compiler flags +list(APPEND CHIP_CFLAGS -D_DEFAULT_SOURCE) + if (CONFIG_ARM) list(APPEND CHIP_CFLAGS_C --specs=nosys.specs @@ -309,6 +311,7 @@ add_dependencies(chip-gn kernel) zephyr_interface_library_named(chip) target_compile_definitions(chip INTERFACE CHIP_HAVE_CONFIG_H) +target_compile_definitions(chip INTERFACE _DEFAULT_SOURCE) target_include_directories(chip INTERFACE ${CHIP_ROOT}/src ${CHIP_ROOT}/src/include