Custom build Slicer failed

I use the SlicerCustomAppTemplate to custom the slicer. When I set the option like this %E6%8D%95%E8%8E%B7

when it build, “ctkAbstractPythonManager.h”: No such file or directory [D:\t2\Slicer-build\Base\QTGUI\qSlicerBaseQTGUI.vcxproj] Slicer D:\Projects\Slicer\Base\QTCore\qSlicerCorePythonManager.h 25
the error appears

I want to know if it is the right way to let slicer lighter , and the right way to build costum slicer

Thanks for reporting the problem.

To help address the issue and better understand the context (which options were exactly enabled or disabled, …), here are few suggestions:

  • could you check that the version of Slicer found at the top of the CMakeLists.txt is a recent one. If not, I suggest you update it to be the most recent one. See This will ensure the most recent fixes are included.
  • could you try to configure and build the project using the command line.
    • (1) remove all files from the build directories
    • (2) Open windows command line terminal
    • (3) configure the project with a command like this one cmake.exe -DSlicer_USE_XYZ:BOOL=OFF ... -G "Visual Studio 14 2015" D:\Projects\Slicer. This will allow to easily reproduce the problem.
    • (4) build the project using a command line like cmake --build D:\t2\Slicer-build --config Release -- /m. The /m allows to do a parallel build using Visual Studio.

Thanks for reply!

I want to build a lighter slicer, so I want to custom the Slicer to remove extra modules that I don’t want.

About Slicer Source

I have git clone the Slicer repository on my machine and before the build, I always use commands git pull origin to sync from remote repo

About Options

Here is the screenshot of the Options in CMakeList.txt from the SlicerCustomAppTemplate

About Build

My platform is Win10 X64 version 17763
Here is command-line in my batch file and I use it to generate the VS projects.

mkdir D:\\S1D

cd /d D:\\t3

"D:\\Library\\cmake-3.14.0-rc3-win64-x64\\bin\\cmake.exe" -G "Visual Studio 15 2017 Win64" -T "v140" -Dslicersources_SOURCE_DIR=D:\\Projects\\Slicer -DQt5_DIR:PATH=D:\\Library\\Qt\\Qt5.10.0\\5.10.0\\msvc2015_64\\lib\\cmake\\Qt5 D:\\Projects\\test

And then I use the VS2017 open the .sln to finish the ALL_BUILD.

When it build at Slicer projects, it stopped and throw a error just like this
Can not open include fileimage
I try to add the required .h and .cxx dir in Slicer project include path, It still the same error.

About Something else I want to know

  1. It seems that the Options in the SlicerCustomAppTemplate are not the whole options, Where can I get the whole options

  2. ALL of the Options in SlicerCustomAppTemplate can be TURN OFF? Which ones can be turned off, or Which ones can not be turned off.

  3. How to build the Slicer faster.

Thanks for your reply

Most likely the problem is that the source code path (“D:\Projects\Slicer”) is too long. Try to use “D:\S4” instead.

You can modify any Slicer build options. What options would you like to change?

You can turn off all features that you don’t need. You can search for the name of the option in Slicer source code to see what the impact of turning it off.

Disable all modules that you don’t need will make building and running Slicer much faster.

Note that build time should not be a concern, since a complete build takes only a few hours on a desktop computer (and maybe up to a day on a very slow laptop). After that, you’ll only need to modify and build your own custom modules, which should take just a couple of minutes for a rebuild and a few ten seconds for a regular build.

But I have a successful build with the same source code path with the fully slicer features, When I use the SlicerCustomAppTemplate and turn off some features, it doesn’t work.

Thanks, that is helpful. Looks like you are building with default options associated with the template (where python is disabled), we should be able to fix the issue.

Note that we will soon setup continuous integration for the SlicerCustomAppTemplate project itself, this should allow us to catch such regression.

1 Like

when it build, “ctkAbstractPythonManager.h”: No such file or directory [D:\t2\Slicer-build\Base\QTGUI\qSlicerBaseQTGUI.vcxproj] Slicer D:\Projects\Slicer\Base\QTCore\qSlicerCorePythonManager.h 25
the error appears

That said, it is strange to see this error because with Slicer_USE_PYTHONQT set to OFF in your build tree, there should be no attempt to build the qSlicerCorePythonManager class.

1 Like

Thanks for your reply!
I will try to build Slicer in a clean environment on another machine later on.

something confusing

  • If I can use the same slicer source for multiple builds, will they interfere with each other?
  • Are the fully custom build options in

Great experience in Slicer forum, Not only the Q&A edit system but also your reply! THANKS.

Another question about SlicerCustomAppTemplate

What the difference between the
option(Slicer_BUILD_xxxx_SUPPORT OFF/ON)


For example:
option(Slicer_BUILD_DICOM_SUPPORT "Build application with DICOM support" ON)


What do they stand for and what the differences?

Slicer_???MODULES_ENABLED can be used to disable entire class of modules. I would recommend to disable modules by name instead.

If you don’t need DICOM support at all, then disable Slicer_BUILD_DICOM_SUPPORT. If you want to have some DICOM reading/writing capabilities then enable it and just disable whatever DICOM related module you don’t need.

1 Like

You can share the source between different build. Just be aware that the Git hash written in the CMakeLists.txt may not correspond to the source associated with a given build.

The options listed in the CMakeLists.txt of your custom application are a subset of the one found in the one of Slicer.

We only listed the most common one, but all the other option could be set similarly.

1 Like

I mean that the CMakeList.txt in Slicer source root dir can get the full options? I want to know where can I get the other options.
And I still confuse about the difference option(Slicer_BUILD_xxxx_SUPPORT OFF/ON) and set(Slicer_CLIMODULES_ENABLED or DISABLED )

Thanks for reply!


This allows to build Slicer without the capabilities of loading a type of modules. When the option is disabled, Slicer won’t even attempt to look for the type of modules.


This allows to build Slicer with or without a specific list of modules of type CLI. But it will not prevent slicer from looking for CLI modules. For example, starting Slicer specifying --additional-module-paths /path/to/folder/with/modules will look for modules in /path/to/folder/with/modules.

1 Like

I have tried to build the Slicer using the same options on another machine, it still failed with the same error.And When I Turn ON the Option Slicer_WITH_PYTHONQT, it can build successfully. So Maybe there is a BUG in somewhere?

it still failed with the same error

This is now fixed in r28153

For reference, the complete error was:

In file included from /home/jcfr/Projects/Slicer-Qt5-VTK8/Base/QTGUI/qSlicerPythonManager.h:17:0,
                 from /home/jcfr/Projects/Slicer-Qt5-VTK8/Base/QTGUI/qSlicerWebPythonProxy.cxx:30:
/home/jcfr/Projects/Slicer-Qt5-VTK8/Base/QTCore/qSlicerCorePythonManager.h:25:39: fatal error: ctkAbstractPythonManager.h: No such file or directory
compilation terminated.

Thank you so much, it works correctly now. so exciting.

1 Like