diff --git a/make/project.mk b/make/project.mk index 17f07c2cd9..034ad2a15e 100644 --- a/make/project.mk +++ b/make/project.mk @@ -427,6 +427,9 @@ ifdef CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED CPPFLAGS += -DNDEBUG endif +# IDF uses some GNU extension from libc +CPPFLAGS += -D_GNU_SOURCE + # Enable generation of debugging symbols # (we generate even in Release mode, as this has no impact on final binary size.) DEBUG_FLAGS ?= -ggdb diff --git a/tools/cmake/idf_functions.cmake b/tools/cmake/idf_functions.cmake index 104144ac13..d5b7fff1ac 100644 --- a/tools/cmake/idf_functions.cmake +++ b/tools/cmake/idf_functions.cmake @@ -107,6 +107,9 @@ function(idf_set_global_compile_options) list(APPEND c_compile_options "-std=gnu99") list(APPEND cxx_compile_options "-std=gnu++11" "-fno-rtti") + # IDF uses some GNU extension from libc + list(APPEND compile_definitions "_GNU_SOURCE") + if(CONFIG_CXX_EXCEPTIONS) list(APPEND cxx_compile_options "-fexceptions") else()