Re: Compiling xemacs with Visual Studio 2015 Community ('free') edition

[email protected] (Henry S. Thompson) Tue, 28 Jul 2015 12:28:45 +0100
Newsgroups gmane.emacs.xemacs.beta
Message-ID <[email protected]>
TL;DR: More progress, another patch file with some errors removed.

I think the attached now builds cleanly all the way through to dumping
xemacs.exe and then trying to use it, which fails (see below).

The problem with i.exe remains, but the workaround of just removing it
works, _if_ you are vigilant, and whenever an popup window with output
from temacs looks like it's finished, you check for a small hidden
alert saying "XEmacs exited" and requiring a click on OK.

The xemacs crash is reported as follows by VS2015

  Unhandled exception at 0x00BCB1AC in xemacs.exe: 0xC0000005: Access
  violation writing location 0x00EAE6A4.

The VS2015 backtrace is

 xemacs.exe!pdump_load_finish() Line 2350 C++
 xemacs.exe!pdump_load(const wchar_t * argv0) Line 2793 C++
 xemacs.exe!xemacs_21_5_b34_i586_pc_win32(int argc, wchar_t * * argv, wchar_t * * unused_envp, int restart) Line 1408 C++
 xemacs.exe!main(int argc, char * * argv, char * * unused_envp) Line 3204 C++

Hope someone can reproduce, then help.

ht

[Note about the attached patches, wrt xemacs.mak: I'm sure the way I'm
handling the extra libraries is sub-optimal, but I don't understand
how this ever worked in the past.  I hope someone who does understand
will fix this in a cleaner way.]


-- 
       Henry S. Thompson, School of Informatics, University of Edinburgh
      10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
                Fax: (44) 131 650-4587, e-mail: [email protected]
                       URL: http://www.ltg.ed.ac.uk/~ht/
 [mail from me _always_ has a .sig like this -- mail without it is forged spam]

_______________________________________________
XEmacs-Beta mailing list
[email protected]
http://lists.xemacs.org/mailman/listinfo/xemacs-beta
vs2015_3.patch (text/x-patch, 8.7 KB)
diff -r cb65bfaf7110 nt/xemacs.mak
--- a/nt/xemacs.mak	Fri Mar 27 16:05:15 2015 +0100
+++ b/nt/xemacs.mak	Tue Jul 28 12:28:05 2015 +0100
@@ -543,6 +543,7 @@
 OPT_DEFINES=$(OPT_DEFINES) -DHAVE_XPM -DFOR_MSW
 OPT_INCLUDES=$(OPT_INCLUDES) -I"$(XPM_DIR)" -I"$(XPM_DIR)\lib"
 OPT_LIBS=$(OPT_LIBS) "$(XPM_DIR)\lib\Xpm.lib"
+OPT_PATH=$(OPT_PATH)$(XPM_DIR)\lib;
 !endif
 !if $(HAVE_GIF)
 OPT_DEFINES=$(OPT_DEFINES) -DHAVE_GIF
@@ -595,8 +596,10 @@
 OPT_INCLUDES=$(OPT_INCLUDES) -I"$(DATABASE_DIR)\build_win32"
 !if $(BUILD_DATABASE_SHARED)
 OPT_LIBS=$(OPT_LIBS) "$(DATABASE_DIR)\build_win32\Release\libdb43.lib"
+OPT_PATH=$(OPT_PATH)$(DATABASE_DIR)\build_win32\Release;
 !else
 OPT_LIBS=$(OPT_LIBS) "$(DATABASE_DIR)\build_win32\Release_static\libdb43s.lib"
+OPT_PATH=$(OPT_PATH)$(DATABASE_DIR)\build_win32\Release_static;
 !endif
 OPT_OBJS=$(OPT_OBJS) $(OUTDIR)\database.obj
 !endif
@@ -738,10 +741,10 @@
 !if $(USE_CRTDLL)
 !  if $(DEBUG_XEMACS) && "$(OK_TO_USE_MSVCRTD)" == "1"
 C_LIBFLAG=-MDd
-LIBC_LIB=msvcrtd.lib
+LIBC_LIB=msvcrtd.lib ucrtd.lib vcruntimed.lib
 !  else
 C_LIBFLAG=-MD
-LIBC_LIB=msvcrt.lib
+LIBC_LIB=msvcrt.lib ucrt.lib vcruntime.lib
 !  endif
 !else
 C_LIBFLAG=-ML
@@ -793,7 +796,7 @@
 INCLUDES=-I$(NT)\inc -I$(SRC) $(OPT_INCLUDES)
 
 DEFINES=$(OPT_DEFINES) \
-	-DWIN32_LEAN_AND_MEAN -DWIN32_NATIVE -Demacs \
+	-DWIN32_LEAN_AND_MEAN -DWIN32_NATIVE -Demacs  -DNTDDI_VERSION=NTDDI_WIN2K -D_WIN32_WINNT=_WIN32_WINNT_WIN2K -D_CRT_NO_POSIX_ERROR_CODES \
 	-DHAVE_CONFIG_H $(PROGRAM_DEFINES) $(PATH_DEFINES)
 
 CFLAGS_NO_OPT=-nologo -W3 -DSTRICT $(DEBUG_FLAGS_COMPILE)
@@ -1103,7 +1106,7 @@
 # If we're using Visual Studio 2005 or greater,
 # embed the manifest into the executable.
 !if $(MSC_VER) >= 1400
-	mt -manifest [email protected] -outputresource:$@;1
+	@if exist [email protected] mt -manifest [email protected] -outputresource:$@;1
 !endif
 
 # Individual dependencies
@@ -1113,7 +1116,7 @@
 # If we're using Visual Studio 2005 or greater,
 # embed the manifest into the executable.
 !if $(MSC_VER) >= 1400
-	mt -manifest [email protected] -outputresource:$@;1
+	@if exist [email protected] mt -manifest [email protected] -outputresource:$@;1
 !endif
 
 $(BLDLIB_SRC)/movemail.exe : $(LIB_SRC)/movemail.c $(LIB_SRC)/pop.c $(ETAGS_DEPS)
@@ -1124,7 +1127,7 @@
 # If we're using Visual Studio 2005 or greater,
 # embed the manifest into the executable.
 !if $(MSC_VER) >= 1400
-	mt -manifest [email protected] -outputresource:$@;1
+	@if exist [email protected] mt -manifest [email protected] -outputresource:$@;1
 !endif
 
 LIB_SRC_TOOLS = \
@@ -1334,8 +1337,10 @@
 
 RAW_EXE=$(BLDSRC)\temacs.exe
 DUMP_TARGET = $(BLDSRC)\xemacs.exe
-DO_TEMACS = "$(BLDLIB_SRC)\i" "$(RAW_EXE)"
-DO_XEMACS = "$(BLDLIB_SRC)\i" "$(DUMP_TARGET)"
+#DO_TEMACS = "$(BLDLIB_SRC)\i" "$(RAW_EXE)" removed by HST, i.exe crashes
+DO_TEMACS = "$(RAW_EXE)"
+#DO_XEMACS = "$(BLDLIB_SRC)\i" "$(DUMP_TARGET)" ditto
+DO_XEMACS = "$(DUMP_TARGET)"
 
 BATCH = -no-packages -batch
 BATCH_PACKAGES = -vanilla -batch
@@ -1397,6 +1402,7 @@
 ## (3) Update the .elc's needed for dumping
 
 update-elc: $(RAW_EXE)
+	set PATH=$(OPT_PATH)$(PATH)
 	$(TEMACS_BATCH) -l $(LISP)\update-elc.el
 
 ## This file is touched by update-elc.el when redumping is necessary.
@@ -1417,11 +1423,15 @@
 # calculates dependencies; see comments in src/Makefile.in.in.
 $(DOC): $(BLDLIB_SRC)\make-docfile.exe $(BLDSRC)\NEEDTODUMP $(TEMACS_DOC_SOURCES)
 !if $(QUICK_BUILD)
-	if not exist $(DOC) $(TEMACS_BATCH) -l $(LISP)\make-docfile.el -- -o $(DOC) -i $(SRCROOT)\site-packages @<<
+	if not exist $(DOC) (
+	set PATH=$(OPT_PATH)$(PATH)
+	$(TEMACS_BATCH) -l $(LISP)\make-docfile.el -- -o $(DOC) -i $(SRCROOT)\site-packages @<<
 $(**)
 <<
 	-touch $(DOC)
+	)
 !else
+	set PATH=$(OPT_PATH)$(PATH)
 	$(TEMACS_BATCH) -l $(LISP)\make-docfile.el -- -o $(DOC) -i $(SRCROOT)\site-packages @<<
 $(**)
 <<
@@ -1437,6 +1447,7 @@
 # requirements have changed.
 
 $(DUMP_TARGET): $(DOC) $(RAW_EXE) $(BLDSRC)\NEEDTODUMP
+	set PATH=$(OPT_PATH)$(PATH)
 	$(TEMACS_BATCH) -l $(LISP)\loadup.el dump
 !if $(USE_PORTABLE_DUMPER)
 	cd $(BLDSRC)
@@ -1450,7 +1461,7 @@
 # If we're using Visual Studio 2005 or greater,
 # embed the manifest into the executable.
 !if $(MSC_VER) >= 1400
-	mt -manifest [email protected] -outputresource:$@;1
+	@if exist [email protected] mt -manifest [email protected] -outputresource:$@;1
 !endif
 
 !endif
@@ -1458,6 +1469,7 @@
 ## (6) Update the remaining .elc's, post-dumping
 
 update-elc-2: $(DUMP_TARGET)
+	set PATH=$(OPT_PATH)$(PATH)
 	$(XEMACS_BATCH) -no-autoloads -l update-elc-2.el -f batch-update-elc-2 $(LISP)
 
 ## (7) Other random stuff
@@ -1465,6 +1477,7 @@
 $(LISP)/finder-inf.el: update-elc-2
 !if !$(QUICK_BUILD)
 	@echo Building finder database ...
+	set PATH=$(OPT_PATH)$(PATH)
 	$(XEMACS_BATCH)	-eval "(setq finder-compile-keywords-quiet t)" \
 		-l finder -f finder-compile-keywords
 	@echo Building finder database ...(done)
@@ -1473,6 +1486,7 @@
 load-shadows: update-elc-2
 !if !$(QUICK_BUILD)
 	@echo Testing for Lisp shadows ...
+	set PATH=$(OPT_PATH)$(PATH)
 	@$(XEMACS_BATCH) -f list-load-path-shadows
 !endif
 
@@ -1501,6 +1515,7 @@
 
 {$(MANDIR)}.texi{$(INFODIR)}.info:
 	cd $(MANDIR)
+	set PATH=$(OPT_PATH)$(PATH)
 	$(MAKEINFO) $(**F)
 
 XEMACS_SRCS = \
@@ -1633,18 +1648,22 @@
 
 $(INFODIR)\xemacs.info: $(XEMACS_SRCS)
 	cd $(MANDIR)\xemacs
+	set PATH=$(OPT_PATH)$(PATH)
 	$(MAKEINFO) xemacs.texi
 
 $(INFODIR)\lispref.info: $(LISPREF_SRCS)
 	cd $(MANDIR)\lispref
+	set PATH=$(OPT_PATH)$(PATH)
 	$(MAKEINFO) lispref.texi
 
 $(INFODIR)\internals.info: $(INTERNALS_SRCS)
 	cd $(MANDIR)\internals
+	set PATH=$(OPT_PATH)$(PATH)
 	$(MAKEINFO) internals.texi
 
 $(INFODIR)\new-users-guide.info: $(NEW_USERS_GUIDE_SRCS)
 	cd $(MANDIR)\new-users-guide
+	set PATH=$(OPT_PATH)$(PATH)
 	$(MAKEINFO) new-users-guide.texi
 
 info:	makeinfo-test $(INFO_FILES)
@@ -1660,14 +1679,17 @@
 
 check:
 	cd $(BLDSRC)
+	set PATH=$(OPT_PATH)$(PATH)
 	$(DO_XEMACS) $(batch_test_emacs)
 
 check-temacs:
 	cd $(BLDSRC)
+	set PATH=$(OPT_PATH)$(PATH)
 	$(TEMACS_BATCH) $(run_temacs_args) $(batch_test_emacs)
 
 check-features: all
 	cd $(BLDSRC)
+	set PATH=$(OPT_PATH)$(PATH)
 	$(XEMACS_BATCH) -l check-features.el
 
 
@@ -1832,6 +1854,7 @@
 @echo off
 @"$(MAKEINFO)" --version
 @if not errorlevel 1 goto test_done
+@set PATH=$(OPT_PATH)$(PATH)
 @$(XEMACS_BATCH_PACKAGES) -eval "(condition-case nil (require (quote texinfo)) (t (kill-emacs 1)))"
 @if not errorlevel 1 goto suggest_makeinfo
 @echo XEmacs 'info' cannot be built!
diff -r cb65bfaf7110 src/intl-auto-encap-win32.c
--- a/src/intl-auto-encap-win32.c	Fri Mar 27 16:05:15 2015 +0100
+++ b/src/intl-auto-encap-win32.c	Tue Jul 28 12:28:05 2015 +0100
@@ -36,13 +36,14 @@
     return PeekConsoleInputA (arg1, arg2, arg3, arg4);
 }
 
+/* HST did this */
 BOOL
-qxeReadConsole (HANDLE arg1, PVOID arg2, DWORD arg3, PDWORD arg4, PVOID arg5)
-{
-  if (XEUNICODE_P)
-    return ReadConsoleW (arg1, arg2, arg3, arg4, arg5);
-  else
-    return ReadConsoleA (arg1, arg2, arg3, arg4, arg5);
+qxeReadConsole (HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead, LPDWORD lpNumberOfCharsRead, LPVOID lpReserved)
+{
+  if (XEUNICODE_P)
+    return ReadConsoleW (hConsoleInput, lpBuffer, nNumberOfCharsToRead, lpNumberOfCharsRead, (PCONSOLE_READCONSOLE_CONTROL)lpReserved);
+  else
+    return ReadConsoleA (hConsoleInput, lpBuffer, nNumberOfCharsToRead, lpNumberOfCharsRead, (PCONSOLE_READCONSOLE_CONTROL)lpReserved);
 }
 
 BOOL
@@ -3346,6 +3347,7 @@
     return (Extbyte *) GetCommandLineA ();
 }
 
+/*HST did this
 DWORD
 qxeGetCompressedFileSize (const Extbyte * arg1, PDWORD arg2)
 {
@@ -3354,6 +3356,7 @@
   else
     return GetCompressedFileSizeA ((LPCSTR) arg1, arg2);
 }
+*/
 
 BOOL
 qxeGetComputerName (Extbyte * arg1, PDWORD arg2)
diff -r cb65bfaf7110 src/s/windowsnt.h
--- a/src/s/windowsnt.h	Fri Mar 27 16:05:15 2015 +0100
+++ b/src/s/windowsnt.h	Tue Jul 28 12:28:05 2015 +0100
@@ -63,6 +63,8 @@
 
 #define HAVE_TIMEVAL
 #define HAVE_TZNAME
+/* need this, where should it go? HST */
+#define tzname _tzname
 #define HAVE_H_ERRNO
 
 #define HAVE_CLOSEDIR
@@ -176,9 +178,11 @@
 #pragma warning ( disable : 4646 )
 #endif 
 
-/* MSVC version >= 2.x without /Za supports __inline */
+/* MSVC version >= 2.x without /Za supports __inline
+   HST cut this -- VS2015 complains
 #if (_MSC_VER < 900) || defined (__STDC__)
 # define inline
 #else
 # define inline __inline
 #endif
+ */
diff -r cb65bfaf7110 src/sysproc.h
--- a/src/sysproc.h	Fri Mar 27 16:05:15 2015 +0100
+++ b/src/sysproc.h	Tue Jul 28 12:28:05 2015 +0100
@@ -35,8 +35,8 @@
    This is not true with visual c though. The trick below works with
    VC4.2b, 5.0 and 6.0. It assumes that VC is installed in a kind of
    standard way, so include path ends with /include.
-*/
-#include <../include/process.h>
+   HST changed this to ucrt */
+#include <../ucrt/process.h>
 #endif
 
 #ifdef HAVE_SOCKETS	/* TCP connection support, if kernel can do it */