[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gcc-4.3, glibc and AC_PROG_CC_STDC
From: |
Bruno Haible |
Subject: |
gcc-4.3, glibc and AC_PROG_CC_STDC |
Date: |
Sat, 10 Feb 2007 23:44:43 +0100 |
User-agent: |
KMail/1.5.4 |
Problem
=======
glibc's <wchar.h> from 2.3.x up to the most recent ones has a bug which
causes a link error when more than one compilation unit uses <wchar.h>
and is compiled by a gcc-4.3 snapshot with "--std=gnu99 -O2".
http://sourceware.org/bugzilla/show_bug.cgi?id=4022
<wchar.h> is a header file whose presence is now universally assumed;
the last platform that lacked it that I know of is EMX, whose development
stopped in 2003. Programs usually don't use #if HAVE_WCHAR_H any more.
On such glibc systems, AC_PROG_CC_STDC currently enables --std=gnu99.
The resulting error looks like this, for example with GNU bison on a
Linux/x86 system:
$ make
...
gcc -std=gnu99 -g -O2 -o bison LR0.o assoc.o closure.o complain.o
conflicts.o derives.o files.o getargs.o gram.o lalr.o location.o main.o
muscle_tab.o nullable.o output.o parse-gram.o print.o print_graph.o reader.o
reduce.o revision.o relation.o scan-code-c.o scan-gram-c.o scan-skel-c.o
state.o symlist.o symtab.o tables.o uniqstr.o graphviz.o ../lib/libbison.a
../lib/libbison.a(quotearg.o): In function `wcstouq':
/usr/include/wchar.h:563: multiple definition of `wcstouq'
../lib/libbison.a(mbswidth.o):/usr/include/wchar.h:563: first defined here
../lib/libbison.a(quotearg.o): In function `wcstoq':
/usr/include/wchar.h:558: multiple definition of `wcstoq'
../lib/libbison.a(mbswidth.o):/usr/include/wchar.h:558: first defined here
../lib/libbison.a(quotearg.o): In function `wcstold':
/usr/include/wchar.h:551: multiple definition of `wcstold'
../lib/libbison.a(mbswidth.o):/usr/include/wchar.h:551: first defined here
../lib/libbison.a(quotearg.o): In function `wcstof':
/usr/include/wchar.h:547: multiple definition of `wcstof'
../lib/libbison.a(mbswidth.o):/usr/include/wchar.h:547: first defined here
../lib/libbison.a(quotearg.o): In function `wcstoul':
/usr/include/wchar.h:540: multiple definition of `wcstoul'
../lib/libbison.a(mbswidth.o):/usr/include/wchar.h:540: first defined here
../lib/libbison.a(quotearg.o): In function `wcstol':
/usr/include/wchar.h:536: multiple definition of `wcstol'
../lib/libbison.a(mbswidth.o):/usr/include/wchar.h:536: first defined here
../lib/libbison.a(quotearg.o): In function `wcstod':
/usr/include/wchar.h:532: multiple definition of `wcstod'
../lib/libbison.a(mbswidth.o):/usr/include/wchar.h:532: first defined here
collect2: ld returned 1 exit status
make[2]: *** [bison] Error 1
Possible Solutions
==================
Given that
- gcc-4.3's behaviour is not likely to change (they have made the change
precisely for implementing ISO C 99 more closely),
- gcc-4.3 should be released in spring 2008,
- it takes ca. 5 years until a new glibc version is universally deployed
(in the sense that the number of users of an older glibc is negligibly
small),
I think autoconf should do something about it.
There are two possibilities:
- Modify AC_PROG_CC_STDC so that it doesn't activate --std=gnu99 in this
case,
- Modify AC_CHECK_HEADERS so that it reports <wchar.h> missing in this case.
Since the second option implies a serious loss of functionality (wide character
and multibyte character functions are essential for internationalization),
my preference would be for the first option.
Bruno
- gcc-4.3, glibc and AC_PROG_CC_STDC,
Bruno Haible <=