# Custom build Slicer failed

**URL:** https://discourse.slicer.org/t/custom-build-slicer-failed/6523
**Category:** Development
**Tags:** build
**Created:** [April 17, 2019, 9:50am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523 "2019-04-17T09:50:00Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Littlehhh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/littlehhh/32/3484_2.png) [@Littlehhh](https://discourse.slicer.org/u/Littlehhh)
#### Post date: [April 17, 2019, 9:50am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/1 "2019-04-17T09:50:01Z")

</div>

I use the [SlicerCustomAppTemplate](https://github.com/KitwareMedical/SlicerCustomAppTemplate) to custom the slicer. When I set the option like this

 ![%E6%8D%95%E8%8E%B7](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/4/b431bb94b6ead12f7d692b2c9b24a540e4f3d7f2.png)

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

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [April 17, 2019, 1:32pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/2 "2019-04-17T13:32:12Z")

</div>

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](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.

---

<div class="post-metadata">

### Author: ![Littlehhh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/littlehhh/32/3484_2.png) [@Littlehhh](https://discourse.slicer.org/u/Littlehhh)
#### Post date: [April 17, 2019, 3:57pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/3 "2019-04-17T15:57:36Z")

</div>

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](https://github.com/KitwareMedical/SlicerCustomAppTemplate)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/0/c07ef95c1d58183fc2a07e15fc9bb8e0bef2c715.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/e/3ecb1a47cd7156fc99a5ed301f6b71f710a26987.png)

## 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.

```bat

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 file ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/b/abd2ac669a1ba51cd1f2a8925d8145771f61ed11.png)  
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

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [April 17, 2019, 4:12pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/4 "2019-04-17T16:12:21Z")

</div>

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

> [@Littlehhh](#):
>
> It seems that the Options in the SlicerCustomAppTemplate are not the whole options, Where can I get the whole options

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

> [@Littlehhh](#):
>
> ALL of the Options in SlicerCustomAppTemplate can be TURN OFF? Which ones can be turned off, or Which ones can not be turned off.

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.

> [@Littlehhh](#):
>
> How to build the Slicer faster.

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.

---

<div class="post-metadata">

### Author: ![Littlehhh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/littlehhh/32/3484_2.png) [@Littlehhh](https://discourse.slicer.org/u/Littlehhh)
#### Post date: [April 17, 2019, 5:42pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/5 "2019-04-17T17:42:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [April 17, 2019, 5:45pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/6 "2019-04-17T17:45:55Z")

</div>

> [@Littlehhh](#):
>
> “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

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.

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [April 17, 2019, 6:12pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/7 "2019-04-17T18:12:04Z")

</div>

> 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/QTGUI/CMakeLists.txt#L306-L320)

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

---

<div class="post-metadata">

### Author: ![Littlehhh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/littlehhh/32/3484_2.png) [@Littlehhh](https://discourse.slicer.org/u/Littlehhh)
#### Post date: [April 18, 2019, 1:12am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/8 "2019-04-18T01:12:10Z")

</div>

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](https://github.com/Slicer/Slicer/blob/8b2910fb9738dec05815ac853714634a7cfe04b2/CMakeLists.txt)?

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

---

<div class="post-metadata">

### Author: ![Littlehhh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/littlehhh/32/3484_2.png) [@Littlehhh](https://discourse.slicer.org/u/Littlehhh)
#### Post date: [April 18, 2019, 2:14am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/9 "2019-04-18T02:14:27Z")

</div>

## Another question about SlicerCustomAppTemplate

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

```auto
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

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

```

What do they stand for and what the differences?

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [April 18, 2019, 2:23am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/10 "2019-04-18T02:23:46Z")

</div>

`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.

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [April 18, 2019, 2:32am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/11 "2019-04-18T02:32:41Z")

</div>

> [@Littlehhh](#):
>
> - If I can use the same slicer source for multiple builds, will they interfere with each other?

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.

> [@Littlehhh](#):
>
> - Are the fully custom build options in  
> [Slicer/CMakeList.txt](https://github.com/Slicer/Slicer/blob/8b2910fb9738dec05815ac853714634a7cfe04b2/CMakeLists.txt)?

The options listed in the [CMakeLists.txt](https://github.com/KitwareMedical/SlicerCustomAppTemplate/blob/master/%7B%7Bcookiecutter.project_name%7D%7D/CMakeLists.txt) of your custom application are a subset of the [one](https://github.com/Slicer/Slicer/blob/master/CMakeLists.txt) found in the one of Slicer.

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

---

<div class="post-metadata">

### Author: ![Littlehhh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/littlehhh/32/3484_2.png) [@Littlehhh](https://discourse.slicer.org/u/Littlehhh)
#### Post date: [April 18, 2019, 2:39am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/12 "2019-04-18T02:39:23Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [April 18, 2019, 3:02am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/13 "2019-04-18T03:02:15Z")

</div>

> `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`.

---

<div class="post-metadata">

### Author: ![Littlehhh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/littlehhh/32/3484_2.png) [@Littlehhh](https://discourse.slicer.org/u/Littlehhh)
#### Post date: [April 18, 2019, 10:34am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/14 "2019-04-18T10:34:06Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [April 18, 2019, 1:55pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/15 "2019-04-18T13:55:17Z")

</div>

> it still failed with the same error

This is now fixed in [r28153](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=28153)

For reference, the complete error was:

```auto
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.

```

---

<div class="post-metadata">

### Author: ![Littlehhh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/littlehhh/32/3484_2.png) [@Littlehhh](https://discourse.slicer.org/u/Littlehhh)
#### Post date: [April 18, 2019, 3:17pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/16 "2019-04-18T15:17:43Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 29, 2023, 3:10pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/17 "2023-07-29T15:10:06Z")

</div>

Hello,  
I have run into the same issue:  
[ENH: Add GitHub actions build, test workflow file for CI · jhlegarreta/SlicerDMRI@f5ad4d8 · GitHub](https://github.com/jhlegarreta/SlicerDMRI/actions/runs/5695300037/job/15438164734#step:6:21778)  
while trying to turn off Python support:  
[ENH: Add GitHub actions build, test workflow file for CI · jhlegarreta/SlicerDMRI@f5ad4d8 · GitHub](https://github.com/jhlegarreta/SlicerDMRI/actions/runs/5695300037/job/15438164734#step:6:2939)

with the `HEAD` Slicer (e.g. [DOC: Update segmenteditor.md with info on node references · Slicer/Slicer@d13d03d · GitHub](https://github.com/Slicer/Slicer/commit/d13d03dce2d4e84f88a1b51289209d9bcefcd63a)).

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.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [July 29, 2023, 5:45pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/18 "2023-07-29T17:45:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)
#### Post date: [July 30, 2023, 1:18am UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/19 "2023-07-30T01:18:30Z")

</div>

> [@jhlegarreta](#):
>
> Thus, I assume Python if necessary to build Slicer. Am I right?

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

Past that point I run into

```auto
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](https://github.com/jhlegarreta/SlicerDMRI/actions/runs/5701134575/job/15451559662#step:6:43108)

Which was solved following:  
[Unknown CMake command "vtkMacroKitPythonWrap" in snapshot release for vtkTeem - #4 by cpinter](https://discourse.slicer.org/t/unknown-cmake-command-vtkmacrokitpythonwrap-in-snapshot-release-for-vtkteem/13838/4)

Slicer looks to be building now:  
[ENH: Add GitHub actions build, test workflow file for CI · jhlegarreta/SlicerDMRI@35e3b27 · GitHub](https://github.com/jhlegarreta/SlicerDMRI/actions/runs/5701565727/job/15452403081#step:6:1)

---

<div class="post-metadata">

### Author: ![slicer365](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/slicer365/32/67549_2.png) [@slicer365](https://discourse.slicer.org/u/slicer365)
#### Post date: [July 30, 2023, 1:15pm UTC](https://discourse.slicer.org/t/custom-build-slicer-failed/6523/20 "2023-07-30T13:15:13Z")

</div>

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?

[Next page](https://discourse.slicer.org/t/custom-build-slicer-failed/6523.md?page=2)
