diff --git a/lib/url.c b/lib/url.c index 8947d8e3b95..511c0a7e20b 100644 --- a/lib/url.c +++ b/lib/url.c @@ -18,10 +18,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/* _GNU_SOURCE must stay defined for the rest of this file. On musl libc + * the feature-test macros are re-evaluated by every system header, so + * undefining it here would hide the clock_gettime()/ctime_r() prototypes + * that ut.h and dprint.h (via ) rely on, breaking the build. */ #define _GNU_SOURCE #include #include -#undef _GNU_SOURCE #include "../mem/mem.h" #include "../ut.h" diff --git a/modules/mathops/math_funcs.c b/modules/mathops/math_funcs.c index 696e6b2dad0..29a205dbc14 100644 --- a/modules/mathops/math_funcs.c +++ b/modules/mathops/math_funcs.c @@ -32,11 +32,10 @@ #include #include -#ifdef _ADDED_XOPEN -#undef _ADDED_XOPEN -#undef _XOPEN_SOURCE -#undef _GNU_SOURCE -#endif +/* The feature-test macros above must stay defined for the OpenSIPS headers + * below. musl evaluates them in every system header, so undefining them + * here leaves the translation unit with none of them set and takes ctime_r() + * out of , which dprint.h needs. */ #include #include diff --git a/modules/mathops/mathops.c b/modules/mathops/mathops.c index 461f5d32072..ec7d9c4a18e 100644 --- a/modules/mathops/mathops.c +++ b/modules/mathops/mathops.c @@ -32,11 +32,10 @@ #include #include -#ifdef _ADDED_XOPEN -#undef _ADDED_XOPEN -#undef _XOPEN_SOURCE -#undef _GNU_SOURCE -#endif +/* The feature-test macros above must stay defined for the OpenSIPS headers + * below. musl evaluates them in every system header, so undefining them + * here leaves the translation unit with none of them set and takes ctime_r() + * out of , which dprint.h needs. */ #include "../../sr_module.h" #include "../../dprint.h"