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 https://github.com/Slicer/Slicer/commits/master. 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
image
image

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.

https://github.com/Slicer/Slicer/blob/8b2910fb9738dec05815ac853714634a7cfe04b2/Base/QTGUI/CMakeLists.txt#L306-L320

https://github.com/Slicer/Slicer/blob/8b2910fb9738dec05815ac853714634a7cfe04b2/Base/QTCore/CMakeLists.txt#L221-L249

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
    Slicer/CMakeList.txt?

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)
between

set(Slicer_CLIMODULES_ENABLED or DISABLED
  )
set(Slicer_QTLOADABLEMODULES_ENABLED or DISABLED
  )
set(Slicer_QTSCRIPTEDMODULES_ENABLED or DISABLED
  )

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

set(Slicer_CLIMODULES_ENABLED
   CreateDICOMSeries
  )
set(Slicer_QTSCRIPTEDMODULES_ENABLED
   DICOM
   DICOMLib
   DICOMPatcher
   DICOMPlugins
  )

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!

`Slicer_BUILD_xxxx_SUPPORT OFF/ON

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.

Slicer_CLIMODULES_ENABLED or DISABLED

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

Hello,
I have run into the same issue:
ENH: Add GitHub actions build, test workflow file for CI · jhlegarreta/SlicerDMRI@f5ad4d8 · GitHub
while trying to turn off Python support:
ENH: Add GitHub actions build, test workflow file for CI · jhlegarreta/SlicerDMRI@f5ad4d8 · GitHub

with the HEAD Slicer (e.g. DOC: Update segmenteditor.md with info on node references · Slicer/Slicer@d13d03d · GitHub).

Thus, I assume Python if necessary to build Slicer. Am I right?

@jcfr I am trying to turn off as many CLI modules as possible to speed up building, but I guess I need to keep them enabled to later build the SlicerDMRI module? Let me know if I’m wrong; if this is not necessary, the command line argument flag to disable them all would be -DSlicer_CLIMODULES_DISABLED ?

Otherwise, what would be the correct command line argument flag to turn off the e.g. AddScalarVolumes CLI: -DSlicer_BUILD_AddScalarVolumes=OFF ?

Thanks.

Slicer is meant to be buildable without python, but it’s not tested regularly so dependencies may creep in. This is true of all cmake options that aren’t part of the standard preview builds, so changing any of the defaults may be expected to require some debugging. Once you have the CI set up, maybe we also want to pick some build paths that we want to test on a regular basis using github actions.

BTW, it’s probably easier/faster to experiment using a big multi-core machine rather than using the CI machines.

Removing -DSlicer_USE_PYTHONQT=OFF made the build past that point, so Python is necessary to build Slicer.

Past that point I run into

CMake Error at Libs/vtkTeem/CMakeLists.txt:151 (vtkMacroKitPythonWrap):
  Unknown CMake command "vtkMacroKitPythonWrap".

at: ENH: Add GitHub actions build, test workflow file for CI · jhlegarreta/SlicerDMRI@a20943a · GitHub

Which was solved following:
Unknown CMake command "vtkMacroKitPythonWrap" in snapshot release for vtkTeem - #4 by cpinter

Slicer looks to be building now:
ENH: Add GitHub actions build, test workflow file for CI · jhlegarreta/SlicerDMRI@35e3b27 · GitHub

Yes, it is, but there is also a problem. For example, I want to change the name of my custom software. It seems that it should be rebuilt.Is there any way that I can change the name of the entire software without rebuilding?