public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: problem with iostream
@ 2000-03-26 12:18 Martin Berger
  2000-03-26 13:24 ` Martin v. Loewis
  2000-04-01  0:00 ` Martin Berger
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Berger @ 2000-03-26 12:18 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5277 bytes --]

> > hello, i have just upgraded to the latest 
version of redhat linux > > and suddenly my g++ compiled programs fall 
over.
 
> From your description, it was not clear 
whether the old binaries > stopped working on the new system, or whether 
binaries created on the > new system with the new compiler would 
break.
 
thank you for your help. old binaries still work. 
Only newly compiled ones coredump. 
 
> Also, it is not clear to me whether you have 
installed the latest > redhat version "from scratch", or overwritten your 
previous > installation. It may well be that there were still some old 
files > lying around which should have been removed but 
weren't.
 
i have overwritten my previous (2 year old) 
installation.  i suspect that your analysis is correct. alas i am not 
familiar enough with the g++ library system to work out which files are the 
troublemakers. (btw: is there an easily accessible description of the 
structure of g++ and its libraries, or do i have to read the code/man pages 
to get the picture?)
 
> To investigate this further, please try the 
following commands:
 
> ldd <your compiled program> > g++ 
-o <output file> <your source file> -v --trace-includes
 
> rpm -qf <library name>
 
the output is quoted below.
 
thanks, martin
 
i am using redhat release 6.1, kernel 2.2.12.20. 
the output of ldd is:
 
--------------------------------------------------------------------------
 
  libm.so.6 => /lib/libm.so.6 
(0x40018000)   libc.so.6 => /lib/libc.so.6 (0x40035000)   
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
 
--------------------------------------------------------------------------
 
  lsl /lib/libm.so.6   
lrwxrwxrwx   1 root     
root           13 Mar 21 23:46 
/lib/libm.so.6 -> libm-2.1.2.so   lsl /lib/libc.so.6   
lrwxrwxrwx   1 root     
root           13 Mar 21 23:46 
/lib/libc.so.6 -> libc-2.1.2.so   lsl /lib/ld-linux.so.2   
lrwxrwxrwx   1 root     
root           11 Mar 21 23:46 
/lib/ld-linux.so.2 -> ld-2.1.2.so
 
  /lib> rpm -qf libm-2.1.2.so   
glibc-2.1.2-11   /lib> rpm -qf libc-2.1.2.so   
glibc-2.1.2-11   /lib> rpm -qf ld-2.1.2.so    
glibc-2.1.2-11
 
the output of g++ with the aforementioned command 
line options is 
as follows. --------------------------------------------------------------------------
 
  Reading specs from 
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/specs   gcc 
version egcs-2.91.66 19990314 (egcs-1.1.2 release)   
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/cpp -lang-c++ -v -undef 
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix 
-Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__linux__ 
-D__unix -D__i386 -D__linux -Asystem(posix) -D__EXCEPTIONS -H -Asystem(unix) 
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di586 -Dpentium -D__i586 
-D__i586__ -D__pentium -D__pentium__ test.cpp /tmp/ccBN0ncc.ii   GNU CPP 
version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i386 Linux/ELF)   
#include "..." search starts here:   #include <...> search starts 
here:    /usr/local/include/g++    
/usr/local/include    
/usr/local/i586-pc-linux-gnu/include    
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/include    
/usr/include   End of search list.   
/usr/local/include/g++/iostream    
/usr/local/include/g++/iostream.h     
/usr/local/include/g++/streambuf.h      
/usr/include/libio.h       
/usr/include/_G_config.h        
/usr/include/bits/types.h         
/usr/include/features.h          
/usr/include/sys/cdefs.h          
/usr/include/gnu/stubs.h         
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/include/stddef.h        
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/include/stddef.h       
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/include/stdarg.h      
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/include/stdarg.h    
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/cc1plus /tmp/ccBN0ncc.ii 
-quiet -dumpbase test.cc -version -o /tmp/ccIKwR7h.s   GNU C++ version 
egcs-2.91.66 19990314 (egcs-1.1.2 release) (i586-pc-linux-gnu) compiled by GNU C 
version egcs-2.91.66 19990314 (egcs-1.1.2 release).    as -V -Qy -o 
/tmp/ccVMJY2e.o /tmp/ccIKwR7h.s   GNU assembler version 2.9.1 
(i386-redhat-linux), using BFD version 2.9.1.0.24    
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/collect2 -m elf_i386 
-dynamic-linker /lib/ld-linux.so.2 -o a.out /usr/lib/crt1.o /usr/lib/crti.o 
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/crtbegin.o 
-L/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66 
-L/usr/local/i586-pc-linux-gnu/lib -L/usr/local/lib /tmp/ccVMJY2e.o -lstdc++ -lm 
-lgcc -lc -lgcc /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/crtend.o 
/usr/lib/crtn.o   

^ permalink raw reply	[flat|nested] 8+ messages in thread
* problem with iostream
@ 2000-03-24  3:11 martin.berger
  2000-03-25 11:03 ` Martin v. Loewis
  2000-04-01  0:00 ` martin.berger
  0 siblings, 2 replies; 8+ messages in thread
From: martin.berger @ 2000-03-24  3:11 UTC (permalink / raw)
  To: gcc-help; +Cc: martin.berger

hello, i have just upgraded to the latest version of redhat linux
and suddenly my g++ compiled programs fall over. the problem seems to
be related to the iostream library. here is an example program that
fails (the details of how cout is used dont seem to matter. the fault
seems to occur every time cout is used).

#include <iostream>

int main( int, char* )
{
      cout << "" << endl;
}

(below you'll find the relevant compiler and gdb output). alas, i'm not too
familiar with the g++ system and the redhat distribution. i suspect
that the problem is some trivial omission in my setup. but i can't work out
what. can you please help?

thanks, martin

~/c++/NEW> g++ -v test.cpp       
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentium__ test.cpp /tmp/cc5KSDQU.ii
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++
 /usr/local/include
 /usr/local/i586-pc-linux-gnu/include
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/cc1plus /tmp/cc5KSDQU.ii -quiet -dumpbase test.cc -version -o /tmp/cc814umP.s
GNU C++ version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i586-pc-linux-gnu) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
 as -V -Qy -o /tmp/ccKIZ6NC.o /tmp/cc814umP.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version 2.9.1.0.24
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/crtbegin.o -L/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66 -L/usr/local/i586-pc-linux-gnu/lib -L/usr/local/lib /tmp/ccKIZ6NC.o -lstdc++ -lm -lgcc -lc -lgcc /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/crtend.o /usr/lib/crtn.o
~/c++/NEW> ./a.out 
Segmentation fault (core dumped)



gdb a.out core 
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `./a.out'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
#0  0x4008b012 in __overflow (f=0x80539e0, ch=10) at genops.c:197
197     genops.c: No such file or directory.
(gdb) where
#0  0x4008b012 in __overflow (f=0x80539e0, ch=10) at genops.c:197
#1  0x40088191 in _IO_putc (c=10, fp=0x80539e0) at putc.c:33
#2  0x804c0eb in endl (outs=@0x8053ae0)
    at ../../../egcs-1.1.2/libio/streambuf.h:395
#3  0x804cbb0 in ostream::operator<< (this=0x8053ae0, 
    func=0x804c0d8 <endl(ostream &)>)
    at ../../../egcs-1.1.2/libio/iostream.h:106
#4  0x804a322 in main ()
#5  0x4004d1eb in __libc_start_main (main=0x804a300 <main>, argc=1, 
    argv=0xbffffc94, init=0x8049dc0 <_init>, fini=0x8052360 <_fini>, 
    rtld_fini=0x4000a610 <_dl_fini>, stack_end=0xbffffc8c)
    at ../sysdeps/generic/libc-start.c:90
(gdb) 




--------------------
talk21 your FREE portable and private address on the net at http://www.talk21.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-26 12:18 problem with iostream Martin Berger
2000-03-26 13:24 ` Martin v. Loewis
2000-04-01  0:00   ` Martin v. Loewis
2000-04-01  0:00 ` Martin Berger
  -- strict thread matches above, loose matches on Subject: below --
2000-03-24  3:11 martin.berger
2000-03-25 11:03 ` Martin v. Loewis
2000-04-01  0:00   ` Martin v. Loewis
2000-04-01  0:00 ` martin.berger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).