# Build failure  using Visual Studio 2015  

**URL:** <https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351>\
**Category:** Development\
**Created:** [June 28, 2019, 11:24am UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351 "2019-06-28T11:24:08Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![pradhan.arun479](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pradhan.arun479/32/4058_2.png) [@pradhan.arun479](https://discourse.slicer.org/u/pradhan.arun479)\
**Post date:** [June 28, 2019, 11:24am UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/1 "2019-06-28T11:24:08Z")

</div>

Operating system: windows 10  
Slicer version: 4  
Expected behavior: Should build successfully  
Actual behavior: Build failure .

I am new to 3D slicer , I installed on tools required and checked out sources from Github.  
I configured the project using Cmake gui.  
Source Path :F:/KS/Slicer  
Build Path : F:/KS/Slicer-SuperBuild-Debug

After opening .sln file and building ALL\_BUILD , I am getting several errors  
First few errors are

1. Error MSB6006 “cmd.exe” exited with code 1. python-PyGithub C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets 171

2. Error MSB6006 “cmd.exe” exited with code 1. [F:\KS\Slicer-SuperBuild-Debug\CTK-build\CTK-build\Libs\Widgets\CTKWidgetsPythonQt.vcxproj] [F:\KS\Slicer-SuperBuild-Debug\CTK-build\CTK.vcxproj] CTK C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets 171

Can I get some support on how to build successfully.

Thanks  
Arun Pradhan

---

<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:** [June 28, 2019, 3:08pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/2 "2019-06-28T15:08:49Z")

</div>

Only focus on the very first build error, because all the other may be just consequences of that first one. Which one is the very first error?

Which Qt version do you use?

---

<div class="post-metadata">

**Author:** ![pradhan.arun479](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pradhan.arun479/32/4058_2.png) [@pradhan.arun479](https://discourse.slicer.org/u/pradhan.arun479)\
**Post date:** [June 28, 2019, 3:58pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/3 "2019-06-28T15:58:57Z")

</div>

Correct .  
The Qt ver 5.13.0  
First error  
Error MSB6006 “cmd.exe” exited with code 1. python-PyGithub C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets 171

---

<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:** [June 28, 2019, 4:06pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/4 "2019-06-28T16:06:26Z")

</div>

> The Qt ver 5.13.0

This is likely the source of the problem.

Follow [Documentation/Nightly/Developers/Build Instructions - Slicer Wiki](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#Windows) which specifies that to build Slicer for Windows, Qt 5.10.X or older is required.

---

<div class="post-metadata">

**Author:** ![pradhan.arun479](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pradhan.arun479/32/4058_2.png) [@pradhan.arun479](https://discourse.slicer.org/u/pradhan.arun479)\
**Post date:** [June 28, 2019, 4:56pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/5 "2019-06-28T16:56:19Z")

</div>

@lassoan  
Sorry ,I gave you incorrect information 🙂  
The Qt ver 5.10.1

---

<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:** [June 28, 2019, 10:22pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/6 "2019-06-28T22:22:35Z")

</div>

I don’t remember seeing such an error. Since this message only indicates that python-PyGithub build failed but does not contain the actual error message, we cannot do much. You need to find the error message printed by this subproject. Try to build just this subproject and have a look at all the most recently modified files in all the build folders to find the relevant log file (probably .log or .txt file).

---

<div class="post-metadata">

**Author:** ![pradhan.arun479](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pradhan.arun479/32/4058_2.png) [@pradhan.arun479](https://discourse.slicer.org/u/pradhan.arun479)\
**Post date:** [June 29, 2019, 6:06am UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/7 "2019-06-29T06:06:06Z")

</div>

@lassoan

I just complied this sub project and got these errors , few of these are mentioned here

Error MSB6006 “cmd.exe” exited with code 1. python-PyGithub C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets 171   
Error LNK1120 154 unresolved externals [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_ssl\extension\_ssl.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\python-build\Lib\lib-dynload\Release\_ssl.pyd 1   
Error LNK1120 24 unresolved externals [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_hashlib\extension\_hashlib.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\python-build\Lib\lib-dynload\Release\_hashlib.pyd 1   
Error LNK2019 unresolved external symbol ASN1\_INTEGER\_get referenced in function \_decode\_certificate [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_ssl\extension\_ssl.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\_ssl.obj 1   
Error LNK2019 unresolved external symbol ASN1\_item\_d2i referenced in function \_get\_peer\_alt\_names [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_ssl\extension\_ssl.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\_ssl.obj 1   
Error LNK2019 unresolved external symbol ASN1\_OBJECT\_free referenced in function \_ssl\_nid2obj\_impl [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_ssl\extension\_ssl.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\_ssl.obj 1   
Error LNK2019 unresolved external symbol ASN1\_STRING\_data referenced in function \_get\_peer\_alt\_names [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_ssl\extension\_ssl.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\_ssl.obj 1   
Error LNK2019 unresolved external symbol ASN1\_STRING\_length referenced in function \_get\_peer\_alt\_names [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_ssl\extension\_ssl.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\_ssl.obj 1   
Error LNK2019 unresolved external symbol ASN1\_STRING\_to\_UTF8 referenced in function \_create\_tuple\_for\_attribute [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_ssl\extension\_ssl.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\_ssl.obj 1   
Error LNK2019 unresolved external symbol ASN1\_TIME\_print referenced in function \_decode\_certificate [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_ssl\extension\_ssl.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\_ssl.obj 1   
Error LNK2019 unresolved external symbol AUTHORITY\_INFO\_ACCESS\_free referenced in function \_get\_aia\_uri [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_ssl\extension\_ssl.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\_ssl.obj 1

---

<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:** [June 29, 2019, 1:25pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/8 "2019-06-29T13:25:35Z")

</div>

Build paths as long as “F:\KS\Slicer-Superbuild-Debug” are known to cause various build issues. Retry the build from scratch, putting source code in F:\S4 and build in F:\S4D.

If you build Slicer using Qt that was built without SSL (I think Qt binaries that you download from Qt installer are built without SSL) then you may need to disable SSL support when you configure your Slicer build in CMake.

---

<div class="post-metadata">

**Author:** ![pradhan.arun479](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pradhan.arun479/32/4058_2.png) [@pradhan.arun479](https://discourse.slicer.org/u/pradhan.arun479)\
**Post date:** [June 29, 2019, 5:07pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/9 "2019-06-29T17:07:16Z")

</div>

@lassoan.

Thanks for pointing .  
May I know which Cmake I should make a change as there many in multiple level ?  
This would really help.

---

<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:** [June 30, 2019, 1:16am UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/10 "2019-06-30T01:16:23Z")

</div>

You can search for CMake variables by name in CMake GUI. To disable SSL, configure top-level build with Slicer\_USE\_PYTHONQT\_WITH\_OPENSSL set to OFF. But first just try to build Slicer in a shorter path (F:\S4, F:\S4D).

---

<div class="post-metadata">

**Author:** ![pradhan.arun479](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pradhan.arun479/32/4058_2.png) [@pradhan.arun479](https://discourse.slicer.org/u/pradhan.arun479)\
**Post date:** [June 30, 2019, 10:31am UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/11 "2019-06-30T10:31:02Z")

</div>

@lassoan

Thanks , Now I am getting less errors . Ilisted down 1st error and few warnings.  
Now these are the link errors

1. Error LNK1120 24 unresolved externals [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_hashlib\extension\_hashlib.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\python-build\Lib\lib-dynload\Release\_hashlib.pyd 1   
Warning LNK4098 defaultlib ‘MSVCRTD’ conflicts with use of other libs; use /NODEFAULTLIB:library [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_binascii\extension\_binascii.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\LINK 1   
Warning LNK4098 defaultlib ‘MSVCRTD’ conflicts with use of other libs; use /NODEFAULTLIB:library [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_bz2\extension\_bz2.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\LINK 1   
Warning LNK4272 library machine type ‘X86’ conflicts with target machine type ‘x64’ [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_hashlib\extension\_hashlib.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\OpenSSL-install\Release\lib\ssleay32.lib 1   
Warning LNK4272 library machine type ‘X86’ conflicts with target machine type ‘x64’ [F:\KS\Slicer-SuperBuild-Debug\python-build\CMakeBuild\extensions\extension\_hashlib\extension\_hashlib.vcxproj] python F:\KS\Slicer-SuperBuild-Debug\OpenSSL-install\Release\lib\libeay32.lib 1

---

<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:** [June 30, 2019, 12:16pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/12 "2019-06-30T12:16:50Z")

</div>

Build paths as long as “F:\KS\Slicer-Superbuild-Debug” are known to cause various build issues. Retry the build from scratch, putting source code in F:\S4 and build in F:\S4D.

---

<div class="post-metadata">

**Author:** ![gcsharp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gcsharp/32/863_2.png) [@gcsharp](https://discourse.slicer.org/u/gcsharp)\
**Post date:** [June 30, 2019, 3:07pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/13 "2019-06-30T15:07:44Z")

</div>

The wiki page says 50 character limit. The recommended path was:

For example: `C:\Slicer-SuperBuild-Debug` or `C:\Slicer-SuperBuild-Release` .

I updated the page to make the recommended path shorter, but not sure what to do about the 50 character limit.

---

<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:** [June 30, 2019, 4:24pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/14 "2019-06-30T16:24:37Z")

</div>

50 character limit is not accurate (especially since VTK modularization, which dramatically increased number of include directories). I’ve updated the build instructions to recommend limiting the source and build directory path lengths to _10_ characters.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [June 30, 2019, 6:37pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/15 "2019-06-30T18:37:03Z")

</div>

Since it is hard to reliably warn developer, should we just remove the [PreventDirWithTooManyChars](https://github.com/Slicer/Slicer/blob/master/CMake/PreventDirWithTooManyChars.cmake) module and only rely on the documentation ?

I am also wondering if the generated solutions files (or makefile, ninja file) could be analyzed after configuration to detect use of long command line and long path.

---

<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:** [June 30, 2019, 8:39pm UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/16 "2019-06-30T20:39:21Z")

</div>

> [@jcfr](#):
>
> I am also wondering if the generated solutions files (or makefile, ninja file) could be analyzed after configuration to detect use of long command line and long path.

There are a couple of different things that may fail with long paths. It would be very hard to detect them all.

Instead, we could fix many issues by installing VTK and ITK and use that install tree from Slicer. It would reduce the number of include and library directories, so command lines would less likely to become too long. We tried this in Plus toolkit and I think there were no major complications.

---

<div class="post-metadata">

**Author:** ![pradhan.arun479](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pradhan.arun479/32/4058_2.png) [@pradhan.arun479](https://discourse.slicer.org/u/pradhan.arun479)\
**Post date:** [July 1, 2019, 2:35am UTC](https://discourse.slicer.org/t/build-failure-using-visual-studio-2015/7351/17 "2019-07-01T02:35:52Z")

</div>

@lassoan

the shorter directory length works for me , I could compile the Slicer .  
Thanks  
Arun
