From: Andrei Tatar Date: Tue, 22 Aug 2023 13:31:11 +0000 (+0200) Subject: Makefile.uk: Add -D_GNU_SOURCE to C++ flags X-Git-Tag: RELEASE-0.15.0~2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6aa8f986d1413e97556d28a4feb557d4168d55c1;p=unikraft%2Flibs%2Flibcxx.git Makefile.uk: Add -D_GNU_SOURCE to C++ flags libcxx uses strtod_l, strtof_l & strtold_l in include/locale, which are declared in stdlib.h only if _GNU_SOURCE is defined. GCC by default sets _GNU_SOURCE when compiling C++ for this exact reason, but clang does not, leading to compilation errors. This change adds -D_GNU_SOURCE as a compilation flag to all C++ files when using libcxx. Signed-off-by: Andrei Tatar Reviewed-by: Simon Kuenzer Reviewed-by: Marco Schlumpp Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #34 --- diff --git a/Makefile.uk b/Makefile.uk index 9939c6c..9a3f1c9 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -72,6 +72,9 @@ CXXINCLUDES-$(CONFIG_LIBCXX) += -I$(LIBCXX_BASE)/include CXXINCLUDES-$(CONFIG_LIBCXX) += -I$(LIBCXX_SRC)/src CXXINCLUDES-$(CONFIG_LIBCXX) += -I$(LIBCXX_SRC)/include +# include/locale uses _GNU_SOURCE extensions from stdlib.h +CXXFLAGS-$(CONFIG_LIBCXX) += -D_GNU_SOURCE + ################################################################################ # Global flags ################################################################################