public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Strange g++ problem: HELP!
@ 2000-01-27  8:17 David Ronis
  2000-01-27 12:52 ` David Eduardo Gomez Noguera
  0 siblings, 1 reply; 2+ messages in thread
From: David Ronis @ 2000-01-27  8:17 UTC (permalink / raw)
  To: gcc; +Cc: ronis, glibc-linux

I just finished reinstalling gcc-2.95.2 and installing glibc-2.1.3pre3
on an i686 Sony Z505S (celeron) laptop running linux-2.2.14 (upgraded
from a Slackware 7.0 distribution).  Both installed with no
complaints.  I have a problem running C++ programs.  Here's a trivial
example:

------------------------test.cc------------------------------------------
extern "C" {
#include <stdio.h>
}

#include <complex>

int main()
{
  double_complex a(0.0,0.0);

  printf("a=%g,%g\n",real(a),imag(a));

  return 0;
}
--------------------------------------------------------------------------

If I compile with Slackware's native compiler (egcs-1.1.2) the program
runs properly (as it did with Slack's original glibc-2.1.2 libraries).
If I compile with gcc-2.95.2 (or the current 2.96 snapshot) and
dynamically link with either the 2.1.2 or 2.1.3pre3 libraries I get a
SIGSEGV inside printf (in vaprintf).  The same binary runs fine on
another linux box (one where I long ago switched to gcc-2.95.2 as the
primary compiler).  Just to make life more confusing, if I compile
with -static (after installing 2.1.2pre3) things work on the laptop.
My guess is that I'm getting some sort of library conflict, but ldd
seems to indicate that things are being loaded correctly. Clearly I'm
missing something.

David

Here is a log of various compilation/ldd/run sessions:

First with gcc-2.95.2:

{montroll:49} g++ -v -O0 test.cc
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ test.cc /tmp/ccSyCC1a.ii
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3
 /usr/local/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../i686-pc-linux-gnu/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cc1plus /tmp/ccSyCC1a.ii -quiet -dumpbase test.cc -O0 -version -o /tmp/cchcjLzj.s
GNU C++ version 2.95.2 19991024 (release) (i686-pc-linux-gnu) compiled by GNU C version 2.95.2 19991024 (release).
 as -V -Qy -o /tmp/cccKEYwW.o /tmp/cchcjLzj.s
GNU assembler version 2.9.1 (i386-slackware-linux), using BFD version 2.9.1.0.25
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtbegin.o -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2 -L/usr/local/lib /tmp/cccKEYwW.o -lstdc++ -lm -lgcc -lc -lgcc /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtend.o /usr/lib/crtn.o
{montroll:58} ldd a.out
	libstdc++-libc6.1-2.so.3 => /usr/local/lib/libstdc++-libc6.1-2.so.3 (0x4001b000)
	libm.so.6 => /lib/libm.so.6 (0x4006d000)
	libc.so.6 => /lib/libc.so.6 (0x4008a000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
{montroll:59} a.out
Segmentation fault

Still with 2.95.2, but linking statically:

{montroll:63} g++ -O0 -v test.cc -static
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ test.cc /tmp/cc74Y2id.ii
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3
 /usr/local/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../i686-pc-linux-gnu/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cc1plus /tmp/cc74Y2id.ii -quiet -dumpbase test.cc -O0 -version -o /tmp/cc1iknGv.s
GNU C++ version 2.95.2 19991024 (release) (i686-pc-linux-gnu) compiled by GNU C version 2.95.2 19991024 (release).
 as -V -Qy -o /tmp/ccbHmnug.o /tmp/cc1iknGv.s
GNU assembler version 2.9.1 (i386-slackware-linux), using BFD version 2.9.1.0.25
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/collect2 -m elf_i386 -static /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtbegin.o -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2 -L/usr/local/lib /tmp/ccbHmnug.o -lstdc++ -lm -lgcc -lc -lgcc /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtend.o /usr/lib/crtn.o

{montroll:64} a.out
a=0,0

Now using egcs-1.1.2 (note that g++-2, not g++-3, is included)

{montroll:65} /usr/bin/g++ -O0 -v test.cc
Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
 /usr/lib/gcc-lib/i386-slackware-linux/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__ test.cc /tmp/ccGF6RQ8.ii
GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-2
 /usr/local/include
 /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/cc1plus /tmp/ccGF6RQ8.ii -quiet -dumpbase test.cc -O0 -version -o /tmp/cc1cJX3g.s
GNU C++ version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386-slackware-linux) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
 /usr/i386-slackware-linux/bin/as -V -Qy -o /tmp/ccsT6LyS.o /tmp/cc1cJX3g.s
GNU assembler version 2.9.1 (i386-slackware-linux), using BFD version 2.9.1.0.25
 /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/crtbegin.o -L/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66 -L/usr/i386-slackware-linux/lib /tmp/ccsT6LyS.o -lstdc++ -lm -lgcc -lc -lgcc /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/crtend.o /usr/lib/crtn.o

{montroll:66} a.out
a=0,0

{montroll:67} ldd a.out
	libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2 (0x4001b000)
	libm.so.6 => /lib/libm.so.6 (0x4005d000)
	libc.so.6 => /lib/libc.so.6 (0x4007a000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
{montroll:68} 

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

* Re: Strange g++ problem: HELP!
  2000-01-27  8:17 Strange g++ problem: HELP! David Ronis
@ 2000-01-27 12:52 ` David Eduardo Gomez Noguera
  0 siblings, 0 replies; 2+ messages in thread
From: David Eduardo Gomez Noguera @ 2000-01-27 12:52 UTC (permalink / raw)
  To: glibc-linux; +Cc: gcc, ronis

I have no idea, but did you added the new directories to ld.so.conf?
and ran ldconfig after that?

ld.so.conf is under /etc in redhat 6.1, maybe on slackware too.
and ldconfig under /sbin.
hope thats the problem, because if its not, i have no clue about it,

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

end of thread, other threads:[~2000-01-27 12:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-27  8:17 Strange g++ problem: HELP! David Ronis
2000-01-27 12:52 ` David Eduardo Gomez Noguera

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).