# Slicer crash on fresh build

**URL:** <https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351>\
**Category:** Development\
**Created:** [May 20, 2017, 3:36pm UTC](https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351 "2017-05-20T15:36:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregsharp.geo](https://avatars.discourse-cdn.com/v4/letter/g/6bbea6/32.png) [@gregsharp.geo](https://discourse.slicer.org/u/gregsharp.geo)\
**Post date:** [May 20, 2017, 3:36pm UTC](https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351/1 "2017-05-20T15:36:34Z")

</div>

Hi, I am trying to get Slicer to build and run on my home computer.  
It is debian testing with gcc 6 (unfortunately gcc 5 no longer offered).  
Clean directory, disable SimpleITK, disable BRAINS,  
ignore inevitible BRAINSCommon build failures. Slicer builds.  
Got the following error when trying to run. Any ideas?  
Thanks,  
Greg

```auto
$ ./Slicer-build/Slicer
Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/Python/slicer/slicerqt.py", line 6, in <module>
    import vtk
  File "/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/Wrapping/Python/vtk/ __init__.py", line 41, in <module>
    from .vtkCommonKit import *
  File "/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/Wrapping/Python/vtk/vtkCommonKit.py", line 9, in <module>
    from vtkCommonKitPython import *
ImportError: /home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkCommonKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/Python/slicer/slicerqt-with-tcl.py", line 42, in <module>
    slicer.sliceWidgets = {}
NameError: name 'slicer' is not defined
/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkRenderingKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkRenderingKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkRenderingKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkRenderingKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'getSlicerRCFileName' is not defined
Number of registered modules: 85 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/CompareVolumes.py", line 3, in <module>
    from __main__ import vtk, qt, ctk, slicer
ImportError: cannot import name vtk
loadSourceAsModule - Failed to load file "/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/CompareVolumes.py" as module "CompareVolumes" ! 
Fail to instantiate module "CompareVolumes" 
error: [/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.
gsharp@wormwood:~/build/slicer-4/Slicer-build$ rm -rf ~/.config/NA-MIC/
gsharp@wormwood:~/build/slicer-4/Slicer-build$ ./Slicer-build/Slicer
Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/Python/slicer/slicerqt.py", line 6, in <module>
    import vtk
  File "/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/Wrapping/Python/vtk/ __init__.py", line 41, in <module>
    from .vtkCommonKit import *
  File "/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/Wrapping/Python/vtk/vtkCommonKit.py", line 9, in <module>
    from vtkCommonKitPython import *
ImportError: /home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkCommonKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/Python/slicer/slicerqt-with-tcl.py", line 42, in <module>
    slicer.sliceWidgets = {}
NameError: name 'slicer' is not defined
/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkRenderingKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkRenderingKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkRenderingKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/./libvtkRenderingKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'getSlicerRCFileName' is not defined
Number of registered modules: 85 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/CompareVolumes.py", line 3, in <module>
    from __main__ import vtk, qt, ctk, slicer
ImportError: cannot import name vtk
loadSourceAsModule - Failed to load file "/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/CompareVolumes.py" as module "CompareVolumes" ! 
Fail to instantiate module "CompareVolumes" 
error: [/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.

```

---

<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:** [May 20, 2017, 3:38pm UTC](https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351/2 "2017-05-20T15:38:25Z")

</div>

Do you have the error if you don’t disable BRAINS?

---

<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:** [May 20, 2017, 4:16pm UTC](https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351/3 "2017-05-20T16:16:20Z")

</div>

Looks like a mix of python versions. Maybe check that your environment doesn’t have and LD\_PRELOAD. Also double check that the Slicer-build/Slicer --launcher-dump-environment looks like it has all the correct paths.

---

<div class="post-metadata">

**Author:** ![gregsharp.geo](https://avatars.discourse-cdn.com/v4/letter/g/6bbea6/32.png) [@gregsharp.geo](https://discourse.slicer.org/u/gregsharp.geo)\
**Post date:** [May 21, 2017, 8:55pm UTC](https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351/4 "2017-05-21T20:55:42Z")

</div>

> Do you have the error if you don’t disable BRAINS?

BRAINS doesn’t build.

[http://na-mic.org/Mantis/view.php?id=4268](http://na-mic.org/Mantis/view.php?id=4268)

---

<div class="post-metadata">

**Author:** ![gregsharp.geo](https://avatars.discourse-cdn.com/v4/letter/g/6bbea6/32.png) [@gregsharp.geo](https://discourse.slicer.org/u/gregsharp.geo)\
**Post date:** [May 21, 2017, 8:58pm UTC](https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351/5 "2017-05-21T20:58:19Z")

</div>

> Looks like a mix of python versions. Maybe check that your  
> environment doesn’t have and LD\_PRELOAD. Also double check that the  
> Slicer-build/Slicer --launcher-dump-environment looks like it has all  
> the correct paths.

LD\_PRELOAD is not set.

The environment looks fine to me. However, I don’t really know what I  
am looking for. Pasted below.

```auto
LD_LIBRARY_PATH=/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/.:/usr/lib/x86_64-linux-gnu:../lib/Slicer-4.7/qt-loadable-modules:/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/lib/Slicer-4.7/cli-modules/.:/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/lib/Slicer-4.7/qt-loadable-modules/.:/home/gsharp/build/slicer-4/Slicer-build/OpenSSL:/home/gsharp/build/slicer-4/Slicer-build/tcl-build/lib:/home/gsharp/build/slicer-4/Slicer-build/python-install/lib:/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/.:/home/gsharp/build/slicer-4/Slicer-build/teem-build/bin/.:/home/gsharp/build/slicer-4/Slicer-build/DCMTK-build/lib/.:/home/gsharp/build/slicer-4/Slicer-build/ITKv4-build/lib/.:/home/gsharp/build/slicer-4/Slicer-build/CTK-build/CTK-build/bin/.:/home/gsharp/build/slicer-4/Slicer-build/CTK-build/QtTesting-build/.:/home/gsharp/build/slicer-4/Slicer-build/CTK-build/PythonQt-build/.:/home/gsharp/build/slicer-4/Slicer-build/LibArchive-install/lib:/home/gsharp/build/slicer-4/Slicer-build/OpenIGTLink-build:/home/gsharp/build/slicer-4/Slicer-build/OpenIGTLink-build/bin/.:/home/gsharp/build/slicer-4/Slicer-build/JsonCpp-build/src/lib_json/.:/home/gsharp/build/slicer-4/Slicer-build/ParameterSerializer-build/lib/.:/home/gsharp/build/slicer-4/Slicer-build/SlicerExecutionModel-build/ModuleDescriptionParser/bin/.:/home/gsharp/build/slicer-4/Slicer-build/python-install/lib/python2.7/site-packages/numpy/core:/home/gsharp/build/slicer-4/Slicer-build/python-install/lib/python2.7/site-packages/numpy/lib
PATH=/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/.:/usr/lib/x86_64-linux-gnu/qt4/bin:/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/lib/Slicer-4.7/cli-modules/.:/home/gsharp/build/slicer-4/Slicer-build/tcl-build/bin:/home/gsharp/build/slicer-4/Slicer-build/python-install/bin:/home/gsharp/build/slicer-4/Slicer-build/teem-build/bin/.
PYTHONHOME=/home/gsharp/build/slicer-4/Slicer-build/python-install
PYTHONNOUSERSITE=1
PYTHONPATH=/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/.:/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin/Python:/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/lib/Slicer-4.7/qt-loadable-modules/.:/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/lib/Slicer-4.7/qt-loadable-modules/Python:/home/gsharp/build/slicer-4/Slicer-build/python-install/lib/python2.7/lib-tk:/home/gsharp/build/slicer-4/Slicer-build/python-install/lib/python2.7:/home/gsharp/build/slicer-4/Slicer-build/python-install/lib/python2.7/lib-dynload:/home/gsharp/build/slicer-4/Slicer-build/python-install/lib/python2.7/site-packages:/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/Wrapping/Python:/home/gsharp/build/slicer-4/Slicer-build/VTKv7-build/lib/.:/home/gsharp/build/slicer-4/Slicer-build/CTK-build/CTK-build/bin/Python:/home/gsharp/build/slicer-4/Slicer-build/CTK-build/CTK-build/bin/.
QT_PLUGIN_PATH=/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/bin:/home/gsharp/build/slicer-4/Slicer-build/CTK-build/CTK-build/bin:/usr/lib/x86_64-linux-gnu/qt4/plugins
SLICER_HOME=/home/gsharp/build/slicer-4/Slicer-build/Slicer-build
SSL_CERT_FILE=/home/gsharp/build/slicer-4/Slicer-build/Slicer-build/share/Slicer-4.7/Slicer.crt
TCLLIBPATH=/home/gsharp/build/slicer-4/Slicer-build/tcl-build/lib/itcl4.0.1
TCL_LIBRARY=/home/gsharp/build/slicer-4/Slicer-build/tcl-build/lib/tcl8.6
TK_LIBRARY=/home/gsharp/build/slicer-4/Slicer-build/tcl-build/lib/tk8.6

```

---

<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:** [May 21, 2017, 9:37pm UTC](https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351/6 "2017-05-21T21:37:02Z")

</div>

Interesting - in LD\_LIBRARY\_PATH /usr/lib/x86\_64-linux-gnu is inserted before the slicer build directories. That looks wrong to me since that directory has other python shared libraries that aren’t the ones slicer builds.

Maybe if you start a new terminal (with Slicer --xterm) you can set the LD\_LIBRARY\_PATH without that entry (or move it to the end if needed to resolve other libs). You can run Slicer-build/bin/SlicerApp-real and see if it works.

I can confirm that on my ubuntu I have the same /usr/lib/x86\_64 entry in LD\_LIBRARY\_PATH, but I don’t get a crash but I probably have a different python version.

---

<div class="post-metadata">

**Author:** ![gregsharp.geo](https://avatars.discourse-cdn.com/v4/letter/g/6bbea6/32.png) [@gregsharp.geo](https://discourse.slicer.org/u/gregsharp.geo)\
**Post date:** [May 21, 2017, 11:09pm UTC](https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351/7 "2017-05-21T23:09:02Z")

</div>

> Interesting - in LD\_LIBRARY\_PATH /usr/lib/x86\_64-linux-gnu is  
> inserted before the slicer build directories. That looks wrong to me  
> since that directory has other python shared libraries that aren’t  
> the ones slicer builds.
> 
> Maybe if you start a new terminal (with Slicer --xterm) you can set  
> the LD\_LIBRARY\_PATH without that entry (or move it to the end if  
> needed to resolve other libs). You can run  
> Slicer-build/bin/SlicerApp-real and see if it works.
> 
> I can confirm that on my ubuntu I have the same /usr/lib/x86\_64 entry  
> in LD\_LIBRARY\_PATH, but I don’t get a crash but I probably have a  
> different python version.

Sadly, the result is “Segmentation fault”.

For the record:

```auto
$ which python
/usr/bin/python
$ python --version
Python 2.7.13

```

I will rebuild in debug mode, and get a stack trace.  
Any other ideas helpful.

Thanks!  
Greg

---

<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:** [May 23, 2017, 2:47pm UTC](https://discourse.slicer.org/t/slicer-crash-on-fresh-build/351/8 "2017-05-23T14:47:41Z")

</div>

This is a known limitation of our build system, see [http://www.na-mic.org/Bug/view.php?id=3574](http://www.na-mic.org/Bug/view.php?id=3574)

In a nutshell, if Qt is installer in a system location, configure with `-DSlicer_USE_SYSTEM_QT:BOOL=1`

I will look at this after [https://github.com/Slicer/Slicer/pull/727](https://github.com/Slicer/Slicer/pull/727) is integrated.
