Windows debug build and python library

Hi all,

What is the status with debug build of Slicer on Windows ? I am trying to build Slicer master (without SimpleITK) on MSVC2017 x64 in Debug with no luck.
I saw some recent changes from @lassoan. e.g. 49f3f0b8.

As I am about to stop trying, I would like to share with you my findings:

I have these kinds of warnings...
CMake Warning (dev) at C:/Work/R-b/vtkAddon/CMake/vtkMacroKitPythonWrap.cmake:242 (target_link_libraries):
Link library type specifier "optimized" is followed by specifier
"optimized" instead of a library name.  The first specifier will be ignored.
Call Stack (most recent call first):
C:/Work/R-b/vtkAddon/CMakeLists.txt:206 (vtkMacroKitPythonWrap)
This warning is for project developers.  Use -Wno-dev to suppress it.
and these kinds of errors...
1>CMake Error at C:/Work/R-b/slicersources-src/CMake/SlicerMacroBuildApplication.cmake:462 (get_filename_component):
get_filename_component unknown component
C:/Work/R-b/python-install/libs/python36.lib
Call Stack (most recent call first):
C:/Work/RFC/RFCo/Src/rfviewer/Applications/RFViewerApp/CMakeLists.txt:87 (slicerMacroBuildApplication)

This is because the variable PYTHON_LIBRARY is equal to:
optimized;C:/Work/R-b/python-install/libs/python36.lib;debug;C:/Work/Python/Python36/libs/python36_d.lib

According to the following 3 interesting links…
https://cmake.org/pipermail/cmake/2016-April/063150.html
https://github.com/Slicer/VTK/pull/24
https://gitlab.kitware.com/cmake/cmake/-/commit/a12d8a03af8430d0a570c97deb200e16830568eb

… it seems (at least according to the last commit message) that it is ok to have PYTHON_LIBRARY=optimized;...;debug;...

Do you confirm ? Therefore should the fix done on FindPythonLibs be applied everywhere ? If so, what about the warnings ? And what about the erroneous debug python path found on system ?

For information, when configuring Slicer/CMakeLists.txt (inner build, not superbuild), it seems that PYTHON_LIBRARY is fine (i.e. C:/Work/R-b/python-install/libs/python36.lib) until find_package(CTK REQUIRED) is called. It is then equal to optimized;...;debug;...

Thanks for the detailed report :pray:

Could you try with this patch applied to CTK: https://github.com/commontk/CTK/pull/901 ?

The PR referenced above will be integrated while finalizing the update to VTK9 (tracked in https://github.com/Slicer/Slicer/issues/4696)

I expect to work on this in the next t weeks.

1 Like