Build Slicer on Windows 10 Failed

What do you plan to develop? You have full access to all Slicer internals from Python and there are many customization options, so there are very few things that actually requires rebuilding of Slicer.

Build instructions are up-to-date for latest stable (Slicer-4.8) and we’ll provide build instructions for latest version (Slicer-4.9) within a few weeks (you can monitor status of this task here). Until then, you should be able to build based on hints provided by @jamesobutler above.

Dear Andras,
I am working with Karol Miller at ISML laboratory. I am a PhD student and just started my Phd. Initial plan is to integrate meshless (nodes not meshes) solutions developed at ISML for generating patient specific computational grids from MRI images.

I have to figure out how to generate this computational grid on images. any idea from where I can start after building slicer?

Regards,
Saima

Again, you don’t need to build Slicer to extend it.

We are collaborating with your group already (I think we even have some joint funded project), so the best would be to have a Skype call to have a quick discussion about this. Please write me a private message or send an email to find a suitable time.

try uninstall python, restart, reconfigure using cmake. The best experience for me to build Slicer is using fresh installed windows then build Slicer requirements, after that build Slicer.

Also, I found building and using Slicer in Ubuntu is mush simpler and faster.

It is always the easiest to build on the platform you are the most familiar with.

There is some truth in the points you described above, but there are simpler solutions to address these issues.

You can have Python versions installed, but you should never add Python path to global (system or user) environment variables. You may uninstall Python as a solution, but it is enough if you check that your global environment is not polluted.

There is no need for a “clean” Windows install, the only important requirement is that if you must install multiple Visual Studio versions, always install the older versions first.

1 Like

I build the slicer last night. I see the Slicer.exe now in superbuild folder.

But in the error list I also see the following errors:
Severity Code Description Project File Line Suppression State
Error LNK1104 cannot open file ‘Qt5::Widgets-NOTFOUND.obj’ [C:\Slicer-r26813\superbuild4.9\CTKAppLauncherLib-build\CTKAppLauncher.vcxproj] CTKAppLauncherLib C:\Slicer-r26813\superbuild4.9\LINK 1
Severity Code Description Project File Line Suppression State
Error MSB6006 “cmd.exe” exited with code 1. [C:\Slicer-r26813\superbuild4.9\CTK-build\CTK-build\Libs\Widgets\CTKWidgetsPythonQt.vcxproj] [C:\Slicer-r26813\superbuild4.9\CTK-build\CTK.vcxproj] CTK C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets 171

I also see lots of warnings in the output window of visual studio:
about 900+ for deprecated and some others.

During configuration I did what suggested by James.
Thanks James

While building Run_Tests under cmake predefined target folder. I received following errors.
The following tests FAILED:
1> 7 - py_cmake_slicer_extensions_index_build_without_upload (Failed)
1> 8 - py_cmake_slicer_extensions_index_build_with_upload (Failed)
1> 9 - py_cmake_slicer_extensions_index_build_with_upload_using_ctest (Failed)
1> 10 - py_cmake_slicer_extensions_index_build_without_upload_using_ctest (Failed)
1> 177 - qMRMLLayoutManagerTest1 (Failed)
1> 180 - qMRMLLayoutManagerTest4 (Failed)
1> 181 - qMRMLLayoutManagerVisibilityTest (Failed)
1> 363 - py_NeurosurgicalPlanningTutorialMarkupsSelfTest (Failed)
1> 405 - qSlicerReformatModuleWidgetGenericTest (Failed)
1> 433 - py_VolumeRenderingThreeDOnlyLayout (Timeout)
1> 438 - py_nomainwindow_qSlicerDataProbeModuleGenericTest (Failed)
1> 439 - py_nomainwindow_qSlicerDMRIInstallModuleGenericTest (Failed)
1> 440 - py_nomainwindow_qSlicerEditorModuleGenericTest (Failed)
1> 441 - py_ThresholdThreadingTest (Failed)
1> 442 - py_StandaloneEditorWidgetTest (Failed)
1> 443 - py_nomainwindow_qSlicerLabelStatisticsModuleGenericTest (Failed)
1> 445 - py_nomainwindow_qSlicerPerformanceTestsModuleGenericTest (Failed)
1> 446 - py_nomainwindow_qSlicerSampleDataModuleGenericTest (Failed)
1> 447 - py_nomainwindow_qSlicerScreenCaptureModuleGenericTest (Failed)
1> 450 - py_nomainwindow_qSlicerSegmentStatisticsModuleGenericTest (Failed)
1> 452 - py_nomainwindow_qSlicerSelfTestsModuleGenericTest (Failed)
1> 453 - py_nomainwindow_qSlicerSurfaceToolboxModuleGenericTest (Failed)
1> 454 - py_nomainwindow_qSlicerVectorToScalarVolumeModuleGenericTest (Failed)
1> 455 - py_nomainwindow_qSlicerExtensionWizardModuleGenericTest (Failed)
1> 456 - py_nomainwindow_qSlicerEndoscopyModuleGenericTest (Failed)
1> 457 - py_nomainwindow_qSlicerDICOMModuleGenericTest (Failed)
1> 458 - py_nomainwindow_qSlicerDICOMPatcherModuleGenericTest (Failed)
1> 459 - py_DICOMPatcher (Failed)
1> 549 - slicer_nomainwindow_NoApplicationInformationOptionTest (Timeout)
1> 587 - py_nomainwindow_SlicerOptionDisableSettingsTest (Failed)
1> 603 - py_nomainwindow_DCMTKPrivateDictTest (Failed)
1> 609 - py_DICOMReaders (Failed)
1> 612 - py_SlicerMRBMultipleSaveRestoreLoopTest (Failed)
1> 614 - py_SlicerMRBSaveRestoreCheckPathsTest (Failed)
1> 617 - py_Charting (Failed)
1> 622 - py_RSNAVisTutorial (Failed)
1> 630 - py_JRC2013Vis (Failed)
1> 632 - py_SubjectHierarchyGenericSelfTest (Failed)
1> 638 - py_nomainwindow_qSlicerMultiVolumeImporterModuleGenericTest (Failed)
1> 639 - py_nomainwindow_qSlicerSimpleFiltersModuleGenericTest (Failed)
1> 640 - py_SimpleFiltersModuleTest (Failed)
1> 658 - EMSegCL_Task_BRAINS_MRIHumanBrain_scalartype_float_very_small_fetchData (Failed)
1> 659 - EMSegCL_Task_BRAINS_MRIHumanBrain_scalartype_float_very_small (Failed)
1> 660 - EMSegCL_Task_BRAINS_MRIHumanBrain_scalartype_uint_very_small_fetchData (Failed)
1> 661 - EMSegCL_Task_BRAINS_MRIHumanBrain_scalartype_uint_very_small (Failed)
1> 675 - py_nomainwindow_qSlicerLandmarkRegistrationModuleGenericTest (Failed)
1> 676 - py_LandmarkRegistration (Failed)
1>Errors while running CTest
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: The command “setlocal
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: “C:\Program Files\CMake\bin\ctest.exe” --force-new-ctest-process -C Release
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmEnd
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmErrorLevel
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: exit /b %1
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmDone
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: :VCEnd” exited with code 8.
1>Done building project “RUN_TESTS.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Have you started Visual Studio using Slicer.exe --VisualStudio?

https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/Debug_Instructions#Using_Visual_Studio

No I did not. I will do like you mentioned.

If you are building Slicer nightly that uses Qt5, I should probably provide some additional hints regarding the installation of Qt.

With the Qt5 installer, choose Qt 5.10.1 with the option for the “MSVC 2015 x64” binaries since you are building with the msvc 2015 toolset(v140). You will also need to check the option to install “QWebEngine” under the 5.10.1 heading and I believe also the “Qt Script (deprecated)” option.

Note for Qt 5.11, QWebEngine is now only available for MSVC 2017 due to Chromium requirements, so QWebEngine won’t actually install even if it is checked and you choose the “MSVC 2015 x64” for Qt Core. So stick with Qt version 5.10.1 for now. I know this to work.

Slicer developers will need to confirm all dependicies can be built with MSVC 2017 if QWebEngine is to be used from the latest Qt5 versions.

James, I have used qt5.10.1, Visual studio community 2017 with msvc 2015 toolset v140. Slicer source code downloaded using:
svn co http://svn.slicer.org/Slicer4/branches/Slicer-4-8 Slicer-r26813 -r 26813
cmake 3.9.2.
setting for qt5 in cmake.

I see the Slicer.exe and when I run it, it opens and show me the slicer application.

I did not build QT. Do I need to build it??? I just installed qt binary and provided paths to QT in cmake.
image

So you were able to build Slicer and the application runs successfully. Congrats!

I’m a little confused that your cmake is showing paths to msvc2017_64 which would you would use if you were using the msvc2017 toolset(v141) and not msvc2015 toolset(v140), but if Slicer works I won’t complain.

You don’t have to manually build Qt to get a working build of Slicer. The downloaded binaries will work fine on their own. The qt-easy-build repo is for building Qt with OpenSSL support. I’ll provide an update to the windows powershell scripts for 5.10.0 in that repo soon.

James, Slicer.exe opens like this. It successfully imported 130 modules out of 136
image

what I did wrong. any step need to be corrected to correct it??? I am also confused whether it is build correctly or not??

I think full DICOM support (pyDICOM) requires building Slicer with OpenSSL support enabled.

Saima,

You mentioned using code from a Slicer-48 branch with revision number 26813. This is source code for building Slicer Stable 4.8.1 which should be built with Qt4 though I think there was early support for Qt5. Instead, you should be building the most recent Slicer Nightly/Preview which is using the source code found in the master branch of the Slicer github repo. You don’t need to do anything with svn right now.

Also make sure you download and use Qt 5.10.1 msvc2015_x64 with QWebEngine and Qt Script.

how can I get the source code for latest slicer

I did configuration with ssl support on in cmake but no change.

Hi Saima,

I provided information about where to get the source code for the latest Slicer:

Instead, you should be building the most recent Slicer Nightly/Preview which is using the source code found in the master branch of the Slicer github repo.

Now I didn’t provide a link which I can do now (Slicer Github Repo), but since right now you lack this introductory knowledge about Github, I highly suggest that you proceed development using the latest Slicer binaries and extending on the Slicer platform using Slicer Python Scripting as suggested by @lassoan .

I built slicer in Win10 firstly. what can I do after following this error.
Thanks!
%E6%8D%95%E8%8E%B7

It all looks good! Where do you see an error?

Your source directory path (D:/slicer/Slicer) is a bit too long, which may cause problem later. I would recommend to use D:/D/S4 for source and D:/D/S4D (for debug) or D:/D/S4R (for release) binary directory.