Tom G. Christensen wrote:
> The monetary module is causing a build error on older glibc platforms 
> (e.g. CentOS 5):
> 
> depbase=`echo strfmon_l.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
>          gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" 
> -DNO_XMALLOC -DEXEEXT=\"\" -I. -I..  -DGNULIB_STRICT_CHECKING=1 
> -fvisibility=hidden -g -
> O2 -MT strfmon_l.o -MD -MP -MF $depbase.Tpo -c -o strfmon_l.o 
> strfmon_l.c &&\
>          mv -f $depbase.Tpo $depbase.Po
> In file included from strfmon_l.c:20:
> ./monetary.h:530: error: expected declaration specifiers or '...' before 
> 'locale_t'
> ./monetary.h:530: error: format string argument not a string type
> ./monetary.h:530: error: nonnull argument with out-of-range operand 
> number (argument 1, operand 4)
> strfmon_l.c:32: error: conflicting types for 'rpl_strfmon_l'
> ./monetary.h:530: error: previous declaration of 'rpl_strfmon_l' was here
> make[4]: *** [strfmon_l.o] Error 1
> 
> 
> The issue seems to be that in older glibc versions locale_t is defined 
> in <locale.h> instead of <xlocale.h> (which gets pulled in via 
> <monetary.h>).

Thanks for the report. Fixed as follows:


2017-11-26  Bruno Haible  <[email protected]>

        strfmon_l: Fix compilation error with glibc 2.25.
        Reported by Tom G. Christensen <[email protected]>
        in <https://lists.gnu.org/r/bug-gnulib/2017-11/msg00051.html>.
        * lib/monetary.in.h: Include also <locale.h>.

diff --git a/lib/monetary.in.h b/lib/monetary.in.h
index 52966c4..945f1ae 100644
--- a/lib/monetary.in.h
+++ b/lib/monetary.in.h
@@ -29,9 +29,13 @@
 #ifndef _@GUARD_PREFIX@_MONETARY_H
 #define _@GUARD_PREFIX@_MONETARY_H
 
-#if @GNULIB_STRFMON_L@ && @HAVE_XLOCALE_H@
+#if @GNULIB_STRFMON_L@
+# if @HAVE_XLOCALE_H@
 /* Get locale_t on Mac OS X 10.12.  */
-# include <xlocale.h>
+#  include <xlocale.h>
+# endif
+/* Get locale_t on glibc 2.25.  */
+# include <locale.h>
 #endif
 
 /* Like in <stdio.h>.  */


Reply via email to