# Unable to Build CTK & SITK

**URL:** <https://discourse.slicer.org/t/unable-to-build-ctk-sitk/1466>\
**Category:** Development\
**Created:** [November 15, 2017, 10:19pm UTC](https://discourse.slicer.org/t/unable-to-build-ctk-sitk/1466 "2017-11-15T22:19:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![purav70](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@purav70](https://discourse.slicer.org/u/purav70)\
**Post date:** [November 15, 2017, 10:19pm UTC](https://discourse.slicer.org/t/unable-to-build-ctk-sitk/1466/1 "2017-11-15T22:19:56Z")

</div>

I am building a fresh release build of slicer 4.7 (commit 42630e641fde4bb8f6e0903cf15ad3ac9cd00b78) using VS2013, Windows x64, QT 4.8.7, and get the following error. This error also seems to cause SITK to fail. I’ve tried a few different solutions but none seem to work - the problem seems to be with these 2 lines of code in FindPythonLibs.cmake. Everything else builds well. I would greatly appreciate some assistance.

Thanks.

```auto
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/FindPythonLibs.cmake:171 (get_filename_component):
11> get_filename_component unknown component
11> C:/Fall2017/s4r/python-install/libs/python27.lib
11> Call Stack (most recent call first):
11> CMakeExternals/PythonQt.cmake:61 (find_package)
11> CMake/ctkMacroCheckExternalProjectDependency.cmake:568 (include)
11> CMake/ctkMacroCheckExternalProjectDependency.cmake:614 (ExternalProject_Include_Dependencies)
11> CMake/ctkBlockCheckDependencies.cmake:127 (ExternalProject_Include_Dependencies)
11> CMakeLists.txt:970 (include)
11>  
11>  
11> CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/FindPythonLibs.cmake:172 (get_filename_component):
11> get_filename_component called with incorrect number of arguments
11> Call Stack (most recent call first):
11> CMakeExternals/PythonQt.cmake:61 (find_package)
11> CMake/ctkMacroCheckExternalProjectDependency.cmake:568 (include)
11> CMake/ctkMacroCheckExternalProjectDependency.cmake:614 (ExternalProject_Include_Dependencies)
11> CMake/ctkBlockCheckDependencies.cmake:127 (ExternalProject_Include_Dependencies)
11> CMakeLists.txt:970 (include)

```

The lines of code referred to in FindPythonLibs.cmake

```auto
get_filename_component(_Python_PREFIX ${PYTHON_LIBRARY} PATH)
get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH)

```

---

<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:** [November 16, 2017, 2:25am UTC](https://discourse.slicer.org/t/unable-to-build-ctk-sitk/1466/2 "2017-11-16T02:25:12Z")

</div>

Many of us rebuild Slicer successfully every day using VS2013, Windows x64, Qt-4.8.7. Please use latest master version (Slicer 4.9) and follow build instructions closely.

1. Build in a shorter build path: Source directory: C:\S4. Build directory: C:\S4R (or C:\S4D).

2. Build Qt using Jc’s one-liner (qt-easy-build)

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [November 16, 2017, 3:13am UTC](https://discourse.slicer.org/t/unable-to-build-ctk-sitk/1466/3 "2017-11-16T03:13:42Z")

</div>

This likely means `${PYTHON_LIBRARY}` is not set, so there was probably another build error earlier.

But as Andras said, you are best off using the current tree.

---

<div class="post-metadata">

**Author:** ![purav70](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@purav70](https://discourse.slicer.org/u/purav70)\
**Post date:** [November 16, 2017, 9:55pm UTC](https://discourse.slicer.org/t/unable-to-build-ctk-sitk/1466/4 "2017-11-16T21:55:00Z")

</div>

I tried using the master version and following all the instructions (I have built slicer several times in the past) but I still get the same errors. I have begun implementing this unofficial solution outlined here:

[https://cmake.org/pipermail/cmake/2017-January/064948.html](https://cmake.org/pipermail/cmake/2017-January/064948.html)

I believe the problem has to do with multiple Python Libraries, given that implementing this solution in several cmake files does seem to push the build further along (CTK now builds, but SITK does not, however I will implement this solution in some of the cmake files related to SITK that throw this same error). I was hoping this would provide insight to come up with a better fix.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [November 17, 2017, 2:52am UTC](https://discourse.slicer.org/t/unable-to-build-ctk-sitk/1466/5 "2017-11-17T02:52:40Z")

</div>

Ah, ok, well a new enough CMake will have the official fix:

> **[FindPythonLibs: Tolerate call with PYTHON\_LIBRARY already a list (a12d8a03) ·...](https://gitlab.kitware.com/cmake/cmake/-/commit/a12d8a03af8430d0a570c97deb200e16830568eb)**
>
> \`PYTHON\_LIBRARY\` may contain a list because of \`SelectLibraryConfigurations\`. If it is the case, the list can be: optimized;;debug; Instead of directly using the value of \`PYTHON\_LIBRARY\` in the CMake function...

---

<div class="post-metadata">

**Author:** ![purav70](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@purav70](https://discourse.slicer.org/u/purav70)\
**Post date:** [November 17, 2017, 7:07pm UTC](https://discourse.slicer.org/t/unable-to-build-ctk-sitk/1466/6 "2017-11-17T19:07:24Z")

</div>

A newer cmake did help, and now everything except the Slicer project builds. The error I’m now getting is:

CMake Error at CMake/SlicerMacroBuildApplication.cmake:330 (message):  
LAUNCHER\_SPLASHSCREEN\_FILE is mandatory  
Call Stack (most recent call first):  
Applications/SlicerApp/CMakeLists.txt:95 (slicerMacroBuildApplication)

Any advice?

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [November 17, 2017, 7:47pm UTC](https://discourse.slicer.org/t/unable-to-build-ctk-sitk/1466/7 "2017-11-17T19:47:24Z")

</div>

If you are customizing the Slicer build then you will need to set that variable yourself…  
Otherwise, it is defined in `Applications/SlicerApp/CMakeLists.txt` for standard builds.
