# Packaging SlicerVMTK extension with custom Slicer build

**URL:** <https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639>\
**Category:** Development\
**Tags:** build, extensions-manager\
**Created:** [August 2, 2018, 7:49pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639 "2018-08-02T19:49:52Z")\
**Posts on this page:** 2\
**Page:** 3

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [October 26, 2018, 5:47pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/41 "2018-10-26T17:47:08Z")

</div>

I’m back at this after having to set it aside for some other work. I’m still trying to get SlicerVMTK to work from within a custom application that I started using cookiecutter. Thank you for your previous help.

I made the changes to External\_VMTK.cmake described in the previous comment, and I can build and package the application, but I still can’t access the VMTK classes from the Python interpreter. When I try to import one of the VMTK libraries, I get the error:

> Python 2.7.13 (default, Oct 24 2018, 15:58:48)  
> [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on Darwin  
> \>\>\> import vtkvmtkMiscPython  
> Traceback (most recent call last):  
> File “\<console\>”, line 1, in \<module\>  
> ImportError: dlopen(/Applications/PADPlanner.app/Contents/lib/PADPlanner-4.9/qt-loadable-modules/Python/vtkvmtkMiscPython.so, 2): Library not loaded: libvtkvmtkMiscPythonD.dylib  
> Referenced from: /Applications/PADPlanner.app/Contents/lib/PADPlanner-4.9/qt-loadable-modules/Python/vtkvmtkMiscPython.so  
> Reason: image not found

So the vtkvmtkMiscPython.so file can’t find libvtkvmtkMiscPythonD.dylib. Just as a test, I copied the .dylib files to the same file as the .so file, and restarted the app, but that didn’t change anything.

What am I missing to link these libraries?

My External\_VMTK.cmake file with changes is here:  
[https://github.com/mschumak/SlicerExtension-VMTK/blob/Oct24-refixing/SuperBuild/External\_VMTK.cmake#L20-L41](https://github.com/mschumak/SlicerExtension-VMTK/blob/Oct24-refixing/SuperBuild/External_VMTK.cmake#L20-L41)

The section of the CMakeLists.txt file for my custom application that deals with extensions is:

> # Enable/Disable Slicer custom modules: To create a new module, use the SlicerExtensionWizard.  
> set(Slicer\_EXTENSION\_SOURCE\_DIRS  
> /Users/michaelschumaker/Development/mschumaker/Slicelets/PADFusion/PADFusion  
> )  
> # Add remote extension source directories  
> #SlicerVMTK  
> set(extension\_name “SlicerVMTK”)  
> set(${extension\_name}\_SOURCE\_DIR “${CMAKE\_BINARY\_DIR}/${extension\_name}”)

> FetchContent\_Populate(${extension\_name}  
> SOURCE\_DIR ${${extension\_name}\_SOURCE\_DIR}  
> GIT\_REPOSITORY ${EP\_GIT\_PROTOCOL}://github.com/mschumak/SlicerExtension-VMTK.git  
> GIT\_TAG a847b808cd772ea77992b64a6fb3bdf9388d2171  
> GIT\_PROGRESS 1  
> )  
> list(APPEND Slicer\_EXTENSION\_SOURCE\_DIRS ${${extension\_name}\_SOURCE\_DIR})  
>   
> # Add Slicer sources  
> add\_subdirectory(${slicersources\_SOURCE\_DIR} ${slicersources\_BINARY\_DIR})

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [October 31, 2018, 2:23pm UTC](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639/42 "2018-10-31T14:23:33Z")

</div>

@jcfr, any thoughts?  
Thanks!

[Previous page](https://discourse.slicer.org/t/packaging-slicervmtk-extension-with-custom-slicer-build/3639.md?page=2)
