Build process failed with errors

My op-system is Windows 10.

Qt5.15.2

CMake version 3.22.2

Visual Studio 17 2022

I’m having errors with the Slicer build process in Release mode. Some errors such as (Error File C:/D/S4R/SimpleITK/CMake/CTestCustom.cmake.in does not exist. SimpleITK C:\D\S4R\CUSTOMBUILD 1) appeared because the folders inside the build folder (S4R) are empty after the configuration process (from CMake). It solved after I copied the specific folder (SimpleITK for example) from another computer where the build successfully completed and built the SimpleITK package only in VS. Still don’t know why my build folder(S4R) are empty.

I followed all the building instructions and installed the prerequisites as the words said here “Windows — 3D Slicer documentation

Another errors I get due to something wrong with the ‘CMakeFile’ in the build folder still don’t know how to fix it. Here is the error in text :

|---|---|---|---|---|---|---|
|Error|MSB8066|Custom build for 'C:\D\S4R\CMakeFiles\b2bcbfa553be6b76f5311151bbb771b6\SimpleITK-configure.rule;C:\D\S4R\CMakeFiles\b2bcbfa553be6b76f5311151bbb771b6\SimpleITK-build.rule;C:\D\S4R\CMakeFiles\b2bcbfa553be6b76f5311151bbb771b6\SimpleITK-install.rule;C:\D\S4R\CMakeFiles\d0fbb327fb5d8976f542b004b1325aa2\SimpleITK-complete.rule;C:\D\S4R\CMakeFiles\dbe9d635f197b17f63b9c895eaab2164\SimpleITK.rule' exited with code 1.|SimpleITK|C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets|242||

and here is the output of the SimpleITK build process:

Same errors here with the CLI:

I had another error (cannot open input file 'optimized.lib' ...) solved with rename the Python libs files.

1>CMake Warning at C:/D/S4R/SimpleITK/CMake/sitkLanguageOptions.cmake:138 (message):
1>  Python version less than 2.7: "".

This indicates that there was something wrong with the Python build.

This may mask the root cause of the error. Please remove the entire build folder (c:/D/S4R) and restart the build from scratch. When the build fails find the very first build error and copy it here. Do not change anything in the build tree until you hear back from us.

Regarding a Python issue, should I update it? Although my current version is 3.10 already…

here is the first build error:

|Error|MSB8066|Custom build for 'C:\D\S4R\CMakeFiles\55933ca4f27d3b7bf2f7c4bb6b3e9b43\python-dicom-requirements-mkdir.rule;C:\D\S4R\CMakeFiles\55933ca4f27d3b7bf2f7c4bb6b3e9b43\python-dicom-requirements-download.rule;C:\D\S4R\CMakeFiles\55933ca4f27d3b7bf2f7c4bb6b3e9b43\python-dicom-requirements-update.rule;C:\D\S4R\CMakeFiles\55933ca4f27d3b7bf2f7c4bb6b3e9b43\python-dicom-requirements-patch.rule;C:\D\S4R\CMakeFiles\55933ca4f27d3b7bf2f7c4bb6b3e9b43\python-dicom-requirements-configure.rule;C:\D\S4R\CMakeFiles\55933ca4f27d3b7bf2f7c4bb6b3e9b43\python-dicom-requirements-build.rule;C:\D\S4R\CMakeFiles\55933ca4f27d3b7bf2f7c4bb6b3e9b43\python-dicom-requirements-generate_project_description.rule;C:\D\S4R\CMakeFiles\55933ca4f27d3b7bf2f7c4bb6b3e9b43\python-dicom-requirements-install.rule;C:\D\S4R\CMakeFiles\d0fbb327fb5d8976f542b004b1325aa2\python-dicom-requirements-complete.rule;C:\D\S4R\CMakeFiles\dbe9d635f197b17f63b9c895eaab2164\python-dicom-requirements.rule;C:\D\S4\CMakeLists.txt' exited with code 1.|python-dicom-requirements|C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets|242||

and here is the output of the build:

I’ve found the issue.

46>-- Found PythonLibs: optimized;C:/D/S4R/python-install/libs/python39.lib;debug;C:/Users/toshiba/AppData/Local/Programs/Python/Python39/libs/python39_d.lib (found suitable exact version "3.9.10")

You installed Python on your computer and added to the system path or some other environment variable. This of course interferes with all other Python installations on your system, including the embedded Python interpreter in Slicer.

I would recommend to remove Python from your system path. Alternatively, you can temporarily (while you are building Slicer), rename the C:/Users/toshiba/AppData/Local/Programs/Python to something else (e.g., C:/Users/toshiba/AppData/Local/Programs/PythonTemp) to make sure that it is not found during the build process.

Build error solved by this… thankyou!

Yet, to execute the Test-Slicer process I’ve get this

Total Test time (real) = 8769.17 sec
1>
1>The following tests FAILED:
1>	622 - py_WebEngine (Timeout)
1>	640 - py_TwoCLIsInParallelTest (Timeout)
1>Errors while running CTest
1>Output from these tests are in: C:/D/S4R/Slicer-build/Testing/Temporary/LastTest.log
1>Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: The command "setlocal
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: "C:\Program Files\CMake\bin\ctest.exe" --force-new-ctest-process -C Release
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :cmEnd
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :cmErrorLevel
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: exit /b %1
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :cmDone
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,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 ==========

here is the “Microsoft.CppCommon.targets” file as a txt:

Microsoft.CppCommon.targets.txt - Google Drive

would you please check it and help me with what is wrong there!

This looks pretty typical. These tests are often unstable and can occasionally fail. You should consider your built Slicer to be working :white_check_mark:.