directories icon indicating copy to clipboard operation
directories copied to clipboard

NTDDI_VERSION setting conflicts with _WIN32_WINNT setting

Open jonahbeckford opened this issue 11 months ago • 4 comments

I'm compiling this on Windows using DkML (MSVC distribution):

#=== ERROR while compiling directories.0.5 ====================================#
# context     2.2.0~alpha0~20221228 | win32/x86_64 | conf-withdkml.2 ocaml-system.4.14.0 | pinned(https://github.com/OCamlPro/directories/archive/0.5.tar.gz)
# path        C:\Users\beckf\AppData\Local\opam\playground\.opam-switch\build\directories.0.5
# command     C:\Users\beckf\AppData\Local\Programs\DISKUV~1\bin\WITH-D~1.EXE dune build -p directories -j 11 @install
# exit-code   1
# env-file    C:\Users\beckf\AppData\Local\opam\log\directories-24340-62faa2.env
# output-file C:\Users\beckf\AppData\Local\opam\log\directories-24340-62faa2.out
### output ###
# File "_build/.dune/default/src/windows/bindings/dune", line 37, characters 36-57:
# 37 |  (foreign_stubs (language c) (names win_functions_c_stubs))
#                                          ^^^^^^^^^^^^^^^^^^^^^
# (cd _build/default/src/windows/bindings && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe" -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -nologo -O2 -Gy- -MD -I C:/Users/beckf/AppData/Local/Programs/DISKUV~1/lib/ocaml -I C:\Users\beckf\AppData\Local\opam\playground\lib\bigarray-compat -I C:\Users\beckf\AppData\Local\opam\playg[...]
# win_functions_c_stubs.c
# C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\sdkddkver.h(291): fatal error C1189: #error:  NTDDI_VERSION setting conflicts with _WIN32_WINNT setting



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build directories 0.5
└─
╶─ No changes have been performed

The important detail above is Windows SDK 10.0.18362.


I can't make sense of what the code is trying to do with cstubs. I believe https://github.com/OCamlPro/directories/blob/1cf7211f918fa909e5f77c0dfbb059c74071e99b/src/windows/bindings/gen_functions.ml#L25-L29 is doing the equivalent of:

#define NTDDI_VERSION NTDDI_VISTA

If that is true, then the code is missing the equivalent of:

#define _WIN32_WINNT _WIN32_WINNT_VISTA 

per (sometimes wrong) https://stackoverflow.com/questions/21030230/ntddi-version-setting-conflicts-with-win32-winnt-setting

jonahbeckford avatar Jul 08 '23 01:07 jonahbeckford