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

[email protected] (Henry S. Thompson) Mon, 27 Jul 2015 20:11:07 +0100
Newsgroups gmane.emacs.xemacs.beta
Message-ID <[email protected]>
ht writes:

> ...
> Having made those changes, I can compile and get past all the earlier
> missing symbols, but alas Xpm.lib is _also_ stale, and required, so
> I'll have to stop and rebuild that before further progress.

Stopped, rebuilt, further fixes to xemacs.mak (how did this ever
work?), now compiles, links and . . . crashes in temacs.exe

This one looks like a real failure, out of my depth here:

 Debug Assertion Failed!

 Program:...temacs.exe
 minkernel\crts\ucrt\src\appcrt\lowio\isatty.cpp
 Line: 17

 Expression: (fh >= 0 && (unsigned)fh < (unsigned)_nhandle)

The bottom of the stack is at

 rtnval = fwrite (b, size, nitem, stream);

in sysdep.c:retry_fwrite

The attached patch file includes more changes to xemacs.mak than the
one previously sent.

ht


-- 
       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_2.patch (text/x-patch, 5.4 KB)
diff -r cb65bfaf7110 nt/xemacs.mak
--- a/nt/xemacs.mak	Fri Mar 27 16:05:15 2015 +0100
+++ b/nt/xemacs.mak	Mon Jul 27 19:50:35 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,6 +1106,7 @@
 # If we're using Visual Studio 2005 or greater,
 # embed the manifest into the executable.
 !if $(MSC_VER) >= 1400
+	@if exist [email protected]
 	mt -manifest [email protected] -outputresource:$@;1
 !endif
 
@@ -1113,6 +1117,7 @@
 # If we're using Visual Studio 2005 or greater,
 # embed the manifest into the executable.
 !if $(MSC_VER) >= 1400
+	@if exist [email protected]
 	mt -manifest [email protected] -outputresource:$@;1
 !endif
 
@@ -1124,6 +1129,7 @@
 # If we're using Visual Studio 2005 or greater,
 # embed the manifest into the executable.
 !if $(MSC_VER) >= 1400
+	@if exist [email protected]
 	mt -manifest [email protected] -outputresource:$@;1
 !endif
 
@@ -1385,7 +1391,7 @@
 
 $(RAW_EXE): $(TEMACS_OBJS) $(LASTFILE) $(TEMACS_DUMP_DEP)
 # Command line too long for some Windows installation:
-#	@echo link $(TEMACS_LFLAGS) -out:$@ $(TEMACS_OBJS) $(TEMACS_DUMP_DEP) $(TEMACS_LIBS)
+	@echo link $(TEMACS_LFLAGS) -out:$@ $(TEMACS_OBJS) $(TEMACS_DUMP_DEP) $(TEMACS_LIBS)
 	link.exe @<<
   $(TEMACS_LFLAGS) -out:$@ $(TEMACS_OBJS) $(TEMACS_DUMP_DEP) $(TEMACS_LIBS)
 <<
@@ -1397,6 +1403,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.
@@ -1450,6 +1457,7 @@
 # If we're using Visual Studio 2005 or greater,
 # embed the manifest into the executable.
 !if $(MSC_VER) >= 1400
+	@if exist [email protected]
 	mt -manifest [email protected] -outputresource:$@;1
 !endif
 
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	Mon Jul 27 19:50:35 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	Mon Jul 27 19:50:35 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	Mon Jul 27 19:50:35 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 */