(2.9.8) Segfault during global constructor for std_istream at program start.

George T. Talbot george@moberg.com
Sat Apr 1 00:00:00 GMT 2000


I've got 2.9.8 built and installed with gcc 2.95.2 on x86 Linux.  The
configure command I used was:

configure --enable-threads=pthreads --enable-long_long
--prefix=/usr/local/libstdc++-v3

For a simple test program, everything works fine.  So I recompiled my program
that I'm working on at work, and I get:


(gdb) run -skip
Starting program: /home/george/working/mrc/test/commontestdb -skip
localhost being added to access control list
dhcp41 being added to access control list
brain being added to access control list

Program received signal SIGSEGV, Segmentation fault.
__pthread_mutex_init (mutex=0x0, mutex_attr=0xbffff624) at spinlock.h:59
59      spinlock.h: No such file or directory.
(gdb) bt
#0  __pthread_mutex_init (mutex=0x0, mutex_attr=0xbffff624) at spinlock.h:59
#1  0x40199e53 in _IO_init (fp=0x81f1408, flags=0) at genops.c:556
#2  0x40092830 in __basic_file::__basic_file (this=0x81f1408) at c++io.cc:42
#3  0x400b3190 in basic_filebuf<char, char_traits<char> >::_M_init_filebuf
(this=0x40123360)
    at ../../gcc-2.95.2/libstdc++/bits/fstream.tcc:48
#4  0x400b3323 in basic_filebuf<char, char_traits<char> >::basic_filebuf
(this=0x40123360)
    at ../../gcc-2.95.2/libstdc++/bits/fstream.tcc:61
#5  0x4009723b in __static_initialization_and_destruction_0 (__initialize_p=1,
__priority=65535)
    at ../../gcc-2.95.2/libstdc++/src/stdstreams.cc:35
#6  0x40097456 in global constructors keyed to __cfileinit ()
    at ../../gcc-2.95.2/libstdc++/bits/std_istream.h:72
#7  0x400d8247 in __do_global_ctors_aux () from
/usr/local/libstdc++-v3/lib/libstdc++.so.3
(gdb)


Does this look familiar to anyone?  I'm not sure what I did wrong.

As far as debugging this goes, line 556 of genops.c is not in _IO_init() in
either GCC's genops.c or libstdc++-v3's genops.c.  So, I'm not exactly sure
what to do.

If anyone wishes, I can probably help with debugging, but I'm in a little over
my head to go-it alone, if you know what I'm saying...

--
George T. Talbot
<george@moberg.com>


More information about the Libstdc++ mailing list