This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++ testsuite on cygwin. Please help me fix the -liconv problem (PR36211)


I am looking at some libstdc++ testsuite failures on cygwin. One of them is a simple link error with -liconv.
- http://gcc.gnu.org/ml/libstdc++/2007-06/msg00007.html
- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36211


The problem is that while -liconv is passed to linker, it is passed *before* the objects and libraries that reference libiconv symbols (see below). 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.

All we need to do is reordering the command line and place -liconv after unicode.cc.

I have spent some time looking at the testsuite files. LIBICONV is defined in "scripts/testsuite_flags --cxxldflags", and this is used to define cxxldflags in libstdc++.exp(libstdc++_init).

Then, in libstdc++.exp(v3_target_compile), cxxldflags is appended to cxx_final - the command used to compile the test. This is not correct, as it places -liconv before the source files. The following patch does the right thing on cygwin, but I am not sure if it is the best way. (I got lost in the twisty maze of *.exp files.)

2009-04-14 David Billinghurst <billingd@gcc.gnu.org>

* testsuite/lib/libstdc++.exp(v3_target_compile): Add cxxldflags to additional_flags rather than cxx_final.

--- libstdc++.exp       (revision 147328)
+++ libstdc++.exp       (working copy)
@@ -402,8 +402,7 @@
     # Flag setting based on type argument.
     if { $type == "executable" } {
        # Link the support objects into executables.
-        set cxx_final [concat $cxx_final $cxxldflags]
-       lappend options "additional_flags=./libtestc++.a"
+       lappend options "additional_flags=./libtestc++.a $cxxldflags"
     } else {
        if { $type == "sharedlib" } {
            # Don't link in anything.



======================================================================
Here is the command that the testsuite uses to generate to executables:

/usr/local/obj/gcc-20090510/./gcc/g++ -shared-libgcc -B/usr/local/obj/gcc-20090510/./gcc -nostdinc++ -L/usr/local/obj/gcc-20090510/i686-pc-cygwin/libstdc++-v3/src -L/usr/local/obj/gcc-20090510/i686-pc-cygwin/libstdc++-v3/src/.libs -B/usr/local/gcc-4_5/i686-pc-cygwin/bin/ -B/usr/local/gcc-4_5/i686-pc-cygwin/lib/ -isystem /usr/local/gcc-4_5/i686-pc-cygwin/include -isystem /usr/local/gcc-4_5/i686-pc-cygwin/sys-include -g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0 -ffunction-sections -fdata-sections -g -O2 -g -O2 -DLOCALEDIR="." -nostdinc++ -I/usr/local/obj/gcc-20090510/i686-pc-cygwin/libstdc++-v3/include/i686-pc-cygwin -I/usr/local/obj/gcc-20090510/i686-pc-cygwin/libstdc++-v3/include -I/usr/local/cvs/trunk/libstdc++-v3/libsupc++ -I/usr/local/cvs/trunk/libstdc++-v3/include/backward -I/usr/local/cvs/trunk/libstdc++-v3/testsuite/util -Wl,--gc-sections -liconv /usr/local/cvs/trunk/libstdc++-v3/testsuite/22_locale/locale/cons/unicode.cc -include bits/stdc++.h ./libtestc++.a -o ./unicode.exe

/cygdrive/c/DOCUME~1/DABILL~1/LOCALS~1/Temp/ccXfhduf.o: In function `__iconv_adaptor<const char**>':
/usr/local/obj/gcc-20090510/i686-pc-cygwin/libstdc++-v3/include/ext/codecvt_specializations.h:297: undefined reference to `_libiconv'
/usr/local/obj/gcc-20090510/i686-pc-cygwin/libstdc++-v3/include/ext/codecvt_specializations.h:297: undefined reference to `_libiconv'
/usr/local/obj/gcc-20090510/i686-pc-cygwin/libstdc++-v3/include/ext/codecvt_specializations.h:297: undefined reference to `_libiconv'
/usr/local/obj/gcc-20090510/i686-pc-cygwin/libstdc++-v3/include/ext/codecvt_specializations.h:297: undefined reference to `_libiconv'
/usr/local/obj/gcc-20090510/i686-pc-cygwin/libstdc++-v3/include/ext/codecvt_specializations.h:297: undefined reference to `_libiconv'
collect2: ld returned 1 exit status




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]