I am trying to compile VTK 9.2.6 under Windows using Visual Studio 2022, CMake 3.25.2 and Python 3.11.2 for bindings. The release compile succeeds, but the debug fails with this error:
I am puzzled as: 1) the debug compile should look for python311_d.lib 2) python311.lib is in any case present under C:\Python311\libs on my system.
I have tried looking at the properties of the Debug configuration in Visual Studio, and the IDE does not show any “python311.lib” in the command line passed to the linker.
Does anyone have any suggestion or have experienced the same?
That error can have a multitude of causes. The mere existence of the file does not necessarily mean the build will be successful.
Do you have it? If not, the build script may be falling back to the release version. Furthermore, the name of the debug link-time libraries may not end with _d. I’ve seen just d for example. The exact name depends on the build script (are you using nmake?).
Thanks for your message. Still not solved the issue and puzzled by it.
These are some facts and considerations:
I am compiling the project from within the Visual Studio IDE by manually selecting build. The Release configuration compiles OK, the Debug does not.
The release and debug Python libraries are in place and CMAKE should have pointed to them correctly, as otherwise the release compile should fail (below a picture of the contents of the libs subdir of the python interpreter
By looking at the properties of the WrappingPyhtonCore project in VisualStudio for the Debug configuration, it looks like that it is pointing to the right library path “C:\Python311\libs\python311_d.lib” and at the debug version of the library “python311_d.lib”
The link error though refers to a missing python311.lib
This is puzzling, as: 1) the project configuration is linking against the debug library python311_d.lib 2) in any case, the release library python311.lib is present in the same folder as the debug library, and so one of the two should be found.
–
I did not find any Debug build in the VTK dashboard. Has anyone tried building a Debug version of VTK 9.2.6 on Windows with wrapping for Python 3.11?
I you went through all that checklist and nothing solved it, you should make sure VS2022 is compatible with whatever version of VS was used to generate those .lib files. VS compilers are not always retro-compatible. Check this: C++ binary compatibility 2015-2022 | Microsoft Learn If VS2013, for example, was used to build Python, you will very likely have problems compiling with VS2022.
Thanks for the note: do I interpret it correctly that I should not expect VTK with Python bindings to Python 3.11 to compile correctly, for example for the debug version? I have looked at the dashboard and there seem not to be any debug version there. Has anyone at VTK tried compiling VTK with Python 3.11 bindings / debug under Windows?
It’s been attempted, but it’s certainly not the norm, no. Are you trying to debug Python itself or do you just want VTK to be Debug? It should work to compile that against a non-debug Python…
I need to debug an external project. I will probably simply compile a Release With Debug info of the external project so it should link to the Release version of VTK. I should be all set with this, as I do not need to put breakpoints or follow the execution within VTK sources.