title: Recipe for target `autoloads' failed while building Emacs in Cygwin
body: <p>I am trying to build Emacs on 64-bit Windows 7 using Cyqwin:</p>
  
  <p>Emacs 23.3 or 23.4</p>
  
  <p>CYGWIN_NT-6.1-WOW64 1.7.11(0.260/5/3) 2012-02-24 14:05 i686 Cygwin</p>
  
  <p>Some info from ./configure log:</p>
  
  <pre><code>    What compiler should emacs be built with?    
      gcc -g -O2 -Wdeclarati
      What operating system and machine description files should Emacs use?
      `s/cygwin.h' and `m/intel386.h'
  </code></pre>
  
  <p>I am able to create Makefile without problems. However, if I run make procedure, it is building for couple of minutes then, in certain point, it gets stuck for 2 minutes and then produces error:</p>
  
  <pre><code>Makefile:149: recipe for target `autoloads' failed
  make[2]: *** [autoloads] Interrupt
  Makefile:198: recipe for target `/cygdrive/c/emacs-23.3/src/../lisp/loaddefs.el' failed
  make[1]: *** [/cygdrive/c/emacs-23.3/src/../lisp/loaddefs.el] Interrupt
  Makefile:339: recipe for target `src' failed
  make: *** [src] Interrupt
  </code></pre>
  
  <p>In both cases (Emacs 23.3 and 23.4) Makefile:149 referes to the same part of a makefile in Emacs\lisp folder:</p>
  
  <pre><code>    149 autoloads: $(LOADDEFS) doit
      150 , chmod +w $(lisp)/ps-print.el $(lisp)/emulation/tpu-edt.el \
      151    $(lisp)/emacs-lisp/cl-loaddefs.el $(lisp)/mail/rmail.el \
      152    $(lisp)/dired.el $(lisp)/ibuffer.el
      153  wd=$(lisp); $(setwins_almost); \
      154  echo Directories: $$wins; \
      155  $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
  </code></pre>
  
  <p>in version 23.3. the building gets stuck while generating autoloads for *.el files:</p>
  
  <pre><code>    Generating autoloads for progmodes/cc-mode.el...
      Generating autoloads for progmodes/cc-mode.el...done
      Generating autoloads for progmodes/cc-styles.el...
      Generating autoloads for progmodes/cc-styles.el...done
      Generating autoloads for progmodes/cc-vars.el...
      Generating autoloads for progmodes/cc-vars.el...done
      Generating autoloads for international/ccl.el...
      Makefile:149: recipe for target `autoloads' failed
      make[2]: *** [autoloads] Interrupt
  </code></pre>
  
  <p>in verison 23.4 the building gets stuck while saving loaddefs:</p>
  
  <pre><code>    make[2]: Entering directory `/cygdrive/c/emacs-23.4/lisp'
      chmod +w /cygdrive/c/emacs-23.4/lisp/ps-print.el /cygdrive/c/emacs-23.4/lisp/emulation/tpu-edt.el \
      /cygdrive/c/emacs-23.4/lisp/emacs-lisp/cl-loaddefs.el /cygdrive/c/emacs-23.4/lisp/mail/rmail.el \
      /cygdrive/c/emacs-23.4/lisp/dired.el /cygdrive/c/emacs-23.4/lisp/ibuffer.el
      wd=/cygdrive/c/emacs-23.4/lisp; subdirs=`(cd $wd; find . -type d -print)`;  for file in $subdirs; do  case $file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */obsolete | */term ) ;;  *) wins="$wins $wd/$file" ;;  esac;  done           ; \
      echo Directories: $wins; \
      EMACSLOADPATH=/cygdrive/c/emacs-23.4/lisp LC_ALL=C ../src/bootstrap-emacs.exe -batch --no-site-file --multibyte -l autoload --eval '(setq generated-autoload-file "/cygdrive/c/emacs-23.4/lisp/loaddefs.el")' -f batch-update-autoloads $wins
      Directories: /cygdrive/c/emacs-23.4/lisp/. /cygdrive/c/emacs-23.4/lisp/./calc /cygdrive/c/emacs-23.4/lisp/./calendar /cygdrive/c/emacs-23.4/lisp/./cedet /cygdrive/c/emacs-23.4/lisp/./cedet/ede /cygdrive/c/emacs-23.4/lisp/./cedet/semantic /cygdrive/c/emacs-23.4/lisp/./cedet/semantic/analyze /cygdrive/c/emacs-23.4/lisp/./cedet/semantic/bovine /cygdrive/c/emacs-23.4/lisp/./cedet/semantic/decorate/cygdrive/c/emacs-23.4/lisp/./cedet/semantic/symref /cygdrive/c/emacs-23.4/lisp/./cedet/semantic/wisent /cygdrive/c/emacs-23.4/lisp/./cedet/srecode /cygdrive/c/emacs-23.4/lisp/./emacs-lisp /cygdrive/c/emacs-23.4/lisp/./emulation /cygdrive/c/emacs-23.4/lisp/./erc /cygdrive/c/emacs-23.4/lisp/./eshell /cygdrive/c/emacs-23.4/lisp/./gnus /cygdrive/c/emacs-23.4/lisp/./international /cygdrive/c/emacs-23.4/lisp/./language /cygdrive/c/emacs-23.4/lisp/./mail /cygdrive/c/emacs-23.4/lisp/./mh-e /cygdrive/c/emacs-23.4/lisp/./net /cygdrive/c/emacs-23.4/lisp/./nxml /cygdrive/c/emacs-23.4/lisp/./org /cygdrive/c/emacs-23.4/lisp/./play /cygdrive/c/emacs-23.4/lisp/./progmodes /cygdrive/c/emacs-23.4/lisp/./textmodes /cygdrive/c/emacs-23.4/lisp/./url
      Saving file /cygdrive/c/emacs-23.4/lisp/loaddefs.el...
      Makefile:149: recipe for target `autoloads' failed
      make[2]: *** [autoloads] Interrupt
  </code></pre>
  
  <p>Does anyone have a clue how can I fix this bug? Wrong C compiler ? Change Makefile? Use 'make' with some parameter?</p>
  
  <p>Thank you for any help or reference. </p>
  
  <p><em><strong></em>**<em>*</em>**<em>*</em>**<em>*</em>***</strong><em>PART2</em><strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**</strong></p>
  
  <p>Ok, so here is the continuing according to your advices:</p>
  
  <p>1#
  <code>make autoloads</code>
  is not possible as it is because this sub-part is in the sub-makefile so it will produce error:</p>
  
  <pre><code>$ make autoloads
  chmod +w /cygdrive/c/emacs-23.4/lisp/ps-print.el /cygdrive/c/emacs-23.4/lisp/emulation/tpu-edt.el \
    /cygdrive/c/emacs-23.4/lisp/emacs-lisp/cl-loaddefs.el /cygdrive/c/emacs-23.4/lisps/mail/rmail.el \
     /cygdrive/c/emacs-23.4/lisp/dired.el /cygdrive/c/emacs-23.4/lisp/ibuffer.el
   wd=/cygdrive/c/emacs-23.4/lisp; subdirs=`(cd $wd; find . -type d -print)`;  for file in $subdirs; do  case $file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */obsolete | */term ) ;;  *) wins="$wins $wd/$file" ;;  esac;  done; \
  echo Directories: $wins; \
  EMACSLOADPATH=/cygdrive/c/emacs-23.4/lisp LC_ALL=C ../src/emacs -batch --no-site-file --multibyte -l autoload --eval '(setq generated-autoload-file "/cygdrive/c/emacs-23.4/lisp/loaddefs.el")' -f batch-update-autoloads $wins
  Directories: /cygdrive/c/emacs-23.4/lisp/. /cygdrive/c/emacs-23.4/lisp/./calc /cygdrive/c/emacs-23.4/lisp/./calendar /cygdrive/c/emacs-23.4/lisp/./cedet /cygdrive/c/emacs-23.4/lisp/./cedet/ede /cygdrive/c/emacs-23.4/lisp/./cedet/semantic /cygdrive/c/emacs-23.4/lisp/./cedet/semantic/analyze /cygdrive/c/emacs-23.4/lisp/./cedet/semantic/bovine /cygdrive/c/emacs-23.4/lisp/./cedet/semantic/decorate /cygdrive/c/emacs-23.4/lisp/./cedet/semantic/symref /cygdrive/c/emacs-23.4/lisp/./cedet/semantic/wisent /cygdrive/c/emacs-23.4/lisp/./cedet/srecode /cygdrive/c/emacs-23.4/lisp/./emacs-lisp /cygdrive/c/emacs-23.4/lisp/./emulation /cygdrive/c/emacs-23.4/lisp/./erc /cygdrive/c/emacs-23.4/lisp/./eshell /cygdrive/c/emacs-23.4/lisp/./gnus /cygdrive/c/emacs-23.4/lisp/./international /cygdrive/c/emacs-23.4/lisp/./language /cygdrive/c/emacs-23.4/lisp/./mail /cygdrive/c/emacs-23.4/lisp/./mh-e /cygdrive/c/emacs-23.4/lisp/./net /cygdrive/c/emacs-23.4/lisp/./nxml /cygdrive/c/emacs-23.4/lisp/./org /cygdrive/c/emacs-23.4/lisp/./play /cygdrive/c/emacs-23.4/lisp/./progmodes /cygdrive/c/emacs-23.4/lisp/./textmodes /cygdrive/c/emacs-23.4/lisp/./url
   /bin/sh: line 2: ../src/emacs: No such file or directory
   Makefile:149: recipe for target `autoloads' failed
   make: *** [autoloads] Error 127
  </code></pre>
  
  <p>If I am doing something wrong, please correct me.</p>
  
  <p>2#
  removing <code>$(LOADDEFS) doit</code> in deed does not change the result</p>
  
  <p>3#
  To run just the first part</p>
  
  <pre><code>autoloads:
     chmod +w $(lisp)/ps-print.el $(lisp)/emulation/tpu-edt.el \
    $(lisp)/emacs-lisp/cl-loaddefs.el $(lisp)/mail/rmail.el \
    $(lisp)/dired.el $(lisp)/ibuffer.el
  </code></pre>
  
  <p>resolves in no error within autoloads,</p>
  
  <p>however after 20 sec it froze for a while and produces another error</p>
  
  <p>(description of this problem is bellow)</p>
  
  <p>4#
  To run the second part only:</p>
  
  <pre><code>autoloads:
     wd=$(lisp); $(setwins_almost); \
     echo Directories: $$wins; \
     $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
  </code></pre>
  
  <p>creshed with origin error</p>
  
  <p>5#
  to run autoloads as in 3# also with</p>
  
  <pre><code> wd=$(lisp);
  </code></pre>
  
  <p>autoloads without error, later same error as in 3#</p>
  
  <p>6#
  run autoloads with <code>wd=$(lisp);$(setwins_almost);</code>
  autoloads without error, later same error as in 3#</p>
  
  <p>7#
  add also line</p>
  
  <pre><code>echo Directories: $$wins; 
  </code></pre>
  
  <p>autoloads without error, later same error as in 3#</p>
  
  <p>8#
  add also line</p>
  
  <pre><code>$(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
  </code></pre>
  
  <p>the origin error, of course </p>
  
  <p>DESCRIPTION of 2nd ERROR (part 3#): </p>
  
  <pre><code>make[2]: Entering directory `/cygdrive/c/emacs-23.4/lisp'
  Compiling /cygdrive/c/emacs-23.4/src/../lisp/abbrev.el
  &gt;&gt;Error occurred processing /cygdrive/c/emacs-23.4/src/../lisp/abbrev.el: Symbol's value as variabl                        e is void ((warning-series))
  Makefile:1478: recipe for target `compile-onefile' failed
  make[2]: *** [compile-onefile] Error 1
  make[2]: Leaving directory `/cygdrive/c/emacs-23.4/lisp'
  Makefile:195: recipe for target `/cygdrive/c/emacs-23.4/src/../lisp/abbrev.elc' failed
  make[1]: *** [/cygdrive/c/emacs-23.4/src/../lisp/abbrev.elc] Error 2
  make[1]: Leaving directory `/cygdrive/c/emacs-23.4/src'
  Makefile:339: recipe for target `src' failed
  make: *** [src] Error 2
  </code></pre>
  
  <p>before that a lot of *.el files are compiled</p>
  
  <p>part of the Makefile in <code>lisp/</code> </p>
  
  <pre><code>     # The src/Makefile.in has its own set of dependencies and when they decide
       # that one Lisp file needs to be re-compiled, we had better recompile it as
       # well, otherwise every subsequent make will again call us, until we finally
       # end up deciding that yes, the file deserves recompilation.
       # One option is to try and reproduce exactly the same dependencies here as
       # we have in src/Makefile.in, but it turns out to be painful
       # (e.g. src/Makefile.in may have a dependency for ../lisp/foo.elc where we
       # only know of $(lisp)/foo.elc).  So instead we provide a direct way for
       # src/Makefile.in to rebuild a particular Lisp file, no questions asked.
       # Use byte-compile-refresh-preloaded to try and work around some of
       # the most common problems of not bootstrapping from a clean state.
  1477     compile-onefile:
  1478         @echo Compiling $(THEFILE)
  1479         @# Use byte-compile-refresh-preloaded to try and work around some of
  1480         @# the most common bootstrapping problems.
  1481         @$(emacs) -l bytecomp -f byte-compile-refresh-preloaded  $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(THEFILE)
  </code></pre>
  
  <p>There is a list of ELC files in Makefile:</p>
  
  <pre><code>## Explicitly list the .elc files, for the sake of parallel builds.
  ## http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-05/msg00016.html
  ## This can probably be done more elegantly, but needs to be portable.
  ELCFILES = \
      $(lisp)/abbrev.elc \
      $(lisp)/abbrevlist.elc \
      $(lisp)/add-log.elc \
      $(lisp)/align.elc \
      $(lisp)/allout.elc \
      $(lisp)/ansi-color.elc \
      $(lisp)/apropos.elc \
      $(lisp)/arc-mode.elc \
  </code></pre>
  
  <p>...</p>
  
  <pre><code>    $(lisp)/info.elc \
      $(lisp)/informat.elc \
      $(lisp)/international/ccl.elc \
      $(lisp)/international/characters.elc \
      $(lisp)/international/fontset.elc \
      $(lisp)/international/isearch-x.elc \
  </code></pre>
  
  <p>The Makefile somewhy recreates *.el files maybe from *.elc files, however all *.el files are already there. OK now I have two errors insted of one : )(if there are not connected of course)</p>
  
  <p>Thank you again.</p>