libstdc++ testsuite cases which require libiconv fail on account of trying the wrong choice in __iconv_adaptor: /cygdrive/c/gnu/gcc-4.4-20080509/xp/i686-pc-cygwin/libstdc++-v3/include/ext/code cvt_specializations.h:302: undefined reference to `_libiconv'^M #ifndef LIBICONV_PLUG #define iconv libiconv #endif extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
2 unicode.cc tests fail. Several other tests with -liconv pass.
Why, exactly, do you believe the problem is with the const? The code and the comment in codecvt_specializations.h appear to indicate that we are already dealing correctly with the issue and indeed you are reporting that other tests link fine...
I see that the failing case is looking for a libiconv in the library to match the char ** prototype, and failing to find one, while the one in the actual library is set up for the const char ** version. The comment in codecvt_specializations.h indicates this should be taken care of by __iconv_adaptor, yet the link failure shows this is not working. I don't understand the usage well enough to know what to conclude, why some cases (do they also exercise __iconv_adaptor ?) work, while the unicode.cc cases fail to link at that point. This problem has been brought up by others in mail lists, but as far as I know no one wrote up a PR.
Please add pointers to the discussions on those mailing lists.
Only the gcc-testresults reports where others report the same thing are clearly relevant: http://gcc.gnu.org/ml/gcc-testresults/2008-03/msg01444.html http://gcc.gnu.org/ml/gcc-testresults/2007-05/msg01528.html In other cases, the poster did not provide sufficient information to establish conclusively it was the same problem. It is generally not reported in testresults whether libstdc++ tests were run with libiconv installed. If libiconv is not installed, none of these tests are attempted.
Frankly, we badly need more details and/or the help of a cygwin maintainer, because by looking statically at the code I don't see how possibly __iconv_adaptor can be wrong and most (all?) the active libstdc++ maintainers do not have a cygwin machine available.
Following is with mingw but it applies to cygwin as well This is the command line from log for FAILing 22_locale/locale/cons/unicode.cc Executing on host: /develop/svn/trunk/build/./gcc/g++ -shared-libgcc -B/develop/svn/trunk/build/./gcc -nostdinc++ -L/develop/svn/trunk/build/mingw32/libstdc++-v3/src -L/develop/svn/trunk/build/mingw32/libstdc++-v3/src/.libs -L/develop/svn/trunk/build/mingw32/winsup/mingw -L/develop/svn/trunk/build/mingw32/winsup/w32api/lib -isystem /develop/svn/trunk/src/winsup/mingw/include -isystem /develop/svn/trunk/src/winsup/w32api/include -B/mingw/mingw32/bin/ -B/mingw/mingw32/lib/ -isystem /mingw/mingw32/include -isystem /mingw/mingw32/sys-include -g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0 -ffunction-sections -fdata-sections -g -O2 -g -O2 -DLOCALEDIR="." -nostdinc++ -I/develop/svn/trunk/build/mingw32/libstdc++-v3/include/mingw32 -I/develop/svn/trunk/build/mingw32/libstdc++-v3/include -I/develop/svn/trunk/src/libstdc++-v3/libsupc++ -I/develop/svn/trunk/src/libstdc++-v3/include/backward -I/develop/svn/trunk/src/libstdc++-v3/testsuite/util -Wl,--gc-sections /mingw/lib/libiconv.a /develop/svn/trunk/src/libstdc++-v3/testsuite/22_locale/locale/cons/unicode.cc -include bits/stdc++.h ./libtestc++.a -lm -o ./unicode.exe (timeout = 600) Note that although the correct libiconv "/mingw/lib/libiconv.a" is passed to linker, it is passed *before* the objects and libraries that reference libiconv symbols. With PE-COFF, the order of objects really does matter and since the libiconv symbols have not yet been referenced when the linker looks at the lib, the symbols are not resolved. They are not resolved lazily as is possible in ELF Danny
Yes, -liconv precedes the source file, where it must follow: Executing on host: /cygdrive/c/gnu/gcc-4.4-20080509/xp/./gcc/g++ -shared-libgcc -B/cygdrive/c/gnu/gcc-4.4-20080509/xp/./gcc -nostdinc++ -L/cygdrive/c/gnu/gcc-4. 4-20080509/xp/i686-pc-cygwin/libstdc++-v3/src -L/cygdrive/c/gnu/gcc-4.4-20080509 /xp/i686-pc-cygwin/libstdc++-v3/src/.libs -B/usr/local/gcc44/i686-pc-cygwin/bin/ -B/usr/local/gcc44/i686-pc-cygwin/lib/ -isystem /usr/local/gcc44/i686-pc-cygwin /include -isystem /usr/local/gcc44/i686-pc-cygwin/sys-include -g -O2 -D_GLIBCXX_ ASSERT -fmessage-length=0 -ffunction-sections -fdata-sections -g -O2 -g -O2 -D LOCALEDIR="." -nostdinc++ -I/cygdrive/c/gnu/gcc-4.4-20080509/xp/i686-pc-cygwin/l ibstdc++-v3/include/i686-pc-cygwin -I/cygdrive/c/gnu/gcc-4.4-20080509/xp/i686-pc -cygwin/libstdc++-v3/include -I/cygdrive/c/gnu/gcc-4.4-20080509/libstdc++-v3/lib supc++ -I/cygdrive/c/gnu/gcc-4.4-20080509/libstdc++-v3/include/backward -I/cygdr ive/c/gnu/gcc-4.4-20080509/libstdc++-v3/testsuite/util -Wl,--gc-sections -liconv /cygdrive/c/gnu/gcc-4.4-20080509/libstdc++-v3/testsuite/22_locale/locale/cons/u nicode.cc -include bits/stdc++.h ./libtestc++.a -o ./unicode.exe (time
Draft patch http://gcc.gnu.org/ml/libstdc++/2009-05/msg00090.html
Patch is approved - http://gcc.gnu.org/ml/libstdc++/2009-05/msg00098.html
Subject: Bug 36211 Author: billingd Date: Fri May 15 09:23:58 2009 New Revision: 147565 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147565 Log: 2009-05-15 David Billinghurst <billingd@gcc.gnu.org> PR libstdc++/36211 * testsuite/lib/libstdc++.exp(v3_target_compile): Add cxxldflags to additional_flags rather than cxx_final. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/testsuite/lib/libstdc++.exp
Subject: Bug 36211 Author: billingd Date: Thu May 21 11:30:55 2009 New Revision: 147762 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147762 Log: 2009-05-21 David Billinghurst <billingd@gcc.gnu.org> Backport from mainline: PR libstdc++/36211 * testsuite/lib/libstdc++.exp(v3_target_compile): Add cxxldflags to additional_flags rather than cxx_final. Modified: branches/gcc-4_4-branch/libstdc++-v3/ChangeLog branches/gcc-4_4-branch/libstdc++-v3/testsuite/lib/libstdc++.exp
Fixed in 4.4 and trunk.