# Build error on Windows related to CLI build directory

**URL:** <https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738>\
**Category:** Development\
**Tags:** build\
**Created:** [January 8, 2020, 9:25am UTC](https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738 "2020-01-08T09:25:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [January 8, 2020, 9:25am UTC](https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738/1 "2020-01-08T09:25:51Z")

</div>

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

> <https://github.com/Slicer/Slicer/commit/c353d7cc622f1e0f85d7a0b255dae20a1ba588b3>

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](http://slicer.cdash.org/buildSummary.php?buildid=1794380). I use VS2019 with 2015 toolset and Qt 5.10.1.

Has anyone encountered this issue?  
Thanks!

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [January 8, 2020, 11:37am UTC](https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738/2 "2020-01-08T11:37:11Z")

</div>

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

> [@Not all modules are enabled after build](https://discourse.slicer.org/t/not-all-modules-are-enabled-after-build/9644):
>
> Hi, I have build the 3d slicer following the instructions given in the document. I am getting the following error: CUSTOMBUILD : error : Target (for copy\_if\_different command) “C:/D/D/Slicer-build/lib/Slicer-4.11/cli-modules/Debug” is not a directory. [C:\D\D\Slicer-build\Base\QTCLI\Testing\InstallPyCLITest4.vcxproj] This is what I get when I launch the slicer.exe qt.network.ssl: QSslSocket: cannot resolve SSL\_set\_alpn\_protos qt.network.ssl: QSslSocket: cannot resolve SSL\_CTX\_set\_alpn\_select…

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 8, 2020, 1:58pm UTC](https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738/3 "2020-01-08T13:58:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sam\_Horvath](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sam_horvath/32/3092_2.png) [@Sam\_Horvath](https://discourse.slicer.org/u/Sam_Horvath)\
**Post date:** [January 8, 2020, 2:56pm UTC](https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738/4 "2020-01-08T14:56:07Z")

</div>

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.

> <https://github.com/Slicer/Slicer/commit/d299d1527583f5e3b07bbd2838d84b0ce13323a3>

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [January 8, 2020, 5:26pm UTC](https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738/5 "2020-01-08T17:26:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 8, 2020, 9:40pm UTC](https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738/6 "2020-01-08T21:40:09Z")

</div>

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](https://discourse.slicer.org/t/not-all-modules-are-enabled-after-build/9644), 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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 9, 2020, 4:38am UTC](https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738/7 "2020-01-09T04:38:43Z")

</div>

Submitted a fix for this build error: [https://github.com/Slicer/Slicer/commit/f59653b8b7aa527ceeaacfa3296b009064619bf7](https://github.com/Slicer/Slicer/commit/f59653b8b7aa527ceeaacfa3296b009064619bf7)

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

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [January 9, 2020, 7:41am UTC](https://discourse.slicer.org/t/build-error-on-windows-related-to-cli-build-directory/9738/8 "2020-01-09T07:41:52Z")

</div>

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.
