2010/1/10 Jim Meyering <j...@meyering.net>: > Jim Meyering wrote: > >> Mike Frysinger wrote: >>> On Saturday 09 January 2010 03:58:02 Chris Clayton wrote: >>>> I'm getting a build error with coreutils-8.3. version 8.2 builds fine >>>> with the same toolset/glibc releases. The error is as follows: >>>> >>>> gcc version is 4.4.3 20100105 (prerelease). glibc is 2.7. >>> >>> seems to be an issue with <=glibc-2.9. at least, i have reports that >>> glibc-2.11 works. >> >> Right. >> I think that without the fix below from glibc (glibc-2.9-46-g0f2ae55), >> the double-inclusion code in gnulib's lib/wchar.in.h doesn't work >> properly, with the result that /usr/include/wchar.h is never included. >> >> commit 0f2ae55cf707947688bd28b55899a148fd3d7646 >> Author: Ulrich Drepper <drep...@redhat.com> >> Date: Mon Dec 29 23:01:38 2008 +0000 >> >> [BZ #9694] >> >> * wcsmbs/wchar.h: Move undefs for local __need_* constants to the >> very end. >> >> diff --git a/ChangeLog b/ChangeLog >> index 7696705..333c502 100644 >> --- a/ChangeLog >> +++ b/ChangeLog >> @@ -1,5 +1,9 @@ >> 2008-12-29 Ulrich Drepper <drep...@redhat.com> >> >> + [BZ #9694] >> + * wcsmbs/wchar.h: Move undefs for local __need_* constants to the >> + very end. >> + >> * nscd/nscd_gethst_r.c (nscd_gethst_r): Don't use nscd if >> LOCALDOMAIN is defined. >> * nscd/nscd_getai.c (__nscd_getai): Likewise. >> diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h >> index 0fd9e35..aaf278d 100644 >> --- a/wcsmbs/wchar.h >> +++ b/wcsmbs/wchar.h >> @@ -1,4 +1,4 @@ >> -/* Copyright (C) 1995-2004,2005,2006,2007 Free Software Foundation, Inc. >> +/* Copyright (C) 1995-2004,2005,2006,2007, 2008 Free Software Foundation, >> Inc. >> This file is part of the GNU C Library. >> >> The GNU C Library is free software; you can redistribute it and/or >> @@ -839,9 +839,9 @@ __END_DECLS >> >> #endif /* _WCHAR_H defined */ >> >> +#endif /* wchar.h */ >> + >> /* Undefined all __need_* constants in case we are included to get those >> constants but the whole file was already read. */ >> #undef __need_mbstate_t >> #undef __need_wint_t >> - >> -#endif /* wchar.h */ > > I think it's a combination of the above and the recent change that added > this #ifndef: > > /* 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>. > But avoid namespace pollution on glibc systems. */ > #ifndef __GLIBC__ > # include <stddef.h> > # include <stdio.h> > # include <time.h> > #endif > > Removing that #ifndef avoids the failure, as well as including > <time.h> unconditionally, as done in the patch below. > > I don't have the cpp expansion of exclude.c in front of me now, > but I'm pretty sure I saw in it an inclusion of wchar.h via time.h. > The combination of that and the glibc bug fixed above seems to be > the likely cause. > > This patch does work, but seems too kludgey for my taste, > and it doesn't explain that <time.h> is required to work around > the glibc-2.7..2.9 problem in wchar.h. >
Yes, I can confirm that applying the patch below allows the build to complete here. I should also note that the build completes _without_ any changes to /usr/include/wchar.h - i.e. _without_ the patch from glibc-2.9 that Jim identified. Feel free to let me know if you would like me to test a less kludgey solution :-) Thanks Chris > diff --git a/lib/wchar.in.h b/lib/wchar.in.h > index c0323fe..7766b2f 100644 > --- a/lib/wchar.in.h > +++ b/lib/wchar.in.h > @@ -60,8 +60,8 @@ > #ifndef __GLIBC__ > # include <stddef.h> > # include <stdio.h> > -# include <time.h> > #endif > +#include <time.h> > > /* Include the original <wchar.h> if it exists. > Some builds of uClibc lack it. */ > -- No, Sir; there is nothing which has yet been contrived by man, by which so much happiness is produced as by a good tavern or inn - Doctor Samuel Johnson