I've built this with mingw.org's MinGW for native MS-Windows. I found several issues during the build, some of them specific to Windows, others more general.
Below are the build-time issues that are specific to MS-Windows, and the proposed patches. Paul, I'll wait for your okay before installing those. Warning in function.c: In file included from src/function.c:17: src/function.c: In function 'func_wordlist': src/makeint.h:524:55: warning: unknown conversion type character 'l' in format [-Wformat=] 524 | #define ON(_t,_a,_f,_n) _t((_a), INTSTR_LENGTH, (_f), (_n)) | ^~~~ src/function.c:827:5: note: in expansion of macro 'ON' 827 | ON (fatal, *expanding_var, | ^~ src/makeint.h:524:55: warning: too many arguments for format [-Wformat-extra-args] 524 | #define ON(_t,_a,_f,_n) _t((_a), INTSTR_LENGTH, (_f), (_n)) | ^~~~ src/function.c:827:5: note: in expansion of macro 'ON' 827 | ON (fatal, *expanding_var, | ^~ src/makeint.h:524:55: warning: unknown conversion type character 'l' in format [-Wformat=] 524 | #define ON(_t,_a,_f,_n) _t((_a), INTSTR_LENGTH, (_f), (_n)) | ^~~~ src/function.c:831:5: note: in expansion of macro 'ON' 831 | ON (fatal, *expanding_var, | ^~ src/makeint.h:524:55: warning: too many arguments for format [-Wformat-extra-args] 524 | #define ON(_t,_a,_f,_n) _t((_a), INTSTR_LENGTH, (_f), (_n)) | ^~~~ src/function.c:831:5: note: in expansion of macro 'ON' 831 | ON (fatal, *expanding_var, | ^~ This is because %lld is not supported by MSVCRT. Warnings in pathstuff.c: src/w32/pathstuff.c: In function 'w32ify': src/w32/pathstuff.c:109:7: warning: 'strncpy' specified bound 260 equals destination size [-Wstringop-truncation] 109 | strncpy(w32_path, filename, sizeof (w32_path)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/w32/pathstuff.c:105:9: warning: 'strncpy' specified bound 260 equals destination size [-Wstringop-truncation] 105 | strncpy (w32_path, fp, sizeof (w32_path)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I fixed those by copying 1 less characters. Error in w32os.c: src/w32/w32os.c:25:10: fatal error: synchapi.h: No such file or directory 25 | #include <synchapi.h> | ^~~~~~~~~~~~ compilation terminated. The MS documentation says to use synchapi.h only since Windows 8, so this inclusion cannot be unconditional Warning in w32os.c: src/w32/w32os.c: In function 'osync_get_mutex': src/w32/w32os.c:434:32: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 434 | sprintf (mutex, "0x%Ix", (unsigned long long)osync_handle); | ^ src/w32/w32os.c: In function 'osync_parse_mutex': src/w32/w32os.c:454:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 454 | osync_handle = (HANDLE) i; | ^ I fixed those by casting to DWORD_PTR first. Here are the proposed patches: --- src/function.c~0 2022-09-18 22:06:17.000000000 +0300 +++ src/function.c 2022-09-24 13:30:01.740875000 +0300 @@ -823,6 +823,15 @@ func_wordlist (char *o, char **argv, con stop = parse_numeric (argv[1], _("invalid second argument to 'wordlist' function")); +#ifdef WINDOWS32 + if (start < 1) + ON (fatal, *expanding_var, + "invalid first argument to 'wordlist' function: '%I64d'", start); + + if (stop < 0) + ON (fatal, *expanding_var, + "invalid second argument to 'wordlist' function: '%I64d'", stop); +#else if (start < 1) ON (fatal, *expanding_var, "invalid first argument to 'wordlist' function: '%lld'", start); @@ -830,6 +839,7 @@ func_wordlist (char *o, char **argv, con if (stop < 0) ON (fatal, *expanding_var, "invalid second argument to 'wordlist' function: '%lld'", stop); +#endif count = stop - start + 1; --- src/w32/pathstuff.c~0 2022-07-07 22:46:05.000000000 +0300 +++ src/w32/pathstuff.c 2022-09-24 13:45:53.303375000 +0300 @@ -102,11 +102,11 @@ w32ify(const char *filename, int resolve if (resolve) { char *fp = _fullpath (NULL, filename, sizeof (w32_path)); - strncpy (w32_path, fp, sizeof (w32_path)); + strncpy (w32_path, fp, sizeof (w32_path) - 1); free (fp); } else - strncpy(w32_path, filename, sizeof (w32_path)); + strncpy(w32_path, filename, sizeof (w32_path) - 1); for (p = w32_path; p && *p; p++) if (*p == '\\') --- src/w32/w32os.c~0 2022-08-31 23:07:28.000000000 +0300 +++ src/w32/w32os.c 2022-09-24 13:58:43.615875000 +0300 @@ -22,7 +22,9 @@ this program. If not, see <http://www.g #include <windows.h> #include <process.h> #include <io.h> +#if _WIN32_WINNT > 0x0601 #include <synchapi.h> +#endif #include "pathstuff.h" #include "sub_proc.h" #include "w32err.h" @@ -429,7 +431,7 @@ osync_get_mutex () /* Prepare the mutex handle string for our children. 2 hex digits per byte + 2 characters for "0x" + null. */ mutex = xmalloc ((2 * sizeof (osync_handle)) + 2 + 1); - sprintf (mutex, "0x%Ix", (unsigned long long)osync_handle); + sprintf (mutex, "0x%Ix", (unsigned long long)(DWORD_PTR)osync_handle); } return mutex; @@ -449,7 +451,7 @@ osync_parse_mutex (const char *mutex) if (endp[0] != '\0') OS (fatal, NILF, _("invalid output sync mutex: %s"), mutex); - osync_handle = (HANDLE) i; + osync_handle = (HANDLE) (DWORD_PTR) i; return 1; }