Build issues 4.2.0 on Windows VS 2017

I’ve been successfully build SQLCipher using a batch file until the latest release when it fails with a bunch of errors.

I kick things off with

nmake /f …\Makefile.msc TOP=… USE_CRT_DLL=1 WIN32HEAP=1

then I get the following errors …

C:\GitHub\sqlcipher\bld>copy /Y sqlite3.h tsrc
1 file(s) copied.
for %i in () do copy /Y %i tsrc
copy /Y fts5.c tsrc
1 file(s) copied.
copy /Y fts5.h tsrc
1 file(s) copied.
del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL
tclsh …\tool\vdbe-compress.tcl < tsrc\vdbe.c > vdbe.new
move vdbe.new tsrc\vdbe.c
1 file(s) moved.
echo > .target_source
copy /Y tsrc\sqlite3ext.h sqlite3ext.h
1 file(s) copied.
tclsh …\tool\mksqlite3c.tcl
copy …\ext\session\sqlite3session.h .
1 file(s) copied.
cl -nologo -W4 -DINCLUDE_MSVC_H=1 -DSQLITE_OS_WIN=1 -I. -I… -I…\src -fp:precise -MD -DNDEBUG -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -DSQLITE_WIN32_MALLOC=1 -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_TEMP_STORE=1 -DSQLITE_MAX_TRIGGER_DEPTH=100 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_INTROSPECTION_PRAGMAS=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -O2 -Zi -Fosqlite3.lo -Fdsqlite3.pdb -c sqlite3.c
sqlite3.c
sqlite3.c(30924): error C2061: syntax error: identifier ‘CRITICAL_SECTION’
sqlite3.c(30931): error C2059: syntax error: ‘}’
sqlite3.c(30986): error C2079: ‘winMutex_staticMutexes’ uses undefined struct ‘sqlite3_mutex’
sqlite3.c(30999): error C2078: too many initializers
sqlite3.c(30986): error C2078: too many initializers
sqlite3.c(31008): error C2143: syntax error: missing ‘{’ before ‘volatile’
sqlite3.c(31008): warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
sqlite3.c(31011): error C2146: syntax error: missing ‘)’ before identifier ‘milliseconds’
sqlite3.c(31011): error C2061: syntax error: identifier ‘milliseconds’
sqlite3.c(31011): error C2059: syntax error: ‘;’
sqlite3.c(31011): error C2059: syntax error: ‘)’
sqlite3.c(31015): warning C4013: ‘InterlockedCompareExchange’ undefined; assuming extern returning int
sqlite3.c(31017): error C2109: subscript requires array or pointer type
sqlite3.c(31021): warning C4013: ‘InitializeCriticalSection’ undefined; assuming extern returning int
sqlite3.c(31021): error C2109: subscript requires array or pointer type
sqlite3.c(31029): warning C4013: ‘sqlite3_win32_sleep’ undefined; assuming extern returning int
sqlite3.c(31041): error C2109: subscript requires array or pointer type
sqlite3.c(31042): warning C4013: ‘DeleteCriticalSection’ undefined; assuming extern returning int
sqlite3.c(31042): error C2109: subscript requires array or pointer type
sqlite3.c(31104): error C2027: use of undefined type ‘sqlite3_mutex’
sqlite3.c(30923): note: see declaration of ‘sqlite3_mutex’
sqlite3.c(31106): error C2037: left of ‘id’ specifies undefined struct/union ‘sqlite3_mutex’
sqlite3.c(31115): error C2037: left of ‘mutex’ specifies undefined struct/union ‘sqlite3_mutex’
sqlite3.c(31127): error C2109: subscript requires array or pointer type
sqlite3.c(31149): error C2037: left of ‘id’ specifies undefined struct/union ‘sqlite3_mutex’
sqlite3.c(31150): error C2037: left of ‘mutex’ specifies undefined struct/union ‘sqlite3_mutex’
sqlite3.c(31181): warning C4013: ‘EnterCriticalSection’ undefined; assuming extern returning int
sqlite3.c(31181): error C2037: left of ‘mutex’ specifies undefined struct/union ‘sqlite3_mutex’
sqlite3.c(31256): warning C4013: ‘LeaveCriticalSection’ undefined; assuming extern returning int
sqlite3.c(31256): error C2037: left of ‘mutex’ specifies undefined struct/union ‘sqlite3_mutex’
sqlite3.c(34345): warning C4013: ‘GetCurrentThreadId’ undefined; assuming extern returning int
sqlite3.c(34352): error C2061: syntax error: identifier ‘sqlite3Win32Wait’
sqlite3.c(34352): error C2059: syntax error: ‘;’
sqlite3.c(34352): error C2146: syntax error: missing ‘)’ before identifier ‘hObject’
sqlite3.c(34352): error C2061: syntax error: identifier ‘hObject’
sqlite3.c(34352): error C2059: syntax error: ‘)’
sqlite3.c(34356): error C2065: ‘DWORD’: undeclared identifier
sqlite3.c(34356): error C2146: syntax error: missing ‘;’ before identifier ‘rc’
sqlite3.c(34356): error C2065: ‘rc’: undeclared identifier
sqlite3.c(34357): error C2065: ‘BOOL’: undeclared identifier
sqlite3.c(34357): error C2146: syntax error: missing ‘;’ before identifier ‘bRc’
sqlite3.c(34357): error C2065: ‘bRc’: undeclared identifier
sqlite3.c(34363): error C2065: ‘rc’: undeclared identifier
sqlite3.c(34363): error C2065: ‘WAIT_OBJECT_0’: undeclared identifier
sqlite3.c(34367): error C2065: ‘rc’: undeclared identifier
sqlite3.c(34367): warning C4013: ‘sqlite3Win32Wait’ undefined; assuming extern returning int
sqlite3.c(34367): error C2065: ‘HANDLE’: undeclared identifier
sqlite3.c(34367): error C2146: syntax error: missing ‘)’ before identifier ‘p’
sqlite3.c(34367): error C2059: syntax error: ‘)’
sqlite3.c(34369): error C2065: ‘bRc’: undeclared identifier
sqlite3.c(34369): warning C4013: ‘CloseHandle’ undefined; assuming extern returning int
sqlite3.c(34369): error C2065: ‘HANDLE’: undeclared identifier
sqlite3.c(34369): error C2146: syntax error: missing ‘)’ before identifier ‘p’
sqlite3.c(34369): error C2059: syntax error: ‘)’
sqlite3.c(34372): error C2065: ‘rc’: undeclared identifier
sqlite3.c(34372): error C2065: ‘WAIT_OBJECT_0’: undeclared identifier
sqlite3.c(34374): error C2065: ‘rc’: undeclared identifier
sqlite3.c(34374): error C2065: ‘WAIT_OBJECT_0’: undeclared identifier
sqlite3.c(45637): error C2061: syntax error: identifier ‘HANDLE’
sqlite3.c(45641): error C2061: syntax error: identifier ‘lastErrno’
sqlite3.c(45641): error C2059: syntax error: ‘;’
sqlite3.c(45656): error C2061: syntax error: identifier ‘hMap’
sqlite3.c(45656): error C2059: syntax error: ‘;’
sqlite3.c(45661): error C2059: syntax error: ‘}’
sqlite3.c(45671): error C2061: syntax error: identifier ‘BOOL’
sqlite3.c(45672): error C2059: syntax error: ‘}’
sqlite3.c(45795): error C2061: syntax error: identifier ‘HANDLE’
sqlite3.c(45796): error C2061: syntax error: identifier ‘bOwned’
sqlite3.c(45796): error C2059: syntax error: ‘;’
sqlite3.c(45800): error C2059: syntax error: ‘}’
sqlite3.c(45807): error C2079: ‘win_mem_data’ uses undefined struct ‘winMemData’
sqlite3.c(45815): error C2065: ‘FALSE’: undeclared identifier
sqlite3.c(45815): error C2078: too many initializers
sqlite3.c(45807): warning C4047: ‘initializing’: ‘int’ differs in levels of indirection from ‘void *’
sqlite3.c(45811): error C2078: too many initializers
sqlite3.c(45855): error C2143: syntax error: missing ‘{’ before ‘volatile’
sqlite3.c(45855): warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
sqlite3.c(45882): error C2065: ‘AreFileApisANSI’: undeclared identifier
sqlite3.c(45912): error C2065: ‘CreateFileA’: undeclared identifier
sqlite3.c(45921): error C2065: ‘CreateFileW’: undeclared identifier
sqlite3.c(45932): error C2065: ‘CreateFileMappingA’: undeclared identifier
sqlite3.c(45942): error C2065: ‘CreateFileMappingW’: undeclared identifier
sqlite3.c(45951): error C2065: ‘CreateMutexW’: undeclared identifier
sqlite3.c(45960): error C2065: ‘DeleteFileA’: undeclared identifier
sqlite3.c(45968): error C2065: ‘DeleteFileW’: undeclared identifier
sqlite3.c(45993): error C2065: ‘FlushFileBuffers’: undeclared identifier
sqlite3.c(45998): error C2065: ‘FormatMessageA’: undeclared identifier
sqlite3.c(46007): error C2065: ‘FormatMessageW’: undeclared identifier
sqlite3.c(46016): error C2065: ‘FreeLibrary’: undeclared identifier
sqlite3.c(46023): error C2065: ‘GetCurrentProcessId’: undeclared identifier
sqlite3.c(46028): error C2065: ‘GetDiskFreeSpaceA’: undeclared identifier
sqlite3.c(46037): error C2065: ‘GetDiskFreeSpaceW’: undeclared identifier
sqlite3.c(46046): error C2065: ‘GetFileAttributesA’: undeclared identifier
sqlite3.c(46054): error C2065: ‘GetFileAttributesW’: undeclared identifier
sqlite3.c(46062): error C2065: ‘GetFileAttributesExW’: undeclared identifier
sqlite3.c(46071): error C2065: ‘GetFileSize’: undeclared identifier
sqlite3.c(46079): error C2065: ‘GetFullPathNameA’: undeclared identifier
sqlite3.c(46088): error C2065: ‘GetFullPathNameW’: undeclared identifier
sqlite3.c(46096): error C2065: ‘GetLastError’: undeclared identifier
sqlite3.c(46107): error C2065: ‘GetProcAddress’: undeclared identifier
sqlite3.c(46117): error C2065: ‘GetSystemInfo’: undeclared identifier
sqlite3.c(46124): error C2065: ‘GetSystemTime’: undeclared identifier
sqlite3.c(46129): error C2065: ‘GetSystemTimeAsFileTime’: undeclared identifier
sqlite3.c(46138): error C2065: ‘GetTempPathA’: undeclared identifier
sqlite3.c(46146): error C2065: ‘GetTempPathW’: undeclared identifier
sqlite3.c(46154): error C2065: ‘GetTickCount’: undeclared identifier
sqlite3.c(46162): error C2065: ‘GetVersionExA’: undeclared identifier
sqlite3.c(46172): error C2065: ‘GetVersionExW’: undeclared identifier
sqlite3.c(46180): error C2065: ‘HeapAlloc’: undeclared identifier
sqlite3.c(46186): error C2065: ‘HeapCreate’: undeclared identifier
sqlite3.c(46195): error C2065: ‘HeapDestroy’: undeclared identifier
sqlite3.c(46202): error C2065: ‘HeapFree’: undeclared identifier
sqlite3.c(46206): error C2065: ‘HeapReAlloc’: undeclared identifier
sqlite3.c(46211): error C2065: ‘HeapSize’: undeclared identifier
sqlite3.c(46211): fatal error C1003: error count exceeds 100; stopping compilation
NMAKE : fatal error U1077: ‘“C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.EXE”’ : return code ‘0x2’
Stop.

C:\GitHub\sqlcipher\bld>

Maybe a better question is what options do I need to set to ONLY build the sqlite3.h and sqlite3.c amalgamation.

And NOT build the dll or exe ?