Subject: emacs in pkgsrc not building
To: None <current-users@NetBSD.ORG>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: current-users
Date: 10/16/1997 00:24:58
As I said before, I'm not able to get emacs running by building it from
the newly-committed package stuff:

	./temacs -batch -l loadup dump
	*** Signal 11

	Stop.

According to gdb, it is crashing in __start, and never gets into main().
The stack is strange; it appears that there are three extra zero words
between argc/argv/envp as passed to __start and the return address __start
sees (0x1071).  Interestingly, ___ps_strings contained 0.

One semi-obvious way for this to happen was for start to get called
reentrantly, or so I thought; I then came up with a customized version of
crt0.c which tests the value of ___ps_strings and does int3 (x86 software
interrupt) if it is nonzero.  I build emacs with my local crt0.o, and then
watch it happily compile lisp source into lisp binary ready for dumping.

Huh?

I then observe that my crt0.o is about 3300 bytes long; /usr/lib/crt0.o is
2817.  Looking VERY carefully at the c-runtime makefiles and my hand-typed
compile line, I discover that I left off two flags:  -O and -DLIBC_SCCS.
I recompile crt0.o with -O.  *It works fine.*  I recompile it with -DLIBC_SCCS.
*** Signal 11.

Unfortunately, I can't get gdb to set a breakpoint in __start.  (Why is
that???)  I will dig a little deeper into this tomorrow when I'm more awake,
but I'm hoping someone will intuit exactly what has to be wrong just from
ths description.

(Could someone else with an x86 try to build emacs from the pkgsrc directory
to see if this is reproducible?)