diff -Naur Python-3.8.0-orig/Modules/_winapi.c Python-3.8.0/Modules/_winapi.c
--- Python-3.8.0-orig/Modules/_winapi.c	2019-10-14 16:34:47.000000000 +0300
+++ Python-3.8.0/Modules/_winapi.c	2019-10-22 10:01:48.485627300 +0300
@@ -39,7 +39,9 @@
 
 #define WINDOWS_LEAN_AND_MEAN
 #include "windows.h"
+#if defined(Py_DEBUG)
 #include <crtdbg.h>
+#endif
 #include "winreparse.h"
 
 #if defined(MS_WIN32) && !defined(MS_WIN64)
diff -Naur Python-3.8.0-orig/PC/msvcrtmodule.c Python-3.8.0/PC/msvcrtmodule.c
--- Python-3.8.0-orig/PC/msvcrtmodule.c	2019-10-14 16:34:47.000000000 +0300
+++ Python-3.8.0/PC/msvcrtmodule.c	2019-10-22 10:01:48.891228000 +0300
@@ -21,7 +21,9 @@
 #include <io.h>
 #include <conio.h>
 #include <sys/locking.h>
+#ifdef _DEBUG
 #include <crtdbg.h>
+#endif
 #include <windows.h>
 
 #ifdef _MSC_VER
diff -Naur Python-3.8.0-orig/Python/dynamic_annotations.c Python-3.8.0/Python/dynamic_annotations.c
--- Python-3.8.0-orig/Python/dynamic_annotations.c	2019-10-14 16:34:47.000000000 +0300
+++ Python-3.8.0/Python/dynamic_annotations.c	2019-10-22 10:01:49.296828700 +0300
@@ -27,7 +27,7 @@
  * Author: Kostya Serebryany
  */
 
-#ifdef _MSC_VER
+#ifdef MS_WINDOWS
 # include <windows.h>
 #endif
 
diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py
--- Python-3.8.0-orig/setup.py	2019-10-22 10:01:47.378025300 +0300
+++ Python-3.8.0/setup.py	2019-10-22 10:01:49.702429400 +0300
@@ -1540,6 +1540,27 @@
                                    '-framework', 'SystemConfiguration',
                                    '-framework', 'CoreFoundation']))
 
+        # Modules with some Windows dependencies:
+        if MS_WINDOWS:
+            srcdir = sysconfig.get_config_var('srcdir')
+            pc_srcdir = os.path.abspath(os.path.join(srcdir, 'PC'))
+
+            self.add(Extension('msvcrt', [os.path.join(pc_srcdir, p)
+                               for p in ['msvcrtmodule.c']]))
+
+            self.add(Extension('_winapi', ['_winapi.c']))
+
+            self.add(Extension('_msi', [os.path.join(pc_srcdir, p)
+                               for p in ['_msi.c']],
+                               libraries=['msi','cabinet','rpcrt4'])) # To link with lib(msi|cabinet|rpcrt4).a
+
+            self.add(Extension('winsound', [os.path.join(pc_srcdir, p)
+                               for p in ['winsound.c']],
+                               libraries=['winmm']))
+
+            self.add(Extension('_overlapped', ['overlapped.c'],
+                               libraries=['ws2_32']))
+
     def detect_compress_exts(self):
         # Andrew Kuchling's zlib module.  Note that some versions of zlib
         # 1.1.3 have security problems.  See CERT Advisory CA-2002-07:
