[csw-users] How Can I Determine If My Copies Of gcc And libstdc++ Are Compatible?

eric eric eric49933 at gmail.com
Tue Jul 3 17:59:46 CEST 2012


How can I determine if my copies of gcc and libstdc++ are compatible?

In Brief

Our app hangs during static initialization under certain circumstances and the
problem seems to coincide with our migration from gcc 4.5.1 to 4.7.1.  The
stack trace includes paths such as "../gcc-4.5.1/libstdc++" which makes me
wonder, maybe our libstdc++ is specific to gcc 4.5.1, maybe we need to upgrade

I checked the link below but it does not list gcc 4.7.1:


In Detail

1) We're on Solaris 10:

$ cat /etc/release
                   Oracle Solaris 10 8/11 s10s_u10wos_17b SPARC
  Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
                            Assembled 23 August 2011

2) We're on gcc 4.7.1:

$ /opt/csw/bin/gcc -v
Reading specs from /opt/csw/lib/gcc/sparc-sun-solaris2.10/4.7.1/specs
Target: sparc-sun-solaris2.10
Configured with:
--prefix=/opt/csw --exec_prefix=/opt/csw --bindir=/opt/csw/bin
--sbindir=/opt/csw/sbin --libexecdir=/opt/csw/libexec --datadir=/opt/csw/share
--sysconfdir=/etc/opt/csw --sharedstatedir=/opt/csw/share
--localstatedir=/var/opt/csw --libdir=/opt/csw/lib
--infodir=/opt/csw/share/info --includedir=/opt/csw/include
--mandir=/opt/csw/share/man --enable-cloog-backend=isl --enable-java-awt=xlib
--enable-languages=ada,c,c++,fortran,go,java,objc --enable-libada
--enable-libssp --enable-nls --enable-objc-gc --enable-threads=posix
--program-suffix=-4.7 --with-as=/opt/csw/bin/gas --with-cloog=/opt/csw
--with-gmp=/opt/csw --with-gnu-as --with-included-gettext
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --with-libiconv-prefix=/opt/csw
--with-mpfr=/opt/csw --with-ppl=/opt/csw --with-system-zlib=/opt/csw
Thread model: posix
gcc version 4.7.1 (GCC)

3) We're on libstdc++ 6:

$ file /opt/csw/lib/libstdc++.so.6
/opt/csw/lib/libstdc++.so.6:    ELF 32-bit MSB dynamic lib SPARC32PLUS
Version 1, V8+ Required, dynamically linked, not stripped

How can I get more info about the above file?  Minor/Sub version
number?  ABI/GCC compatibility?

4) Here is the output of ldd on our app:

$ ldd myapp
        libmyapp.so =>   /path/to/bin/libmyapp.so
        libboost_unit_test_framework.so.1.48.0 =>
        libboost_date_time.so.1.48.0 =>
        libboost_filesystem.so.1.48.0 =>
        libboost_serialization.so.1.48.0 =>
        libboost_system.so.1.48.0 =>     /path/to/lib/libboost_system.so.1.48.0
        libldap.so.5 =>  /usr/lib/libldap.so.5
        libstdc++.so.6 =>        /opt/csw/gcc4/lib/libstdc++.so.6
        libstdc++.so.6 (GLIBCXX_3.4.15) =>       (version not found)
        libstdc++.so.6 (CXXABI_1.3) =>   (version not found)
        libm.so.2 =>     /lib/libm.so.2
        libgcc_s.so.1 =>         /opt/csw/gcc4/lib/libgcc_s.so.1
        libpthread.so.1 =>       /lib/libpthread.so.1
        libc.so.1 =>     /lib/libc.so.1
        libgcc_s.so.1 =>         /opt/csw/lib/libgcc_s.so.1
        librt.so.1 =>    /lib/librt.so.1
        libstdc++.so.6 =>        /opt/csw/lib/libstdc++.so.6
        libsasl.so.1 =>  /usr/lib/libsasl.so.1
        libsocket.so.1 =>        /lib/libsocket.so.1
        libnsl.so.1 =>   /lib/libnsl.so.1
        libmd.so.1 =>    /lib/libmd.so.1
        libnspr4.so =>   /usr/lib/mps/libnspr4.so
        libplc4.so =>    /usr/lib/mps/libplc4.so
        libnss3.so =>    /usr/lib/mps/libnss3.so
        libssl3.so =>    /usr/lib/mps/libssl3.so
        libm.so.1 =>     /lib/libm.so.1
        libaio.so.1 =>   /lib/libaio.so.1
        libmp.so.2 =>    /lib/libmp.so.2
        libscf.so.1 =>   /lib/libscf.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libnssutil3.so =>        /usr/lib/mps/libnssutil3.so
        libplds4.so =>   /usr/lib/mps/libplds4.so
        libthread.so.1 =>        /lib/libthread.so.1
        libdoor.so.1 =>  /lib/libdoor.so.1
        libuutil.so.1 =>         /lib/libuutil.so.1
        libgen.so.1 =>   /lib/libgen.so.1

5) Here is the stack trace when our app hangs:

(gdb) bt
#0  0xfe7ca710 in __lwp_park () from /lib/libc.so.1
#1  0xfe7c459c in cond_sleep_queue () from /lib/libc.so.1
#2  0xfe7c4760 in cond_wait_queue () from /lib/libc.so.1
#3  0xfe7c4ba4 in cond_wait_common () from /lib/libc.so.1
#4  0xfe7c4ca8 in cond_wait () from /lib/libc.so.1
#5  0xfe7c4ce4 in pthread_cond_wait () from /lib/libc.so.1
#6  0xfea4ee3c in __gthread_cond_wait (g=0xfef735d8)
    at /opt/csw/src/gcc-4.5.1-001/sparc-sun-solaris2.8/libstdc++-v3/include/sparc-sun-solaris2.8/bits/gthr-default.h:862
#7  __gthread_cond_wait_recursive (g=0xfef735d8)
    at /opt/csw/src/gcc-4.5.1-001/sparc-sun-solaris2.8/libstdc++-v3/include/sparc-sun-solaris2.8/bits/gthr-default.h:876
#8  wait_recursive (g=0xfef735d8) at
#9  __cxxabiv1::__cxa_guard_acquire (g=0xfef735d8) at
#10 0xfef628c4 in boost::system::generic_category () at
#11 0xff211f84 in __static_initialization_and_destruction_0
(__initialize_p=1, __priority=65535)
    at /data/home/bufebs/boost_1_48_0/install/gcc-4.7.1/debug/include/boost/system/error_code.hpp:214
#12 0xff2120cc in _GLOBAL__sub_I_MyApp.cpp(void) ()
    at /path/to/my/code/myapp.cpp:352
#13 0xff2840e4 in __do_global_ctors_aux ()
   from /path/to/my/bin/myapp.so
#14 0xff28411c in _init () from /path/to/my/bin/myapp.so
#15 0xff3c4bf8 in call_init () from /usr/lib/ld.so.1
#16 0xff3d4be4 in elf_bndr () from /usr/lib/ld.so.1
#17 0xff3b56dc in elf_rtbndr () from /usr/lib/ld.so.1
#18 0xff3b56dc in elf_rtbndr () from /usr/lib/ld.so.1
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

As mentioned above the stack trace includes strings like
"gcc-4.5.1/libstdc++" which makes me wonder if maybe our libstdc++ is
specific to gcc 4.5.1?  Maybe we need to upgrade to a libstdc++ for
gcc 4.7.1?

I would be grateful for any help.

Kind Regards,

More information about the users mailing list