[gnu.g++] G++ 1.32 on SUN 3/60 running SunOS 4.0.1

frodo%cadillac.cad.mcc.com@MCC.COM (02/11/89)

Greetings,

I have been trying to install G++ version 1.32 on a SUN 3/60 running
SunOS 4.0.1 and have been having a little bit of trouble.  I was curious
if anyone else has had problems similar to mine and if there are fixes available.

I will try to be as terse as possible so if I miss anything ask for clarification.

I obtained G++ from MCC -- version 1.32 of GCC & G++ with patches.  I
installed GCC as directed except that I installed it using
/usr/local/PD/lib instead of /usr/local/lib.  All works fine with GCC.

I installed G++ as directed using /usr/local/PD/lib.  This required a
small change to ld.c (shown at the bottom of this message).  The only
problem I had, really, was compiling builtin.cc: the "-fmemoize-lookups
-fsave-memoized" flags caused c++ to core dump so I removed them and all
seemed to go well.  I didn't look v. hard but I cdnt. find doc. on these
flags (optimisation measures, I presume).

The G++ library compiled fine and I installed that.

I had trouble getting G++ to compile any of the test cases from the
library because the "-e start" parameter to the loader was not
recognized properly.  After some looking I changed the LINK_SPEC to use
"-e __start".  I since then received a fix from the net that said to
remove the "-e" option altogether -- this also works.  This sort of
solved the problem but programs compiled with G++ would still core dump
on execution.  I examined (Sun's) cc -v on some files and found that
various floating point libraries were -L included.  I changed the
tm-sun3.h to reflect this (the diffs are at the end of this message).
Programs compiled but still core dumped.  Using gdb+ I examined test4
and here is the backtrace:

    (gdb+) run
    Starting program: /usr/local/PD/src/gcc/libg++-1.32.0/test4

    Program received signal 11, Segmentation fault
    istream_PSistream_PS_iobuf ($this=(struct istream *) 0x20064, fileptr=(struct _i
    obuf *) 0x20338) (stream.cc line 74)
    74      }

Here is a little more of stream.cc (in case yours differs):

    istream::istream(FILE* fileptr)
    :(fileptr) 
    { 
      tied_to = 0;
    }				<=== line 74


So, my guess was that the constructors were not getting called properly
or that something was wrong with crt0+.o.

Have you a fix for this?  I heard that g++ 1.33 will be out soon -- is
this true?  I also want to express my thanks for GCC/G++ as they are
both v. useful.  If you need more info write or call.


David Fletcher, NCR Microelectronics
2001 Danfield Court,
Ft. Collins, CO 80525	  |	"... Let everything else go ..."
(303) 223-5100 x 241	  |			-- Phil Keaggy


Diffs
=======================================================================

diff ../dist-g++/ld.c ld.c
*** ../dist-g++/ld.c	Sat Dec 10 16:51:48 1988
--- ld.c	Fri Feb  3 15:58:45 1989
***************
*** 438,455 ****
  /* 1 => assign space to common symbols even if `relocatable_output'.  */
  int force_common_definition;
  
  #ifndef DEFAULT_SEARCH_PREFIX
  #define DEFAULT_SEARCH_PREFIX
  #endif
  
! /* Standard directories to search for files specified by -l.  */
! #ifdef hp9000s300
!   /* hp-ux has special path since it's a.out format is not the same as gnu */
  char *standard_search_dirs[] = {"/usr/local/lib/gnu",DEFAULT_SEARCH_PREFIX};
! #else
! char *standard_search_dirs[] = {"/lib", "/usr/lib", "/usr/local/lib",
! DEFAULT_SEARCH_PREFIX};
! #endif
  
  /* Actual vector of directories to search;
     this contains those specified with -L plus the standard ones.  */
--- 438,467 ----
  /* 1 => assign space to common symbols even if `relocatable_output'.  */
  int force_common_definition;
  
+ /* Standard directories to search for files specified by -l.  */
+ /* David Fletcher, Feb 3, 1989.  Changed since /usr/local/lib gets
+  * searched before the DEFAULT_SEARCH_PREFIX.  Altered the order
+  * for these...
+  */
+ 
+ #ifdef hp9000s300
+ 
  #ifndef DEFAULT_SEARCH_PREFIX
  #define DEFAULT_SEARCH_PREFIX
  #endif
  
! /* hp-ux has special path since it's a.out format is not the same as gnu */
  char *standard_search_dirs[] = {"/usr/local/lib/gnu",DEFAULT_SEARCH_PREFIX};
! 
! #else /* not hp9000s300 */
! 
! #ifndef DEFAULT_SEARCH_PREFIX
! char *standard_search_dirs[] = {"/lib", "/usr/lib", "/usr/local/lib"};
! #else /* DEFAULT_SEARCH_PREFIX already defined... */
! char *standard_search_dirs[] = {"/lib", "/usr/lib", DEFAULT_SEARCH_PREFIX, "/usr/local/lib"};
! #endif /* DEFAULT_SEARCH_PREFIX stuff */
! 
! #endif /* search paths established... */
  
  /* Actual vector of directories to search;
     this contains those specified with -L plus the standard ones.  */


(I removed the original tm-sun3+.h so I used gcc's tm-sun.h as the base..)
diff -c ../dist-gcc/tm-sun3.h tm-sun3.h
*** ../dist-gcc/tm-sun3.h	Fri Jan  6 07:57:05 1989
--- tm-sun3.h	Fri Feb  3 19:50:10 1989
***************
*** 77,100 ****
  /* -mfpa is the default */
  #define STARTFILE_SPEC					\
    "%{pg:gcrt0+.o%s}%{!pg:%{p:mcrt0+.o%s}%{!p:crt0+.o%s}}	\
!    %{m68881:Mcrt1.o%s}					\
!    %{msoft-float:Fcrt1.o%s}				\
!    %{!m68881:%{!msoft-float:Wcrt1.o%s}}"
  #else
  #if TARGET_DEFAULT & 2
  /* -m68881 is the default */
  #define STARTFILE_SPEC					\
    "%{pg:gcrt0+.o%s}%{!pg:%{p:mcrt0+.o%s}%{!p:crt0+.o%s}}	\
!    %{mfpa:Wcrt1.o%s}					\
!    %{msoft-float:Fcrt1.o%s}				\
!    %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
  #else
  /* -msoft-float is the default */
  #define STARTFILE_SPEC					\
    "%{pg:gcrt0+.o%s}%{!pg:%{p:mcrt0+.o%s}%{!p:crt0+.o%s}}	\
!    %{m68881:Mcrt1.o%s}					\
!    %{mfpa:Wcrt1.o%s}					\
!    %{!m68881:%{!mfpa:Fcrt1.o%s}}"
  #endif
  #endif
  
--- 77,100 ----
  /* -mfpa is the default */
  #define STARTFILE_SPEC					\
    "%{pg:gcrt0+.o%s}%{!pg:%{p:mcrt0+.o%s}%{!p:crt0+.o%s}}	\
!    %{m68881:Mcrt1.o%s -L/usr/lib/f68881}					\
!    %{msoft-float:Fcrt1.o%s -L/usr/lib/fsoft}				\
!    %{!m68881:%{!msoft-float:Wcrt1.o%s -L/usr/lib/ffpa}}"
  #else
  #if TARGET_DEFAULT & 2
  /* -m68881 is the default */
  #define STARTFILE_SPEC					\
    "%{pg:gcrt0+.o%s}%{!pg:%{p:mcrt0+.o%s}%{!p:crt0+.o%s}}	\
!    %{mfpa:Wcrt1.o%s -L/usr/lib/ffpa}					\
!    %{msoft-float:Fcrt1.o%s -L/usr/lib/fsoft}				\
!    %{!mfpa:%{!msoft-float:Mcrt1.o%s -L/usr/lib/f68881}}"
  #else
  /* -msoft-float is the default */
  #define STARTFILE_SPEC					\
    "%{pg:gcrt0+.o%s}%{!pg:%{p:mcrt0+.o%s}%{!p:crt0+.o%s}}	\
!    %{m68881:Mcrt1.o%s -L/usr/lib/f68881}					\
!    %{mfpa:Wcrt1.o%s -L/usr/lib/ffpa}					\
!    %{!m68881:%{!mfpa:Fcrt1.o%s -L/usr/lib/fsoft}}"
  #endif
  #endif