Subject: bug#821: 23.0.60; bootstrap fails due to define-minor-mode in textmode/paragraphs.el

From: Ted Zlatanov <[email-masked]>
Date: Wed, 03 Sep 2008 16:09:15 -0500

The following message is a courtesy copy of an article
that has been posted to gnu.emacs.bug as well.

On Wed, 03 Sep 2008 14:04:00 -0400 Glenn Morris <[email-masked]> wrote: 

GM> Ted Zlatanov wrote:
TZ> Loading textmodes/paragraphs.el (source)...
TZ> Attempt to autoload define-minor-mode while preparing to dump

GM> Your specific problem is that textmodes/paragraphs.el has not been
GM> byte-compiled as it should have been. Can you look into why?

I set up a new user with a clean environment, using bash:

SHELL=/bin/bash
TERM=xterm
USER=lank
MAIL=/var/mail/lank
PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
PWD=/home/lank/emacs/lisp
LANG=en_US.UTF-8
HISTCONTROL=ignoreboth
SHLVL=1
HOME=/home/lank
LOGNAME=lank
LESSOPEN=| /usr/bin/lesspipe %s
LESSCLOSE=/usr/bin/lesspipe %s %s
OLDPWD=/home/lank/emacs
_=/usr/bin/env

Uninstalled and reinstalled many Debian packages:

Removed: apel bbdb bzr-builddeb caspar cvs-autoreleasedeb cvs-buildpackage debhelper devscripts dpkg-dev eclipse-cdt elib elscreen erc git-buildpackage linda lintian maemo-sdk mailcrypt make oneliner-el oo-browser rtai rtai-source
Removed: g++ gcc gcc-multilib ghc6 hmake
Removed: cedet-common cedet-contrib cogre crypt++el css-mode ecb ede eieio emacs emacs-goodies-el emacs-snapshot-bin-common emacs-snapshot-common emacs-snapshot-el emacs21 emacs21-bin-common emacs21-common emacs22 emacs22-bin-common emacs22-common emacs22-el emacs22-gtk emacsen-common erlang-mode gnuserv haskell-mode html-helper-mode lua-mode muse-el nethack-el nxml-mode planner-el remember-el ruby-elisp ruby1.8-elisp semantic slime speedbar tramp w3m-el x-face-el xemacs21 xemacs21-bin xemacs21-mule xemacs21-support xemacs21-supportel
Removed: autoconf automake automake1.9 autoproject

Installed: make 3.81-3build1
Installed: g++/gcc 4:4.2.3-1ubuntu6
Installed: autoconf 2.61-4, automake 1:1.10.1-2

Now, I did a CVS checkout of Emacs to an empty directory.

`./configure' works.
`make':

...
Dumping under the name emacs
73478 pure bytes used
mv -f emacs bootstrap-emacs
cd ../lisp; make -w compile-first EMACS=../src/bootstrap-emacs
make[2]: Entering directory `/home/lank/emacs/lisp'
make[2]: *** No rule to make target `/home/lank/emacs/lisp/emacs-lisp/bytecomp.elc', needed by `compile-first'.  Stop.
make[2]: Leaving directory `/home/lank/emacs/lisp'
make[1]: *** [bootstrap-emacs] Error 2
make[1]: Leaving directory `/home/lank/emacs/src'
make: *** [src] Error 2

If I do another `make' at this point it goes on to the next problem
(textmode autoloads).  I don't think the bytecomp breakage was happening
before.

I wanted to investigate this one as it seemed related to the byte-compile
issues.  This file (bytecomp.el) is mentioned in COMPILE_FIRST and in
ELCFILES; this may bring us back to why ELCFILES is not picked up
correctly.  So:

I ran this manually under lisp/ (discovering which files were needed by
`make -w compile-first'):

../src/bootstrap-emacs --batch --eval '(byte-compile-file "emacs-lisp/bytecomp.el")'
../src/bootstrap-emacs --batch --eval '(byte-compile-file "emacs-lisp/byte-opt.el")'
../src/bootstrap-emacs --batch --eval '(byte-compile-file "emacs-lisp/autoload.el")'

Then `make -w compile-first' did not complain, and ran cleanly.  Now I
went back to the base emacs directory and did another `make'.

The bootstrap completed:

...
Dumping under the name emacs
1246848 pure bytes used
Adding name emacs-23.0.60.1
ln -f emacs bootstrap-emacs
...

But then again ELCFILES broke things:

...
Compiling /home/lank/emacs/lisp/bs.el
Wrote /home/lank/emacs/lisp/bs.elc
make[1]: *** No rule to make target `/home/lank/emacs/lisp/calc/calc-aent.elc', needed by `compile-main'.  Stop.
make[1]: Leaving directory `/home/lank/emacs/lisp'
make: *** [lisp] Error 2

This is fixed by clearing ELCFILES manually.  I get many warnings like
this:

Maintainer warning: $(lisp)/epa-dired.el missing from $ELCFILES?
Compiling /home/lank/emacs/lisp/epa-dired.el

for every ex-ELCFILES file.

I saw one more failure:

...
make[1]: *** No rule to make target `/home/tzz/source/emacs/leim/ja-dic/ja-dic.elc', needed by `all'.  Stop.
make[1]: Leaving directory `/home/tzz/source/emacs/leim'
make: *** [leim] Error 2

but running `make' again gets it done and the build can proceed to a
semi-glorious resolution.

The root of all these problems seems to be Make itself.  Unfortunately,
my questions to the Make mailing lists have not been answered by any of
the developers or users.

I may still reinstall the system for unrelated reasons, but I'd like to
find out what's really going on.  It's unpleasant to fight against the
build process so hard.

Ted