🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #121

Success compiling gcc-2.1 and libg++2.0 on SVR4

#121
From: Mark R. Rubin
Date: Wed, 08 Apr 1992 23:54
231 lines
8145 bytes
o I have succesfully compiled and run gcc-2.1 and libg++2.0 on my
  System V.4 machine.  I'm posting the following information because
  several people have requested it (including some I can't seem to
  reach via email).

o Most of these fixes have been posted before, as have different
  patches solving the same problems.  Again, I hope that some optimal
  set of solutions is included in future releases.

o Caveat Compilor:  So far, I have only run a "hello world" C++
  program with this system.

o Environment:
        Hardware:       "PC" clone, i486, EISA
        Operating Sys:  AT&T UNIX System V release 4,
        Reseller:       Micro Station Technology (MST)
	gcc:		2.1
        libg++:		2.0
        make:           GNU make
        configure:	"configure i386-sysv4"


o To fix aline errors compiling libg++-2.0/libg++/src/Regex.cc, apply
  the following patch to gcc-2.1/config/svr4.h.  This information was
  supplied by Robert Boucher.
----------------------8<---------cut here-----------8<-------------------------
*** config/svr4.h~	Wed Apr  1 18:20:24 1992
--- config/svr4.h	Wed Apr  1 18:42:05 1992
***************
*** 339,346 ****
  #define USE_CONST_SECTION	1
  
  #define CONST_SECTION_ASM_OP	".section\t.rodata"
! #define CTORS_SECTION_ASM_OP	".section\t.ctors,\"a\",@progbits"
! #define DTORS_SECTION_ASM_OP	".section\t.dtors,\"a\",@progbits"
  
  /* On svr4, we *do* have support for the .init section, and we can put
     stuff in there to be executed before `main'.  We let crtstuff.c and
--- 339,346 ----
  #define USE_CONST_SECTION	1
  
  #define CONST_SECTION_ASM_OP	".section\t.rodata"
! #define CTORS_SECTION_ASM_OP	".section\t.ctors,\"a\",@progbits\n"
! #define DTORS_SECTION_ASM_OP	".section\t.dtors,\"a\",@progbits\n"
  
  /* On svr4, we *do* have support for the .init section, and we can put
     stuff in there to be executed before `main'.  We let crtstuff.c and
----------------------8<---------cut here-----------8<-------------------------


o I also applied the following patch, posted by Michael Tiemann, to
  gcc-2.1/cp-cvt.c.  I don't think it directly impacts the SVR4
  compilation problems, but it sounded good. :-)
----------------------8<---------cut here-----------8<-------------------------
This patch fixes the bug where G++ goes into an infinite loop trying
to convert something to a reference type.  Please use this in
preference to other patches suggested for fixing this problem; they
steer around specific problems, but not the general one (and will lose
in the same way in other cases).

	* cp-cvt.c (convert_to_reference): Don't type to convert a type to
	itself.
	(build_type_conversion): Don't look for alternatives to default
	type conversion except to integral and real types.  Fixes bug
	exposed in 19 March change.

*** cp-cvt.c~	Mon Mar 23 08:42:02 1992
--- cp-cvt.c	Sun Mar 29 12:24:02 1992
*************** convert_to_reference (decl, reftype, exp
*** 481,485 ****
  	  return rval;
  	}
!       else if (rval = build_type_conversion (CONVERT_EXPR, type, expr, 1))
  	{
  	  if (rval == error_mark_node)
--- 481,486 ----
  	  return rval;
  	}
!       else if (type != intype
! 	       && (rval = build_type_conversion (CONVERT_EXPR, type, expr, 1)))
  	{
  	  if (rval == error_mark_node)
*************** build_type_conversion (code, xtype, expr
*** 1705,1709 ****
  
       */
!   if (type_default == type)
      {
        int not_again = 0;
--- 1706,1711 ----
  
       */
!   if (type_default == type
!       && (TREE_CODE (type) == INTEGER_TYPE || TREE_CODE (type) == REAL_TYPE))
      {
        int not_again = 0;
----------------------8<---------cut here-----------8<-------------------------


o To fix aline errors in libg++-2.0/libg++/iostream/stdstrbufs.C,
  apply the following patch (information provided by Gerry Toon):
----------------------8<---------cut here-----------8<-------------------------
*** ./libg++-2.0/libg++/iostream/ioconfig.h.orig	Sun Mar  1 22:13:05 1992
--- ./libg++-2.0/libg++/iostream/ioconfig.h	Wed Apr  1 22:12:15 1992
***************
*** 2,8 ****
  #define NAMES_HAVE_UNDERSCORE
  #endif
  
! #if defined(VMS) || defined(___IBMR2__) || defined(linux)
  #define NO_DOLLAR_IN_LABEL
  #endif
  
--- 2,8 ----
  #define NAMES_HAVE_UNDERSCORE
  #endif
  
! #if defined(VMS) || defined(___IBMR2__) || defined(linux) || defined(__i386__)
  #define NO_DOLLAR_IN_LABEL
  #endif
----------------------8<---------cut here-----------8<-------------------------


o Apply the following patch; otherwise any program linked with libg++
  gets an undefined symbol error on "__vt.filebuf":
----------------------8<---------cut here-----------8<-------------------------
*** ./libg++-2.0/libg++/iostream/stdstrbufs.C.orig	Sun Mar  1 17:17:14 1992
--- ./libg++-2.0/libg++/iostream/stdstrbufs.C	Sat Apr  4 12:28:20 1992
***************
*** 41,47 ****
  #define vt_filebuf __vtbl__7filebuf
  extern char vt_filebuf[1];
  #elif defined(NO_DOLLAR_IN_LABEL)
! extern char vt_filebuf[1] asm(UNDERSCORE "_vt.filebuf");
  #else
  extern char vt_filebuf[1] asm(UNDERSCORE "_vt$filebuf");
  #endif
--- 41,47 ----
  #define vt_filebuf __vtbl__7filebuf
  extern char vt_filebuf[1];
  #elif defined(NO_DOLLAR_IN_LABEL)
! extern char vt_filebuf[1] asm(UNDERSCORE "vt.filebuf");
  #else
  extern char vt_filebuf[1] asm(UNDERSCORE "_vt$filebuf");
  #endif
----------------------8<---------cut here-----------8<-------------------------


o Fix the following routines:
	stat()
	lstat()
	fstat()
	mknod()
  in stat.h in the gcc include/sys directory by adding:
	#if defined(__STDC__)
	<ANSI C version of the function>
	#else
	<original version of the function>
	#endif
  This information posted by Bernd Oerding.


o Edit libg++-2.0/libg++/g++-include/time.h to remove the definition
  of "timezone".  It is unused, and conflicts with the one in the gcc
  include/time.h file.


o Apply the following patches:
----------------------8<---------cut here-----------8<-------------------------
*** ./libg++-2.0/libg++/g++-include/unistd.h.orig	Wed Feb 26 12:37:01 1992
--- ./libg++-2.0/libg++/g++-include/unistd.h	Thu Apr  2 21:32:28 1992
***************
*** 30,36 ****
--- 30,38 ----
  unsigned  alarm(unsigned);
  int       brk(void*);
  int       chdir(const char*);
+ #ifndef USG
  int       chmod(const char*, int);
+ #endif
  int       chown(const char*, int, int);
  int       close(int);
  char*     crypt(const char*, const char*);
*** ./libg++-2.0/libg++/iostream/Makefile.orig	Thu Apr  2 20:39:01 1992
--- ./libg++-2.0/libg++/iostream/Makefile	Thu Apr  2 22:19:47 1992
***************
*** 42,48 ****
  
  SHELL = /bin/sh
  
! INSTALL = install -c
  INSTALL_PROGRAM = $(INSTALL)
  INSTALL_DATA = $(INSTALL)
  
--- 42,48 ----
  
  SHELL = /bin/sh
  
! INSTALL = cp
  INSTALL_PROGRAM = $(INSTALL)
  INSTALL_DATA = $(INSTALL)
  
***************
*** 171,177 ****
  	[ -d $(gxx_includedir) ] || mkdir $(gxx_includedir)
  	cd $(srcdir); \
  	for FILE in $(USER_INCLUDES) ; do \
! 		rm -f $(IDIR)/$$FILE ; \
  		$(INSTALL_DATA) $$FILE $(gxx_includedir)/$$FILE ; \
  	done
  
--- 171,177 ----
  	[ -d $(gxx_includedir) ] || mkdir $(gxx_includedir)
  	cd $(srcdir); \
  	for FILE in $(USER_INCLUDES) ; do \
! 		rm -f $(gxx_includedir)/$$FILE ; \
  		$(INSTALL_DATA) $$FILE $(gxx_includedir)/$$FILE ; \
  	done
----------------------8<---------cut here-----------8<-------------------------


o When compiling, add:

	XTRAFLAGS=-DUSG

  to your make command line.



MARK
mark@jpl-devvax.jpl.nasa.gov
Technical Details
Message-ID: <1992Apr8.235431.3154@jpl-devvax.jpl.nasa.gov>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!jpl-devvax.jpl.nasa.gov!mark

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!jpl-devvax.jpl.nasa.gov!mark
From: mark@jpl-devvax.jpl.nasa.gov (Mark R. Rubin)
Subject: Success compiling gcc-2.1 and libg++2.0 on SVR4
Message-ID: <1992Apr8.235431.3154@jpl-devvax.jpl.nasa.gov>
Sender: gnulists@ai.mit.edu
Organization: Jet Propulsion Laboratory (NASA)
Distribution: gnu
Date: Wed, 8 Apr 1992 23:54:31 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 232