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 <andrei@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #34
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
################################################################################