Subject: Error after dump complete when build on Windows 10
From: "Shuguang Sun" <[email-masked]>
To: "bug-gnu-emacs" <[email-masked]>
Cc: shuguang79 <[email-masked]>
Date: Fri, 1 Feb 2019 23:52:22 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

This a bug report following 

http://lists.gnu.org/archive/html/help-gnu-emacs/2019-01/msg00118.html

I'm try to build emacs on Windows 10 using msys2/mingw64, and git emacs source. 
However, it raises error after dump complete.
- most updated msys2/mingw64
- Windowing system distributor 'Microsoft Corp.', version 10.0.15063
- System Description: Microsoft Windows 10 Enterprise (v10.0.1703.15063.1563)

- last success build: Repository revision: c48ea7c08c95185ddce266744a1959e0ce6b04e1  (2019-01-13)

I tried the pdumper master in last Sunday and yesterday and today with updated repository.
Current one:   94245b9a790392768d47afc15ae278369307d663

I tried make -j3 after:
- pdumper:  ./configure --without-imagemagick

- unexec:  ./configure --without-imagemagick --with-dumping=unexec

The unexec one provide clear error message:
```
Dumping from C:/gitemacs/emacs/src/temacs.exe
          to C:/gitemacs/emacs/src/emacs.exe
mv -f emacs.exe bootstrap-emacs.exe
make -C ../lisp compile-first EMACS="../src/bootstrap-emacs.exe"
make[2]: Entering directory '/c/gitemacs/emacs/lisp'
  ELC      emacs-lisp/macroexp.elc
  ELC      emacs-lisp/cconv.elc
  ELC      emacs-lisp/byte-opt.elc
emacs: Wrong type argument: vectorp, []
make[2]: *** [Makefile:301: emacs-lisp/byte-opt.elc] Error 1
make[2]: *** Waiting for unfinished jobs....
emacs: Wrong type argument: vectorp, []
make[2]: *** [Makefile:301: emacs-lisp/cconv.elc] Error 1
emacs: Wrong type argument: vectorp, []
make[2]: *** [Makefile:301: emacs-lisp/macroexp.elc] Error 1
make[2]: Leaving directory '/c/gitemacs/emacs/lisp'
make[1]: *** [Makefile:797: bootstrap-emacs.exe] Error 2
make[1]: Leaving directory '/c/gitemacs/emacs/src'
make: *** [Makefile:423: src] Error 2
```

The pdumper building popup a error box:
https://github.com/ShuguangSun/emacsimprovement/blob/master/Emacs_Win10_compileError.PNG
And error message:
```
Dump complete
Byte counts: header=80 hot=13293288 discardable=127776 cold=9178020
Reloc counts: hot=920625 discardable=4848
make -C ../lisp compile-first EMACS="../src/bootstrap-emacs.exe"
make[2]: Entering directory '/c/Users/username/gitemacs/emacs/lisp'
  ELC      emacs-lisp/macroexp.elc
  ELC      emacs-lisp/cconv.elc
  ELC      emacs-lisp/byte-opt.elc
/bin/sh: line 1: 195564 Segmentation fault      EMACSLOADPATH= 
'../src/bootstrap-emacs.exe' -batch --no-site-file --no-site-lisp --eval '(setq 
load-prefer-newer t)' -f batch-byte-compile emacs-lisp/cconv.el
make[2]: *** [Makefile:301: emacs-lisp/cconv.elc] Error 139
make[2]: *** Waiting for unfinished jobs....
/bin/sh: line 1: 102824 Segmentation fault      EMACSLOADPATH= 
'../src/bootstrap-emacs.exe' -batch --no-site-file --no-site-lisp --eval '(setq 
load-prefer-newer t)' -f batch-byte-compile emacs-lisp/byte-opt.el
make[2]: *** [Makefile:301: emacs-lisp/byte-opt.elc] Error 139
/bin/sh: line 1: 88864 Segmentation fault      EMACSLOADPATH= 
'../src/bootstrap-emacs.exe' -batch --no-site-file --no-site-lisp --eval '(setq 
load-prefer-newer t)' -f batch-byte-compile emacs-lisp/macroexp.el
make[2]: *** [Makefile:301: emacs-lisp/macroexp.elc] Error 139
make[2]: Leaving directory '/c/Users/username/gitemacs/emacs/lisp'
make[1]: *** [Makefile:812: bootstrap-emacs.pdmp] Error 2
make[1]: Leaving directory '/c/Users/username/gitemacs/emacs/src'
make: *** [Makefile:423: src] Error 2
```

Configure summary:
Configured for 'x86_64-w64-mingw32'.

  Where should the build process find the source code?    .
  What compiler should emacs be built with?               gcc  -g3 -O2 -gdwarf-2
  Should Emacs use the GNU version of malloc?             no
    (The GNU allocators don't work with this system configuration.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         yes
  What window system should Emacs use?                    w32
  What toolkit should Emacs use?                          none
  Where do we find X Windows header files?                NONE
  Where do we find X Windows libraries?                   NONE
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   yes
  Does Emacs use -ljpeg?                                  yes
  Does Emacs use -ltiff?                                  yes
  Does Emacs use a gif library?                           yes
  Does Emacs use a png library?                           yes
  Does Emacs use -lrsvg-2?                                yes
  Does Emacs use cairo?                                   no
  Does Emacs use -llcms2?                                 yes
  Does Emacs use imagemagick?                             no
  Does Emacs support sound?                               yes
  Does Emacs use -lgpm?                                   no
  Does Emacs use -ldbus?                                  no
  Does Emacs use -lgconf?                                 no
  Does Emacs use GSettings?                               no
  Does Emacs use a file notification library?             yes (w32)
  Does Emacs use access control lists?                    yes
  Does Emacs use -lselinux?                               no
  Does Emacs use -lgnutls?                                yes
  Does Emacs use -lxml2?                                  yes
  Does Emacs use -lfreetype?                              no
  Does Emacs use -lm17n-flt?                              no
  Does Emacs use -lotf?                                   no
  Does Emacs use -lxft?                                   no
  Does Emacs use -lsystemd?                               no
  Does Emacs use -ljansson?                               yes
  Does Emacs use -lgmp?                                   yes
  Does Emacs directly use zlib?                           yes
  Does Emacs have dynamic modules support?                no
  Does Emacs use toolkit scroll bars?                     yes
  Does Emacs support Xwidgets (requires gtk3)?            no
  Does Emacs have threading support in lisp?              yes
  Does Emacs support the portable dumper?                 no
  Does Emacs support legacy unexec dumping?               yes
  Which dumping strategy does Emacs use?                  unexec