SlicerRT built from source cannot start

I’ve built Slicer and then SlicerRT from source several times in the past. I followed the online instructions.

In the same computer, I recently updated (via git pull) the Slicer and SlicerRT repositories to master, and then rebuilt from scratch.

The build of Slicer works fine, and I can start Slicer-build/Slicer without problems. The GUI shows perfectly fine, both directly within the computer as well as via ssh -X.

If I call directly /home/user/builds/build-Slicer_src-Desktop-Debug/Slicer-build/bin/SlicerApp-real that works fine, too.

The build of SlicerRt works fine, however, when I now start inner-build/SlicerWithSlicerRT, (no difference if locally or via ssh -X), I get the following error:

SlicerRT_bld/inner-build$ ./SlicerWithSlicerRT 
qt.network.ssl: QSslSocket: cannot resolve SSL_get1_peer_certificate
qt.network.ssl: QSslSocket: cannot resolve EVP_PKEY_get_base_id
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_load_verify_dir
error: [/home/user/builds/build-Slicer_src-Desktop-Debug/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.

so the GUI does not pop up and the program stops.

Note that GLX works fine, glxinfo and glxgears show the right output.

Could you let me know what can I do to debug this issue? Is there a way to get more verbose erro information? Some logfile to check? Any idea why this is happening?

If I start with --verbose-module-discovery --launcher-verbose I get:

Loading module "Endoscopy"
Loading module "Markups"
Loading module "EventBroker"
Loading module "ExecutionModelTour"
Loading module "ExtensionWizard"
Loading module "ExternalBeamPlanning"
error: [/home/user/builds/build-Slicer_src-Desktop-Debug/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.

I am at git commit d4a3d8ef1ccc76f49b7532b63b6bd456f8d752f0 of SlicerRt and c22540839cb55c206331579fc4757b65a2d2540a of Slicer

If I run /home/user/builds/build-Slicer_src-Desktop-Debug/Slicer-build/bin/./SlicerApp-real --additional-module-paths /opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/qt-scripted-modules /opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/qt-loadable-modules /opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/cli-modules --no-splash --verbose-module-discovery

the GUI pops up, but with some warnings:

  File "<string>", line 5, in <module>
  File "<string>", line 5, in <module>
ModuleNotFoundError: No module named 'ctk'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'getSlicerRCFileName' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'slicer'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'slicer'
qSlicerScriptedLoadableModuleFactory - Failed to import module "NA" python extensions
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/user/builds/build-Slicer_src-Desktop-Debug/Slicer-build/lib/Slicer-5.9/qt-scripted-modules/AddManyMarkupsFiducialTest.py", line 3, in <module>
    import ctk
....

Loading module "ExternalBeamPlanning"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/qt-scripted-modules/DoseEngines/__init__.py", line 1, in <module>
    from .AbstractScriptedDoseEngine import *
  File "/opt/SlicerRT_bld/inner-build/lib/Slicer-5.9/qt-scripted-modules/DoseEngines/AbstractScriptedDoseEngine.py", line 2, in <module>
    import vtk, qt, ctk, slicer, logging
ModuleNotFoundError: No module named 'vtk'

....

and DICOM import and many other things are not working.

This looks very similar to 2018-10-15 Windows nightly build "unable to import VTK" so maybe @jcfr has an idea on what’s happening.

There has been various build issues during this recent period of dependency upgrades.

You may want to actually try latest Slicer main (BUG: Fix crashes caused by range-based loops over temporary Qt contai… · Slicer/Slicer@3f4cd76 · GitHub) where the current factory build results are showing it to be successful (SlicerPreview).

SlicerRT currently has known build errors with latest Slicer main. See SlicerPreview - Build Errors. So you may actually want to try latest Slicer Stable 5.8.1 if you are trying to find a configuration that can build SlicerRT successfully. See SlicerStable.

Thanks, I was actually just doing that since a couple of hours, but now I see that I get a build error in SlicerRt:

[ 29%] Building CXX object DicomRtImportExport/ConversionRules/CMakeFiles/vtkSlicerDicomRtImportExportConversionRules.dir/vtkPlanarContourToClosedSurfaceConversionRule.cxx.o
/opt/SlicerRT_src/DicomRtImportExport/ConversionRules/vtkPlanarContourToClosedSurfaceConversionRule.cxx: In member function ‘void vtkPlanarContourToClosedSurfaceConversionRule::TriangulateContourInterior(vtkLine*, vtkCellArray*, bool)’:
/opt/SlicerRT_src/DicomRtImportExport/ConversionRules/vtkPlanarContourToClosedSurfaceConversionRule.cxx:1594:23: error: no matching function for call to ‘vtkPolygon::Triangulate(vtkSmartPointer<vtkIdList>&)’
 1594 |   polygon->Triangulate(polygonIds);
      |   ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /opt/SlicerRT_src/DicomRtImportExport/ConversionRules/vtkPlanarContourToClosedSurfaceConversionRule.cxx:34:
/opt/Slicer_bld/VTK/Common/DataModel/vtkPolygon.h:182:7: note: candidate: ‘virtual int vtkPolygon::Triangulate(int, vtkIdList*, vtkPoints*)’
  182 |   int Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts) override
      |       ^~~~~~~~~~~
/opt/Slicer_bld/VTK/Common/DataModel/vtkPolygon.h:182:7: note:   candidate expects 3 arguments, 1 provided
make[5]: *** [DicomRtImportExport/ConversionRules/CMakeFiles/vtkSlicerDicomRtImportExportConversionRules.dir/build.make:92: DicomRtImportExport/ConversionRules/CMakeFiles/vtkSlicerDicomRtImportExportConversionRules.dir/vtkPlanarContourToClosedSurfaceConversionRule.cxx.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:3726: DicomRtImportExport/ConversionRules/CMakeFiles/vtkSlicerDicomRtImportExportConversionRules.dir/all] Error 2
make[3]: *** [Makefile:166: all] Error 2
make[2]: *** [CMakeFiles/inner.dir/build.make:87: inner-prefix/src/inner-stamp/inner-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:896: CMakeFiles/inner.dir/all] Error 2
make: *** [Makefile:101: all] Error 2

You could try:

polygon->NonDegenerateTriangulate(polygonIds);

It seems VTK 9.5 has made this incompatible change.

I’m having that on Arch Linux too, plus other encoding error messages; I’m using this brute force hack:

diff --git a/Base/Python/slicer/__init__.py b/Base/Python/slicer/__init__.py
index 1443f9b7f8..fbcb831339 100644
--- a/Base/Python/slicer/__init__.py
+++ b/Base/Python/slicer/__init__.py
@@ -183,6 +183,11 @@ except ImportError as detail:
 
 import os
 import sys
+import locale
+
+# 'ANSI_X3.4-1968' codec is being enforced since july 2025.
+# Dumb but needed. Don't use getlocale(). A literal is good also.
+locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())
 
 standalone_python = "python" in str.lower(os.path.split(sys.executable)[-1])

If you don’t want to patch the Slicer source tree, you may update __init__.py in your installed tree:

./bin/Python/slicer/__init__.py

Unfortunately, still nothing for Linux…

Thanks a lot! That solved it partly, but I am getting further errors:


/opt/SlicerRT_src/DoseComparison/Logic/vtkMRMLDoseComparisonNode.cxx: In member function ‘virtual void vtkMRMLDoseComparisonNode::ReadXMLAttributes(const char**)’:
/opt/SlicerRT_src/DoseComparison/Logic/vtkMRMLDoseComparisonNode.cxx:108:59: error: cannot convert ‘vtkStdString’ to ‘const char*’
  108 |       this->SetMaskSegmentID(vtkVariant(attValue).ToString());
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
      |                                                           |
      |                                                           vtkStdString

I will try adding .c_str()

Ok, I managed to compile now. Still aborts when starting the ExternalBeamPlanning module. Even if I edit by hand the init.py file you mentioned.

It’s perhaps time to run in a debugger. The mentioned hack addresses a locale problem in Python, it’s doubtful it would lead to a crash.

Update:

With this hack, Slicer starts but files are badly read (NRRD, DICOM…).

This fix yields a functional Slicer:

locale.setlocale(locale.LC_ALL, "C.UTF-8")

NOTE: this is just a temporary hack for my Linux build at the moment. It should not be needed at all and things should bet back to normal when the library/toolkit/infrastructure upgrade phase is over.