Unable to compile latest Slicer sources (Windows)

I was asked today to do a test with the very latest latest preview sources.
Thought this would be a good exercise because I thought had it all set up, simply not used for several weeks.

What I did:

  • Within Github I fetched the latest Slicer changes to my personal Slicer fork.
  • Made sure that I use the master branch.
  • Pulled from the master fork to my development system.
  • Performed a full cmake
mkdir D:\D\S4R
cd /d D:\D\S4R
"C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 16 2019" -A x64 -DQt5_DIR:PATH=D:\Qt\5.15.1\msvc2019_64\lib\cmake\Qt5 D:\D\S4
"C:\Program Files\CMake\bin\cmake.exe" --build . --config Release
echo %time%
pause

  • Opend Visual Studio and loaded slicer.sln from d:\D\S4R
  • Build ā€œALL_BUILDā€ with Visualstudio 2019 (worked beforew)

and received two errors:

Severity Code Description Project File Line Suppression State
Error C2666 ā€˜operator ==ā€™: 5 overloads have similar conversions vtkSlicerMarkupsModuleLogic D:\D\S4\Modules\Loadable\Markups\Logic\vtkSlicerMarkupsLogic.cxx 264
Severity Code Description Project File Line Suppression State
Error (active) E0350 more than one operator == matches these operands: vtkSlicerMarkupsModuleLogic D:\D\S4\Modules\Loadable\Markups\Logic\vtkSlicerMarkupsLogic.cxx 264

What have I done wrong ?
In general: Is cmake necessary after every pull from the Slicer fork ?

Thank you.

You can see on the dashboard if there are any build errors using the official build configuration.

If there are no build errors there but Slicer fails to build on your computer then it is most likely due to using slightly different build tools or options. You can find the exact compiler version, Qt version, etc. on the dashboard (see build notes and in the beginning of the build logs).

The ā€œmore than one operator == matches these operandsā€ usually means that you need to make a comparison more explicit by casting one or both operands to a more specific type (for example, use ActiveMarkupsNode->GetPointer() instead of just ActiveMarkupsNode). We had a similar build error a couple of weeks ago and a the same fix (adding GetPointer()) should work for you. We donā€™t understand yet why this syntax is needed for certain compilers in certain parts of the code (most places this is not necessary). but the change is harmless enough so if it works for you then please submit a pull request to apply it to the Slicer core, too.

A full build is only needed if one of the dependencies (VTK, CTK, ITK, ā€¦) are updated, which is quite rare. You can usually just build <Slicer-top-level-build-folder>/Slicer-build/Slicer.sln in Visual Studio (see details here).

I tried a complete rebuild from scratch deleting all local files and cloned into ā€œS4ā€ from my personal Slicer fork (master) (fetched all recent changes from GitHub - Slicer/Slicer: Multi-platform, free open source software for visualization and image computing. before)
Then again cmake config release.
After several hours, it finished without error and I saw that the location of slicer.sln had been changed to the root of ā€œS4Rā€
I opened that with visual studio 19 and ā€œBUILD ALLā€.
After another several hours, Slicer got built better, but at least two errors occurred - ā€œSimpleITKā€ still refuses to build today.

At least I can now confirm that Lung CT Segmenter works with correct slice switches in the recent preview 4.13.

Are build errors normal and to be expected in the preview ?

In the end it turned out, that a complete build of 4.13.0-2021-10-01 r30278 free of errors required a local Python install including setting the Python ā€œPathā€ variable on Windows 10.

SimpleITK would not build without that install in VS2019 and fail with an error message pointing in that direction.

My Slicer build prerequisites are
(Windows 10)

CMake >= 3.15.1
Git >= 1.7.10
NSIS (optional)
Qt5
Visual Studio
Python >= 3.9

You did not mention that you switched to the correct build mode in Visual Studio. Your first failures might have been due to building in Visual Studio in default Debug mode, while using CMake to built in Release mode.

There are two Slicer.sln files in your build tree. One in the top-level build, one in n the inner build. The former builds all dependencies, the latter only builds Slicer application.

You do not need any other Python other than what Slicer builds for itself and any additional local Python installs known to interfere with the build process (SimpleITK and other SuperBuild-type extensions fail the build). The simplest workaround is to temporarily rename other Python installations. See more information here: Slicer build error with VTK9 in debug mode due to SimpleITK Python configuration problem Ā· Issue #5498 Ā· Slicer/Slicer Ā· GitHub

So I uninstalled Python 3.9 and tried to build SimpleITK again in VS2019 either in Debug and Release mode.
Both failed, the latter (Release) with:

18> Could NOT find Python3 (missing: Python3_EXECUTABLE Python3_LIBRARIES
18> Python3_INCLUDE_DIRS Interpreter Development.Module) (Required is at least
18> version ā€œ3.6ā€)

I used the Slicer.sln present at c:/D/S4R.

What CMake version do you use? With CMake 3.19.6 I donā€™t have any SimpleITK build issues, unless some other Python versions are installed on my computer that CMake finds. Iā€™ll start a clean build with latest CMake (3.21.3) and see if I can reproduce the build issue.

In the meantime, can you upload your full build log somewhere (dropbox, onedrive, ā€¦) and post the link here so that I can check if there is any sign of some Python installation interferes with the build?

Have we listed Python as a dependency somewhere? If yes, could you please send us the link?

Saw this too late, I will have to do the full build later and overnight and probably have the log tomorrow.

No, this is not officially listed, it was just my own memo.

I did the full release build last night, there was a SimpleITK issue, here is the log file:

https://drive.google.com/drive/folders/1PGXiCAJMTx--4gV3sK9fvLF5cM_HDL09?usp=sharing

My CMake version is 3.20.5.

1 Like

Iā€™ve noticed this warning:

47>D:\D\S4R\SlicerExecutionModel\CMake\WindowsApplicationUseUtf8.manifest : manifest authoring warning 81010002: Unrecognized Element ā€œactiveCodePageā€ in namespace ā€œhttp://schemas.microsoft.com/SMI/2019/WindowsSettingsā€. [D:\D\S4R\SlicerExecutionModel-build\GenerateCLP\GenerateCLPLauncher.vcxproj]

This indicates that you are building using a very old Windows SDK. Installing a more recent version should fix the warning, but by default you should have an SDK that supports activeCodePage setting.

What Windows version do you use?
Have you installed Visual Studio 2019 from scratch or you upgraded from some older versions that were previously installed?

In the meantime, Iā€™m trying to reproduce the error that you have, so far without success.

@rbumm Probably Python detection is broken in CMake-3.20. Could you try upgrading to latest CMake (3.21.3) and restart the build from scratch?

I updated CMake but unfortunately also tried to install the latest Windows SDK at the same time.
This fails continuously over the last day and, in addition, Visual Studio 2019 no longer builds Slicer or any of my other projects. So I can not test anything right now, sry.

What computer do you use is it Windows 10?

You can fix everything by removing all versions of Visual Studio, Windows SDK, and CMake from your computer and install the current Visual Studio version and CMake. Probably latest Visual Studio automatically installs a good Windows SDK if you are using a current Windows 10 version.

Reinstalling everything was my plan anyway so this fixed the Visual Studio Community 2019 installation on my development PC, ran the build again, latest CMake, no Python installed, this failed again.

Today I tried to reproduce that on on another Windows system: a gaming laptop. Updated CMake.
Fetched, merged and pulled from my Slicer fork, started a full release build with no S4R present
Python 3.9 installed.

set startTime=%time%
mkdir C:\D\S4R
cd /d C:\D\S4R
"C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 16 2019" -A x64 -DQt5_DIR:PATH=D:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5 C:\D\S4
"C:\Program Files\CMake\bin\cmake.exe" --build . --config Release
echo Start Time: %startTime%
echo Finish Time: %time%
pause   

worked well (3 hrs build time, 10 GB S4R directory output size, Slicer starting up correctly, version of yesterday).
Then deleted S4R, uninstalled Python and build again with the same script:
ā†’ same failure as on the other Windows PC.

Hope this is helpful somehow, I could live with having Python installed to make the build, but probably this is not the solution you are going for. Time note: This was certainly not present three months ago, when I did my first full slicer builds.

Very useful information, thank you.

Maybe there is something special in your configurations (e.g., German Windows version or locale) that changes how Slicerā€™s Python is built or detected. Or maybe there is something different in old Visual Studio installations (such as presence of a built-in Python interpreter?).

Can you share the full build log of either the successful or the failed build (preferably both)? That would help us find out where Python is needed and why Slicer Python is not found there.

I observed the same type thing as above when building a fresh new debug build of Slicer. SimpleITK was the only project that failed. I used default configure options for the Slicer superbuild except turned off Build Testing and enabled the MP build flag. SimpleITK was to be built with shared libs. I was using a different Windows machine from what I typically use and also building a debug build which I typically donā€™t use as well. No system python was installed. Using CMake 3.21.3, with Visual Studio 16.11.4, and Windows 11 SDK 10.0.22000 (the latest Windows SDK offered through Visual Studio Installer).

46>CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
46>  Could NOT find Python3 (missing: Python3_EXECUTABLE Python3_LIBRARIES
46>  Python3_INCLUDE_DIRS Interpreter Development.Module) (Required is at least
46>  version "3.6")
46>Call Stack (most recent call first):

I suppose the issue is similar to the old issue with SimpleITK with shared libs in a debug build. In my ā€œC:/S5R/SimpleITK-build/CMakeCache.txtā€ it reports the following where it finds the Slicer python paths correctly, but does not define PYTHON_DEBUG_LIBRARY or PYTHON_LIBRARY_DEBUG which appears to be what the build error was alerting about?

//Path to a library.
PYTHON_DEBUG_LIBRARY:FILEPATH=PYTHON_DEBUG_LIBRARY-NOTFOUND

//Initial cache
PYTHON_EXECUTABLE:PATH=C:/S5R/python-install/bin/PythonSlicer.exe

//Initial cache
PYTHON_INCLUDE_DIR:PATH=C:/S5R/python-install/include

//Initial cache
PYTHON_LIBRARY:FILEPATH=C:/S5R/python-install/libs/python36.lib

//Path to a library.
PYTHON_LIBRARY_DEBUG:FILEPATH=PYTHON_LIBRARY_DEBUG-NOTFOUND

Also in the same file

//Path to a program.
_Python3_CONFIG:INTERNAL=_Python3_CONFIG-NOTFOUND
//Path to a program.
_Python3_EXECUTABLE:INTERNAL=_Python3_EXECUTABLE-NOTFOUND
//Path to a library.
_Python3_LIBRARY_RELEASE:INTERNAL=_Python3_LIBRARY_RELEASE-NOTFOUND
1 Like

Thanks for the feedback, this seems very familiar and SimpleITK has always been the problematic step in my release builds on Windows 10 without Python installed.
I would prefer not to do these hour-long builds again if not needed, just instruct me when to do so and which files would be needed exactly. I would have planned to do a redirect of the full build make file output into a text file without having Python locally installed.

Thanks for all your help, Iā€™ve submitted a pull request that will fix this issue: BUG: Fix Slicer build errors due to failing to configure SimpleITK by lassoan Ā· Pull Request #5942 Ā· Slicer/Slicer Ā· GitHub

3 Likes