🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #425

How to build gcc/libg++ on HP900/300/400, HPUX 8.0

#425
From: Michael Bryan
Date: Thu, 15 Oct 1992 07:16
160 lines
6022 bytes
In article <r*#@byu.edu> lee@bones.et.byu.edu (Bruce Lee) writes:
>Has anyone built libg++-2.2 on an HP9000/425E?  If so how?

This question gets asked enough, so I figured I'd post the following,
which describes what I did to get gcc 2.2.2 and libg++ 2.2 running
on an HP 9000/380 running HP-UX 8.0.  These instructions should work
for any 300 or 400 series HP.  If not, please let me know!

[Note:  Some of these changes are definitely hacks, in order to get
things to work under HP-UX, and will certainly break the code for
other systems.  I'll leave it to others to properly integrate these
changes into the general releases.]

========================================================================
Compiling gcc 2.2.2 on an HP 9000 (300 or 400 series), running HP-UX 8.0
========================================================================

You must obtain and install patch HPCO_0800.  Otherwise, gcc will make
it part way through the compilation process, and then croak.  The patch
is a correction to the exec() family of functions in libc.a, and replaces
/lib/libc.a, /lib/libc.sl, and /lib/libp/libc.a.

The following three files will not compile as shipped.  I've included
my rather crude hacks, which will break the files for other systems,
but do get it to work ok on the HP.  I assume that those working on
the next versions of gcc will work on getting proper corrections in the
code.

getpwd.c:
---------

[Comment out a block of code dealing with getwd/getcwd, and just replace
with a simpler version that's ok for HP-UX]

#ifdef DOESNT_WORK_FOR_HPUX

#if !(defined (POSIX) || defined (USG) || defined (VMS))
#include <sys/param.h>
extern char *getwd ();
#define getcwd(buf,len) getwd(buf)
#define GUESSPATHLEN (MAXPATHLEN + 1)
#else /* (defined (USG) || defined (VMS)) */
extern char *getcwd ();
/* We actually use this as a starting point, not a limit.  */
#define GUESSPATHLEN 100
#endif /* (defined (USG) || defined (VMS)) */

#endif  /* DOESNT_WORK_FOR_HPUX */

extern char *getcwd ();
/* We actually use this as a starting point, not a limit.  */
#define GUESSPATHLEN 100




toplev.c:
---------

[Add the following lines after the other #include lines:]

#include <sys/syscall.h>
#define getrusage(a, b)  syscall(SYS_GETRUSAGE, a, b)



cp-xref.c:
----------

[Comment out a block of code dealing with memory/string/strings,
and just replace with a simpler version that's ok for HP-UX]

#ifdef DOESNT_WORK_FOR_HPUX

#ifdef USG
#include <memory.h>
#include <string.h>
#define rindex strrchr
#else
#include <strings.h>
#endif

#endif /* DOESNT_WORK_FOR_HPUX */

#include <memory.h>
#include <string.h>
#define rindex strrchr



I *think* that's enough to get gcc to compile and install properly.
Oh yes.  Run configure as "configure --target=m68k-hp-hpux" to
get things initialized.  After all the above, you should be able
to build stage1, stage2 and stage3.  (Read the INSTALL file for
extended detail on how to do this.)  The .o files in stage2 and
stage3 should be identical; if not, you've got problems.  After
checking this, install it.  By default, it creates gcc, g++, c++
and gcc-m68k-hp-hpux as executables in /usr/local/bin, and puts
everything else in a heirarchy underneath the directory
/usr/local/lib/gcc-lib/m68k-hp-hpux/2.2.2.  (It also creates an
empty directory /usr/local/lib/gcc-lib/include, which is probably
an error, but certainly causes no harm.)


=========================================================================
Compiling libg++ 2.2 on an HP 9000 (300 or 400 series), running HP-UX 8.0
=========================================================================

Run configure as "configure m68k-hp-hpux", the same host
specification that was used for building gcc.

Edit libg++/Makefile, to pass on the definition of "INSTALL" to
submakes under the install: target.  The relevant code section
should look like this:

libg++/Makefile
---------------

	cd $(IO_DIR) ; $(MAKE) install-include-files "INSTALL=$(INSTALL)"
	@for D in genclass $(UTILS) ; do \
		if [ -d $$D ] ; then \
			(cd $$D; $(MAKE) "CC=$(CC)" install "INSTALL=$(INSTALL)") ; \
		fi ; \
	done


Edit libg++/utils/gen-params to fix a bug.  The relevant code
section should look like this:

libg++/utils/gen-parms
----------------------

  if test -n "${DOLLAR_IN_LABEL}" ; then
    echo "#define ${macro_prefix}DOLLAR_IN_LABEL ${DOLLAR_IN_LABEL}"
  elif test "`${CONFIG_NM} dummy.o | grep 'vt[$$]filebuf'`" != ""; then
    echo "#define ${macro_prefix}DOLLAR_IN_LABEL 1"
  elif test "`${CONFIG_NM} dummy.o | grep 'vt[.]filebuf'`" != ""; then
    echo "#define ${macro_prefix}DOLLAR_IN_LABEL 0"
  else
    echo "${CONFIG_NM} failed to find vt[.\$]filebuf in dummy.o!" 1>&2; exit 1
  fi


Run the initial make with the command "make CC=gcc", or the equivalent
for what is necessary to run your version of gcc.  The makefile does
not properly detect gcc when it needs to use it, so just use it for
everything.

To install libg++, use the command "make CC=gcc INSTALL=cp".  The
'install' program shipped with HP-UX does not have the same syntax
as what the makefiles expect, and cannot be used.


==========================================================================

-- 
Michael Bryan  michael@resonex.com  "Milk and Cheese in '92!"  |     ,_,
                                                               |    /oo \
"I'd like to thank everyone who touched me this year."         |    <>__|
    --- Bill Clinton, 10/11/92 Presidential Debate             |    |  U|
Technical Details
Message-ID: <1992Oct15.071610.2828@resonex.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!amdahl!amdcad!netcomsv!resonex!michael
References: <r*#@byu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!amdahl!amdcad!netcomsv!resonex!michael
From: michael@resonex.com (Michael Bryan)
Newsgroups: gnu.g++.help
Subject: How to build gcc/libg++ on HP900/300/400, HPUX 8.0
Message-ID: <1992Oct15.071610.2828@resonex.com>
Date: 15 Oct 92 07:16:10 GMT
References: <r*#@byu.edu>
Organization: Resonex Inc., Sunnyvale CA
Lines: 160