From: Bruno Haible Date: Sun, 16 Sep 2018 00:25:21 +0000 (+0200) Subject: Fix link error when linking with libintl.a on macOS. X-Git-Tag: v0.20~396 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fca7d35f0995b5f7362aa7c1ee28a7c90d7918e;p=thirdparty%2Fgettext.git Fix link error when linking with libintl.a on macOS. * gettext-runtime/intl/loadmsgcat.c (_nl_msg_cat_cntr): Zero-initialize on macOS. --- diff --git a/gettext-runtime/intl/loadmsgcat.c b/gettext-runtime/intl/loadmsgcat.c index e1722627d..363001066 100644 --- a/gettext-runtime/intl/loadmsgcat.c +++ b/gettext-runtime/intl/loadmsgcat.c @@ -506,7 +506,15 @@ char *alloca (); /* We need a sign, whether a new catalog was loaded, which can be associated with all translations. This is important if the translations are cached by one of GCC's features. */ +#if defined __APPLE__ && defined __MACH__ +/* On macOS 10.13 with Apple clang-902.0.39.1 and cctools-895, when linking + statically, we need an explicit zero-initialization, in order to avoid a + link-time error that __nl_msg_cat_cntr is an undefined symbol. It could + be a compiler bug or a ranlib bug. */ +int _nl_msg_cat_cntr = 0; +#else int _nl_msg_cat_cntr; +#endif /* Expand a system dependent string segment. Return NULL if unsupported. */