Discussion:
monetary module build error with older glibc versions
Add Reply
Tom G. Christensen
2017-11-26 19:33:22 UTC
Reply
Permalink
Raw Message
Hello,

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>).

-tgc
Bruno Haible
2017-11-26 23:27:47 UTC
Reply
Permalink
Raw Message
Post by Tom G. Christensen
The monetary module is causing a build error on older glibc platforms
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
./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 <***@clisp.org>

strfmon_l: Fix compilation error with glibc 2.25.
Reported by Tom G. Christensen <***@jupiterrise.com>
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>. */
Tom G. Christensen
2017-11-27 20:17:18 UTC
Reply
Permalink
Raw Message
Post by Bruno Haible
strfmon_l: Fix compilation error with glibc 2.25.
in <https://lists.gnu.org/r/bug-gnulib/2017-11/msg00051.html>.
* lib/monetary.in.h: Include also <locale.h>.
Thank you.

A full gnulib snapshot can now again be built on CentOS 5 and
testresults are good, only two testsuite errors:
...
<-00>0: expected "1970-01-01 00:00:00 -0000 (-00)", got "1970-01-01
00:00:00 +0000 ()"
<-00>0: expected "1985-11-05 00:53:21 -0000 (-00)", got "1985-11-05
00:53:21 +0000 ()"
<-00>0: expected "2001-09-09 01:46:42 -0000 (-00)", got "2001-09-09
01:46:42 +0000 ()"
FAIL: test-nstrftime
...
test-strverscmp.c:52: assertion 'strverscmp (a, c) < 0' failed
FAIL: test-strverscmp
...
=======================
2 of 1137 tests failed
(20 tests were not run)
=======================


-tgc
Paul Eggert
2017-11-28 23:06:36 UTC
Reply
Permalink
Raw Message
Post by Tom G. Christensen
A full gnulib snapshot can now again be built on CentOS 5 and
Thanks, the first one is because CentOS 5 conforms only to pre-2001
POSIX, and the second one is due to a bug in glibc 2.9-and-earlier
strverscmp. I installed the attached to document both issues and to fix
the test case for the former issue. You're welcome to submit a patch for
the latter issue, though I expect it's low priority.
Tom G. Christensen
2017-11-30 07:44:02 UTC
Reply
Permalink
Raw Message
Post by Paul Eggert
Post by Tom G. Christensen
A full gnulib snapshot can now again be built on CentOS 5 and
Thanks, the first one is because CentOS 5 conforms only to pre-2001
POSIX, and the second one is due to a bug in glibc 2.9-and-earlier
strverscmp. I installed the attached to document both issues and to fix
the test case for the former issue. You're welcome to submit a patch for
the latter issue, though I expect it's low priority.
Thanks Paul.

Unfortunately test-nstrftime still fails because <unistd.h> on CentOS 5
contains:
#define _POSIX_VERSION 200112L

-tgc
Paul Eggert
2017-11-30 15:14:53 UTC
Reply
Permalink
Raw Message
Post by Tom G. Christensen
Unfortunately test-nstrftime still fails because <unistd.h> on CentOS
#define _POSIX_VERSION  200112L
Oh well. It's too much trouble to add a dynamic test and/or workaround
for this bug, so I think we'll just let that old sleeping dog lie.
Loading...