[comp.sys.sun] Building GNU EMACS 18.55 on Sparc Sunos4.1

rmitch@irus.rri.uwo.ca (Ross Mitchell) (07/10/90)

I'm having problems getting EMACS 18.55 to run on our sparc (sunos 4.1).
I am doing "make" and "make install" from the EMACS root directory. No
errors occur. Everything gets compiled ok, the executables get created,
and put in the right place. However, when I try to execute "emacs" I get
the following error message:

	>Fatal error (6).Abort (core dumped)

I have modified src/config.h so that it contains the following lines:

   #define HAVE_SUN_WINDOWS /* I added this, it precedes the next 2 lines */
   #include "s-sunos4.h"    /* s-bsd4-2.h and s-bsd4-3.h don't work either */
   #include "m-sparc.h"

to define our environment.  Has anyone built GNU EMACS 18.55 so that it
executes in this type of environment? If so, what (if anything) did they
do to get it to run?

Please mail your replies to me at:

	rmitch@irus.rri.uwo.ca

Thanks very much

Ross Mitchell, Imaging Research Lab, |   rmitch@irus.rri.uwo.ca
John P. Robarts Research Institute   |
P.O. Box 5015, 100 Perth Drive       |   office: (519) 663-3833
London, Ontario, Canada  N6A 5K8     |   home: (519) 657-4437

peter_colby@viewlogic.com (07/17/90)

In SunSpots Digest  v9n254 Ross Mitchell writes
> 	I'm having problems getting EMACS 18.55 to run on our sparc (sunos 4.1).
> I am doing "make" and "make install" from the EMACS root directory. No
> errors occur. Everything gets compiled ok, the executables get created,
> and put in the right place. However, when I try to execute "emacs" I get
> the following error message:
> 
> 	>Fatal error (6).Abort (core dumped)

This problem is known to Sun and the solution was published in Sun's
Software Technical Bulletin of either March or April 1990.

In src/config.h add the line

#define SYSTEM_MALLOC

I had the same problem and this fixed it.  NOTE: I am now running
Epoch-3.2b and I noticed that I did NOT include this define in
src/config.h for epoch yet epoch built and runs fine.

	Peter Colby
	peter@viewlogic.com

martin@verdelait.canada.sun.com (Martin Leclerc SE Sun Montreal) (07/20/90)

The problems you described have been documented in gnu.emacs.bug.  Here is
a summary posting from that group.

>From fmbutt@mrbt.sw.stratus.com Mon Jul  2 20:28:40 1990
>Subject: Re: emacs on SUN o/s 4.1 malloc bug
>
>In article <9006270051.AA01989@design.caltech.edu> you write:
>We have found that emacs 18.55 won't run on a SUN Sparc machine,
>...
>please let me know when/if you figure out a good solution to the 
>malloc problem (i.e. get the GNU malloc to work). I also had to 
>#define SYSTEM_MALLOC to get gnuemacs to work....

I am including (below) a response that we previously got to our inquiry.
We have implemented this change on both SUN3 and SPARC systems running sun
o/s 4.1 (emacs 18.55) with success.  We NO LONGER define SYSTEM_MALLOC
(and hence use the gnu malloc).  I created a new s-sunos4.1.h (that I
include instead of s-sunos4.h in ./src/config.h):

----- Beginning of s-sunos4.1.h -----

#include "s-bsd4-2.h"

/* Say that the text segment of a.out includes the header;
   the header actually occupies the first few bytes of the text segment
   and is counted in hdr.a_text.  */

#define O_NDELAY        FNDELAY /* Non-blocking I/O (4.2 style) */
#define LD_SWITCH_SYSTEM -e __start -Bstatic

/* Include this definition for sun o/s 4.1  E.Antonsson, Caltech, 26-Jun-90 */
/* #define SYSTEM_MALLOC */
#define SUNOS_LOCALTIME_BUG
----- End of s-sunof4.1.h -----
See below:

-erik

----- Begin Included Message -----

X-Subject: emacs on SUN o/s 4.1 malloc bug

>    Is this the correct fix for the problem?

The correct fix for the problem is up to Sun; there is a SunOS library
function in localtime.o which requests eight bytes from malloc and writes
the ninth.  The enclosed patch is a workaround which allows you to use GNU
malloc instead of SunOS malloc.


*** malloc.c~	Fri Apr  7 22:12:10 1989
--- malloc.c	Tue May  8 07:07:22 1990
***************
*** 476,482 ****
--- 476,487 ----
       multiple of 8, then figure out which nestf[] area to use.
       Both the beginning of the header and the beginning of the
       block should be on an eight byte boundary.  */
+ #ifdef SUNOS_LOCALTIME_BUG
+   /* SunOS 4.1 localtime scribbles on the ninth byte.  */
+   nbytes = (n + ((sizeof *p + 15) & ~15) + EXTRA + 15) & ~15;
+ #else
    nbytes = (n + ((sizeof *p + 7) & ~7) + EXTRA + 7) & ~7;
+ #endif
    {
      register unsigned int   shiftr = (nbytes - 1) >> 2;

Martin Leclerc			Martin.Leclerc@Canada.sun.com 
System Engineer			(514) 744-9240
Sun Microsystems Canada