[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in GNULIB wchar.h?
From: |
Erik Benada |
Subject: |
Bug in GNULIB wchar.h? |
Date: |
Fri, 28 Mar 2008 19:53:34 -0700 (PDT) |
Hi,
I'm trying to cross compile packges that use GNULIB - findutils, gettext - for
arm-linux-uclibc target. They all fail with similar error (this is from
findutils-4.4.0):
arm-linux-uclibc-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../..
-I../../intl -Os -pipe -MT mbscasestr.o -MD -MP -MF $depbase.Tpo -c -o
mbscasestr.o mbscasestr.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from mbscasestr.c:29:
mbuiter.h:112: error: expected specifier-qualifier-list before 'mbstate_t'
mbuiter.h: In function 'mbuiter_multi_next':
mbuiter.h:126: error: 'struct mbuiter_multi' has no member named 'next_done'
mbuiter.h:131: error: 'struct mbuiter_multi' has no member named 'cur'
mbuiter.h:136: error: 'struct mbuiter_multi' has no member named 'cur'
mbuiter.h:137: error: 'struct mbuiter_multi' has no member named 'cur'
mbuiter.h:137: error: 'struct mbuiter_multi' has no member named 'cur'
mbuiter.h:138: error: 'struct mbuiter_multi' has no member named 'cur'
It seems that mbstate_t is not declared. Uclibc was built with wchar support
and I have wchar.h. However, looking at wchar.h, it seems that wchar.h has to
be included twice to have mbstate_t declared:
1. with __need_mbstate_t defined, __mbstate_t is declared. However, since
_WCHAR_H is undefined (because of __need_mbstate_t), mbstate_t is not declared
(typedef is guarded with #ifdef _WCHAR_H)
2. with __need_mbstate_t undefined (it is undefined in first step in wchar.h),
_WCHAR_H is defined at the top of wchar.h and therefore mbstate_t is declared
Now looking at wchar.h in gnulib/lib directory, it starts with:
#ifndef _GL_WCHAR_H
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
included before <wchar.h>. */
#include <stddef.h>
#include <stdio.h>
#include <time.h>
/* Include the original <wchar.h> if it exists.
Some builds of uClibc lack it. */
/* The include_next requires a split double-inclusion guard. */
#if 1
# include_next <wchar.h>
#endif
#ifndef _GL_WCHAR_H
#define _GL_WCHAR_H
Therefore, # include_next <wchar.h> is executed only once, because it is
guarded with #ifndef _GL_WCHAR_H and _GL_WCHAR_H is defined first time
gnulib's wchar.h is included.
Removing the first #ifndef _GL_WCHAR_H allows package to compile successfully.
However, I don't know if this is the right approach. Can anyone suggest
solution to the issue?
I also noticed other header files in gnulib/lib to have the similar approach.
But it may not cause any problems there.
Thanks,
Erik
__________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your
favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
- Bug in GNULIB wchar.h?,
Erik Benada <=