*BSD News Article 22976


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!vixen.cso.uiuc.edu!uwm.edu!cs.utexas.edu!swrinde!emory!sol.ctr.columbia.edu!caen!batcomputer!cornell!cchase
From: cchase@cs.cornell.edu (Craig Chase)
Subject: Re: [NetBSD 0.9] - gnu-emacs compile? HELP!
Message-ID: <1993Oct28.133022.21291@cs.cornell.edu>
Organization: Electrical Engineering, Cornell University, Ithaca NY
References: <Added.wgnOLbG00Udb8QbU5N@andrew.cmu.edu>
Date: Thu, 28 Oct 1993 13:30:22 GMT
Lines: 130

Todd.Williamson@IUS4.IUS.CS.CMU.EDU writes:

>Okay.  This may be a FAQ, but I've looked at all of the FAQ's I can think to
>look at, and the PROBLEMS file that comes with the distribution, and I still
>can't get it to work.

>I'm running NetBSD 0.9 on a 486DX266 motherboard.  I downloaded the 19.19
>gnu-emacs distribution from prep.ai.mit.edu.  I ran 
>"configure i386-foo-386bsd", then gmake MAKE=gmake, then I had to fix
                                                                   ^^^

not sure what happened to you here, I don't remember having any
trouble at this point.  Well, except that you need to use gmake, the
Berkeley make chokes.  'gmake MAKE=gmake' is not just a good idea. 

>temacs runs fine, but the file that gets dumped as emacs isn't an
>executable (it gives me the error "emacs: 1: Syntax error: word
>unexpected (expecting ")")").

This is caused (I think) by the changes the NetBSD people made to the
exec header for version 0.9.  I was amazed that there was not a patch
available at the time that I was compiling emacs and hacked it myself.
I tried to send patches to the netbsd folks at agate, but I seem to
have a write-only connection to their mailboxes.  I figure I must be
doing something wrong (sending to the wrong address, or whatever?).

Anyway I hacked src/unexec.c to make it work, diffs to follow.
NOTE: I hacked this unmercifully, since I didn't really know what I
was doing anyway.  I was hoping (and still do) that someone who
understands why this is really broken would fix it.  In the hope that
it will be useful, here's the ugly hack to src/unexec.c

*** ./src/unexec.c.dist Sun Aug 15 00:35:17 1993
--- ./src/unexec.c      Wed Sep 29 10:56:12 1993
***************
*** 849,859 ****
  #ifdef A_TEXT_SEEK
    lseek (new, (long) A_TEXT_SEEK (hdr), 0);
  #else
!   lseek (new, (long) N_TXTOFF (hdr), 0);
  #endif /* no A_TEXT_SEEK */
  
!   ptr = (char *) unexec_text_start;
!   end = ptr + hdr.a_text;
    write_segment (new, ptr, end);
  
    ptr = (char *) unexec_data_start;
--- 849,865 ----
  #ifdef A_TEXT_SEEK
    lseek (new, (long) A_TEXT_SEEK (hdr), 0);
  #else
!   lseek (new, (long) N_TXTOFF (hdr)
!        + sizeof(hdr)   /* FIXME and delete this line!!! */
!        , 0);
  #endif /* no A_TEXT_SEEK */
  
!   ptr = (char *) unexec_text_start
!       + sizeof(hdr)    /* FIXME and delete this line!!! */
!       ;
!   end = ptr + hdr.a_text
!          - sizeof(hdr)   /* FIXME and delete this line!!! */
!          ;
    write_segment (new, ptr, end);
  
    ptr = (char *) unexec_data_start;


# end of patch

Oh, I also hacked src/s/386bsd.h a little bit... here's the diffs
between 386bsd.h and my netbsd.h


*** src/s/386bsd.h      Sun Aug 15 00:33:00 1993
--- src/s/netbsd.h      Wed Sep 29 10:45:39 1993
***************
*** 1,15 ****
! /* s/ file for 386bsd system.  */
  
  /* Get most of the stuff from bsd4.3 */
  #include "bsd4-3.h"
  
  #undef LIB_STANDARD
  #define LIB_STANDARD -lc $(GNULIB_VAR)
  
  /* The following should be set to /netbsd if you are running netbsd > 0.8 
     Or just link /netbsd -> /386bsd  */
  #undef KERNEL_FILE
! #define KERNEL_FILE "/386bsd"
  
  #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
  
--- 1,19 ----
! /* s/ file for netbsd system.  */
! /* adapted from 386bsd.h on 9/28/93 by C. Chase */
  
  /* Get most of the stuff from bsd4.3 */
  #include "bsd4-3.h"
  
+ #undef TEXT_START
+ #define TEXT_START 0x1000
+ 
  #undef LIB_STANDARD
  #define LIB_STANDARD -lc $(GNULIB_VAR)
  
  /* The following should be set to /netbsd if you are running netbsd > 0.8 
     Or just link /netbsd -> /386bsd  */
  #undef KERNEL_FILE
! #define KERNEL_FILE "/netbsd"
  
  #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)




# end of patch

If you can't compile this, let me know, send mail to
chase@pine.ece.utexas.edu and I'll post my NetBSD binary

orac> file /usr/local/bin/emacs
/usr/local/bin/emacs: sticky netbsd/i386 demand paged executable
orac> 

-- Craig
-- 
"They [La Prensa] accused us of suppressing freedom of
 expression.  This was a lie and we could not let them
 publish it."
 - Nelba Blandon, Interior Ministry Director of Censorship, quoted in