From: "Mark W. Eichin" <eichin@cygnus.com>
Subject: re: perl 4.035 and Cygnus gcc on Solaris 2.x
Reply-To: eichin@cygnus.com
Organization: The Internet
Date: Sat, 7 Nov 1992 07:07:10 GMT

   SUB: perl 4.035 and Cygnus gcc on Solaris 2.x
   SUM: dana@dino.bellcore.com (Dana A. Chee), dana@thumper.bellcore.com->Perl-Users@fuggles.acc.Virginia.EDU

   Has anyone gotten perl 4.035 to build with Cygnus gcc on Solaris 2.x
   (Sparc).  I tried by choosing the solaris hints and gcc as my
   compiler.  Right off the bat, it complained that sprintf and malloc had
   conflicting declarations.  Before I start hacking in uncharted turf,
   I'd like to know if anyone else has already been there.

   Thanks,
   -- 

Here's the email I sent out back when we first released the Solaris
2.0 port of gcc. It worked fine; the one problem you may be having is
that you're actually using the solaris hints file -- I'd guess that
it's wrong, I didn't use it.
	Hope you find this information useful (especially now that the
CDware CDrom mentioned below is actually available.)
					_Mark_ <eichin@cygnus.com>
					Cygnus Support
					One Kendall Square
					Cambridge, MA 02138 (617)494-1068

:Date: Thu, 23 Jul 92 15:53:34 EDT
:From: "Mark W. Eichin" <eichin@cygnus.com>
:Message-Id: <9207231953.AA29421@tweedledumber.cygnus.com>
:To: Perl-Users@fuggles.acc.Virginia.EDU
:Subject: re: Perl "patches" for solaris 2.0
:Summary: works fine with gcc

Briefly:
	I just built perl-4.035 with the recently released GNU C for
Solaris 2. It built at -g -O and passed all tests. I basically
left everything at the default values (including "none" for the hints
file, and "y" for "are the system libraries compiled with gcc" since
that doesn't matter on the sparc w/gcc2.) Be sure to take -lmalloc out
of the libraries list (and add -lm -- there is one supplied with gcc.)
	Cygnus Support and the Free Software Foundation have ported
the GNU C Compiler and GNU Debugger to Sun's Solaris-2 operating
system. It is available via ftp, uucp, on tape, and will be out later
this year on the SunSoft Catalyst CDware(tm) Volume 4 disc. More
detailed information on obtaining the GNU C Compiler and support for
it are included at the end of this posting.

					_Mark_ <eichin@cygnus.com>
					Cygnus Support
					One Kendall Square
					Cambridge, MA 02138 (617)494-1068

============================================================================
Detailed answers:

	I made a few tweaks which probably ought to be integrated into
the main release:
	1) I fixed a few places which called echo $n $rp to call
$echo; turns out that /bin/echo supports \c but not -n, while the
builtin sh echo supports -n but not \c -- so you can't "fall back" to
\c when they disagree...
		$ echo foo \\c
		foo \c
		$ /bin/echo foo \\c     
		foo $ echo -n foo
		foo$ /bin/echo -n foo
		-n foo
Having it not fall back but simply use different options for different
echos is probably enough.
	2) I cut out the case that adds -D__GNUC__ to the CFLAGS (gcc
flamed (warned) about the redefinition.)
	3) I changed the memcpy and memset declarations in perl.h to
say void* instead of char*. This should probably be conditionalized.

	I also did a few things specific to working with gcc:
	1) I told it to use gcc.
	2) I told it to use -g -O (-g first, so it threw in -DDEBUGGING)
	3) At the libraries line, it found -lsocket -lnsl -lmalloc.
The first two are ok; -lmalloc *IS BROKEN*. It gets you
/usr/ccs/lib/libmalloc.a, which only gives back 4-byte aligned data.
Under Solaris 2, doubles need to be aligned to 8-bytes... the man page
indicates:
|     Each of the allocation routines returns a pointer  to  space
|     suitably  aligned  (after  possible  pointer  coercion)  for
|     storage of any type of object.
but the libmalloc.a version does not comply. (This may be a cause of
the optimizer related bugs seen in util.c, since that's the first
place it does a double store...)

	Additionally, since we have the SUNWste C compiler as well, I
tweaked the Configure script to look at /opt/cygnus/bin before
/usr/ccs/bin, and *not* to look in /opt/SUNWste/bin so that it didn't
use the commercial compiler. This was only necessary in order to make
sure that it would work for someone who had GCC and didn't have the
non-free compiler.
Newsgroups: comp.lang.perl