Build error on Windows related to CLI build directory

Hi all,
I have done four Slicer builds recently, and all four had the same issue: the CLI directory was not created:

"c:\d\S4D\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\d\S4D\Slicer.vcxproj" (default target) (33) ->
(CustomBuild target) ->
  CUSTOMBUILD : error : Target (for copy_if_different command) "C:/d/S4D/Slicer-build/lib/Slicer-4.11/cli-modules/Debug" is not a directory. [C:\d\S4D\Slicer-b
uild\Base\QTCLI\Testing\InstallPyCLITest4.vcxproj] [C:\d\S4D\Slicer.vcxproj]

After I created the folder manually, the build succeeded. The latest revision I tried was this one

and the only commit that happened since then is certainly unrelated, so I thought I’d ask about this.

I see that @Sam_Horvath’s windows build on the factory succeeded, however, with VS2017 and Qt 5.12.6. I use VS2019 with 2015 toolset and Qt 5.10.1.

Has anyone encountered this issue?

Yes others have run into this issue including myself though not sure what is the cause. I had also used VS 2019 with 2015 toolset and Qt 5.10.1 when it happened.

See this recent post

Maybe parallel build mechanism or default settings have changed in Visual Studio (or maybe CMake?) recently. Have you updated to Visual Studio or CMake recently? I don’t have any issues with Visual Studio 16.4.2 (menu: Help / Check for updates) and CMake 3.14.3.

Are you changing any of the default slicer options? We have had similar issues in the past, since we only build/test a single options set, where enabling/disabling something causes odd errors; ex.

Thanks for the answers!

I also use Visual Studio 16.4.2 but with CMake 3.16.2.

Regarding CMake options, I always have -DSlicer_USE_PYTHONQT_WITH_OPENSSL:BOOL=ON, and tried with and without SimpleITK. I built Slicer in itself, and as part of custom app as well.
I only tried this on one computer so far, but I’ll try on more and get back with what I found.

I started a build with CMake 3.16.2 and it failed:

CUSTOMBUILD : error : Target (for copy_if_different command) "D:/D/S4R3/Slicer-build/lib/Slicer-4.11/cli-modules/Release" is not a directory. [D:\D\S4R3\Slicer-build\Base\QTCLI\Testing\InstallPyCLITest4.vcxproj] [D:\D\S4R3\Slicer.vcxproj] 

The complete build environment, all tools and options were exactly the same, I just updated CMake from 3.14.3 to 3.16.2. It is either a regression in CMake (which is very common - so far something broke in every major CMake release) or somehow we use CMake incorrectly. As described in the other thread, the problem is that a parallel build is performed by default (and a file is attempted to be copied to a folder that does not exist yet), even though parallel build is not explicitly requested.

It would be interesting to find out why build is not sequential anymore, but it would be probably also useful to allow parallel builds by creating the output directory.

Submitted a fix for this build error:

It would be still nice to find out why CMake behavior is changed but right now I cannot spend more time with this investigation.

1 Like

Thank you Andras! At least your fix will make sure Slicer builds with the latest CMake. I agree that it would be interesting to know the actual reason, but I also don’t have capacity to investigate this. For me, your fix is an acceptable solution to this problem.