public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Help needed with GCC 2.95.3 on Redhat 8 -- segfault
@ 2003-01-28 15:07 Philip George
  2003-01-29 10:49 ` GCC 2.95.3 on Redhat 8 -- more problems Philip George
  0 siblings, 1 reply; 2+ messages in thread
From: Philip George @ 2003-01-28 15:07 UTC (permalink / raw)
  To: gcc-help

I have a really irritating problem with GCC 2.95.3 on Redhat 8.

I have compiled and installed binutils 2.12 and GCC 2.95.3 on a Redhat 
6.2 (default compiler egcs2.91.66) and a Redhat 8 (default compiler
gcc3.2) box.

I would like to run this simple program:

// phil.cc
#include <stdio.h>
int main(void) {
    FILE *fr=freopen("blib","r",stdin);
    printf("Success\n");
    return 1;
}

On Redhat 6.2, this happens:
% g++ phil.cc -o phil
% phil
Success
      (good!)

On Redhat 8, this happens:
% g++ phil.cc -o phil
% phil
Segmentation fault

Why does it segfault with the GCC I've built on RH8, but work fine with
RH6.2?

Ldd reveals this...

% ldd phil
	libstdc++-libc6.3-2.so.3 =>
/usr/installed/gcc2.95.3/lib/libstdc++-libc6.3-2.so.3 (0x40013000)
	libm.so.6 => /lib/i686/libm.so.6 (0x40070000)
	libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

(
 On the RH 6.2 box, on which it runs successfully, I get...
	libstdc++-libc6.1-2.so.3 =>
/installed/gcc-2.95.3/lib/libstdc++-libc6.1-2.so.3 (0x40015000)
	libm.so.6 => /lib/libm.so.6 (0x40068000)
	libc.so.6 => /lib/libc.so.6 (0x40085000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
)

If I instead try to build it as a C program, ie.
% gcc phil.cc -o phil
...  then it works fine.

What on earth could be going wrong?  I'd thought that perhaps the
libraries might be out of sync but I can't think how or why that would be
the case.

On the Redhat 8 box we also have a GCC 3.2 compiler installed.  But I've
made sure that the GCC2.95.3 installation directory appears at the
beginning of my $PATH and $LD_LIBRARY_PATH to make sure it's picking up
the correct one.

(FYI, ldd on the working 'gcc'-compiled version gives...
	libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
)

Can anyone help?  (please!)

phil

-- 
Phil George, Anvil Software Ltd.
email: philg@anvil.com
phone: 020 7749 7922

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

end of thread, other threads:[~2003-01-29 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-28 15:07 Help needed with GCC 2.95.3 on Redhat 8 -- segfault Philip George
2003-01-29 10:49 ` GCC 2.95.3 on Redhat 8 -- more problems Philip George

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