Build failure using Visual Studio 2015

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

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?

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

The Qt ver 5.13.0

This is likely the source of the problem.

Follow Documentation/Nightly/Developers/Build Instructions - Slicer Wiki which specifies that to build Slicer for Windows, Qt 5.10.X or older is required.

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

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).

@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

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.

@lassoan.

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

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).

@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

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.

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.

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.

Since it is hard to reliably warn developer, should we just remove the PreventDirWithTooManyChars 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.

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.

1 Like

@lassoan

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

1 Like