Closed dzenanz closed 2 years ago
castxml
internally runs the compiler command given to --castxml-cc-msvc
in order to detect its preprocessing behavior. In this case, it's running cl ... -FoNUL ...
, where the -FoNUL
option is supposed to suppress generating any actual output file. Windows has a special hook to name the NUL
device (equivalent to /dev/null
) in as a file in any directory. Maybe something changed in Windows 11.
Try creating an empty foo.c
source file, and run cl -c foo.c -FoNUL
at the command prompt manually.
The result of cl -c foo.c -FoNUL is an object file called NUL.obj
C:\src\castxml_test>cl -c foo.c -FoNUL
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30140 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
foo.c
C:\src\castxml_test>dir
Volume in drive C is OS
Volume Serial Number is 1A9E-6A0B
Directory of C:\src\castxml_test
03/07/2022 01:33 PM <DIR> .
03/07/2022 01:30 PM <DIR> ..
03/07/2022 01:33 PM 0 foo.c
03/07/2022 01:33 PM 485 NUL.obj
3 File(s) 490 bytes
2 Dir(s) 742,621,663,232 bytes free
I just checked: echo blah >null.txt
produces a file on Windows 11, but not on Windows 10. echo blah >null
does not produce a file on Windows 11 either.
@aylward @dzenanz please visit HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Null
in regedit
and check the value of the Start
setting.
On both Windows 10 and 11, in HKLM\SYSTEM\ControlSet001\Services\Null
, Start
is 0x00000001
.
@dzenanz thanks. Please try your echo blah >nul.txt
experiment with the name nul.txt
rather than null.txt
. The NUL
device name is supposed to work with any extension, IIUC. We've been relying on -FoNUL
causing cl
to write to NUL.obj
, which should also be the null device.
Sorry, I meant nul.txt
, not null.txt
. So:
echo blah >nul.txt
produces a file on Windows 11, but not on Windows 10. echo blah >nul
does not produce a file on Windows 11 either.
I accidently copied null
instead of nul
earlier, because I was trying both.
Thanks. We can't prevent cl
from adding the .obj
suffix, so I'll look into another approach.
I opened CastXML/CastXML#211 for this.
I released CastXML 0.4.5 with an update to avoid depending on -FoNUL
.
@aylward did you run into this? You could try with an external build of CastXML, by turning ITK_USE_SYSTEM_CASTXML
on.
Binaries for CastXML 0.4.5 are being built.
Binaries updated in #3324
Python wrapping fail to compile with Ninja generator when using MSVC compile from VS2019 on Windows 11.
Steps to Reproduce
cmake -DITK_WRAP_PYTHON=ON -GNinja ..\ITK-git
ninja
Expected behavior
Compiles without errors.
Actual behavior
Reproducibility
Versions
Environment
Multiple versions of ITK and CMake. Key ingredients are
ninja
and Windows 11.