<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div>Hi all,<br><br></div>Trying the<br><br>    <a href="http://www.vtk.org/Wiki/VTK/Examples/Python/Widgets/EmbedPyQt">http://www.vtk.org/Wiki/VTK/Examples/Python/Widgets/EmbedPyQt</a><br><br></div>example on Ubuntu with python-vtk6 (6.2.0+dfsg1-4ubuntu5) and python-qt4 (4.11.4+dfsg-1build3) installed, I get a strange segmentation fault on startup:<br><br><br><br></div>estan@newton:~/orexplore/dev/gui-demo$ gdb python<br>GNU gdb (Ubuntu 7.10-1ubuntu2) 7.10<br>Copyright (C) 2015 Free Software Foundation, Inc.<br>License GPLv3+: GNU GPL version 3 or later <<a href="http://gnu.org/licenses/gpl.html">http://gnu.org/licenses/gpl.html</a>><br>This is free software: you are free to change and redistribute it.<br>There is NO WARRANTY, to the extent permitted by law.  Type "show copying"<br>and "show warranty" for details.<br>This GDB was configured as "x86_64-linux-gnu".<br>Type "show configuration" for configuration details.<br>For bug reporting instructions, please see:<br><<a href="http://www.gnu.org/software/gdb/bugs/">http://www.gnu.org/software/gdb/bugs/</a>>.<br>Find the GDB manual and other documentation resources online at:<br><<a href="http://www.gnu.org/software/gdb/documentation/">http://www.gnu.org/software/gdb/documentation/</a>>.<br>For help, type "help".<br>Type "apropos word" to search for commands related to "word"...<br>Reading symbols from python...Reading symbols from /usr/lib/debug//usr/bin/python2.7...done.<br>done.<br>(gdb) run test2.py<br>Starting program: /usr/bin/python test2.py<br>[Thread debugging using libthread_db enabled]<br>Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".<br>[New Thread 0x7fffb1bb8700 (LWP 3113)]<br>[New Thread 0x7fffb13b7700 (LWP 3114)]<br>[New Thread 0x7fffacbb6700 (LWP 3115)]<br><br>Program received signal SIGSEGV, Segmentation fault.<br>0x00007fff97a2885e in _GLOBAL__sub_I_qpycore_classinfo.cpp () from /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so<br>(gdb) bt<br>#0  0x00007fff97a2885e in _GLOBAL__sub_I_qpycore_classinfo.cpp () from /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so<br>#1  0x00007ffff7de960a in call_init (l=<optimized out>, argc=argc@entry=2, argv=argv@entry=0x7fffffffddf8, env=env@entry=0x7fffffffde10) at dl-init.c:72<br>#2  0x00007ffff7de971b in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:30<br>#3  _dl_init (main_map=main_map@entry=0x9e8d10, argc=2, argv=0x7fffffffddf8, env=0x7fffffffde10) at dl-init.c:120<br>#4  0x00007ffff7dee5d7 in dl_open_worker (a=a@entry=0x7fffffffd1d8) at dl-open.c:579<br>#5  0x00007ffff7de94b4 in _dl_catch_error (objname=objname@entry=0x7fffffffd1c8, errstring=errstring@entry=0x7fffffffd1d0, mallocedp=mallocedp@entry=0x7fffffffd1c7, operate=operate@entry=0x7ffff7dee0f0 <dl_open_worker>, args=args@entry=0x7fffffffd1d8) at dl-error.c:187<br>#6  0x00007ffff7ded9f3 in _dl_open (file=0xee42e0 "/usr/lib/python2.7/dist-packages/PyQt4/QtCore.so", mode=-2147483646, caller_dlopen=0x51a359 <_PyImport_GetDynLoadFunc+233>, nsid=-2, argc=<optimized out>, argv=<optimized out>, env=0x7fffffffde10) at dl-open.c:663<br>#7  0x00007ffff75edfc9 in dlopen_doit (a=a@entry=0x7fffffffd3f0) at dlopen.c:66<br>#8  0x00007ffff7de94b4 in _dl_catch_error (objname=0x9a1650, errstring=0x9a1658, mallocedp=0x9a1648, operate=0x7ffff75edf70 <dlopen_doit>, args=0x7fffffffd3f0) at dl-error.c:187<br>#9  0x00007ffff75ee62d in _dlerror_run (operate=operate@entry=0x7ffff75edf70 <dlopen_doit>, args=args@entry=0x7fffffffd3f0) at dlerror.c:163<br>#10 0x00007ffff75ee061 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87<br>#11 0x000000000051a359 in _PyImport_GetDynLoadFunc () at ../Python/dynload_shlib.c:140<br>#12 0x0000000000519eb4 in _PyImport_LoadDynamicModule () at ../Python/importdl.c:42<br>#13 0x00000000004a2891 in import_submodule () at ../Python/import.c:2704<br>#14 0x00000000004a7545 in ensure_fromlist () at ../Python/import.c:2610<br>#15 0x00000000004a1cc8 in import_module_level.isra.3 (level=-1, fromlist=('QtCore', 'QtGui'), globals=<optimized out>, name=<optimized out>) at ../Python/import.c:2273<br>#16 PyImport_ImportModuleLevel () at ../Python/import.c:2292<br>#17 0x00000000004a4834 in builtin___import__ () at ../Python/bltinmodule.c:49<br>#18 0x00000000004a45de in PyObject_Call () at ../Objects/abstract.c:2529<br>#19 0x00000000004c3e40 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4225<br>#20 0x00000000004c2a38 in PyEval_EvalFrameEx () at ../Python/ceval.c:2628<br>#21 0x00000000004b7986 in PyEval_EvalCodeEx () at ../Python/ceval.c:3588<br>#22 0x00000000004e8f3f in PyEval_EvalCode (locals={'vtk': <module at remote 0x7ffff7eb70f8>, '__builtins__': <module at remote 0x7ffff7f79b08>, '__file__': 'test2.py', '__package__': None, 'sys': <module at remote 0x7ffff7f79bb0>, '__name__': '__main__', '__doc__': None}, <br>    globals={'vtk': <module at remote 0x7ffff7eb70f8>, '__builtins__': <module at remote 0x7ffff7f79b08>, '__file__': 'test2.py', '__package__': None, 'sys': <module at remote 0x7ffff7f79bb0>, '__name__': '__main__', '__doc__': None}, co=0x7ffff7ee8db0) at ../Python/ceval.c:669<br>#23 run_mod.lto_priv () at ../Python/pythonrun.c:1370<br>#24 0x00000000004e3b02 in PyRun_FileExFlags () at ../Python/pythonrun.c:1356<br>#25 0x00000000004e22e6 in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:948<br>#26 0x0000000000490fe1 in Py_Main () at ../Modules/main.c:640<br>#27 0x00007ffff7811a40 in __libc_start_main (main=0x4909f0 <main>, argc=2, argv=0x7fffffffddf8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdde8) at libc-start.c:289<br>#28 0x0000000000490919 in _start ()<br>Warning: the current language does not match this frame.<br>(gdb)<br><br><br><br></div>Has anyone seen this before? I'm a little perplexed, as even a very simple program like:<br><br>from PyQt4.QtGui import QApplication, QMainWindow<br><br>from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor<br><br>import sys<br><br>app = QApplication(sys.argv)<br><br></div>gives a segmentation fault, though in this case, the crash occurs when dlopen()ing /usr/lib/libkdecore.so.5 instead:<br><br><br>#0  0x00007fff93d9bd4e in ?? () from /usr/lib/libkdecore.so.5<br>#1  0x00007ffff7de960a in call_init (l=<optimized out>, argc=argc@entry=2, argv=argv@entry=0x7fffffffddf8, env=env@entry=0x7fffffffde10) at dl-init.c:72<br>#2  0x00007ffff7de971b in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:30<br>#3  _dl_init (main_map=main_map@entry=0x10c4470, argc=2, argv=0x7fffffffddf8, env=0x7fffffffde10) at dl-init.c:120<br>#4  0x00007ffff7dee5d7 in dl_open_worker (a=a@entry=0x7fffffffc508) at dl-open.c:579<br>#5  0x00007ffff7de94b4 in _dl_catch_error (objname=objname@entry=0x7fffffffc4f8, errstring=errstring@entry=0x7fffffffc500, mallocedp=mallocedp@entry=0x7fffffffc4f7, operate=operate@entry=0x7ffff7dee0f0 <dl_open_worker>, args=args@entry=0x7fffffffc508) at dl-error.c:187<br>#6  0x00007ffff7ded9f3 in _dl_open (file=0x10d6638 "/usr/lib/kde4/plugins/styles/breeze.so", mode=-2147483647, caller_dlopen=0x7ffff4f08cd6, nsid=-2, argc=<optimized out>, argv=<optimized out>, env=0x7fffffffde10) at dl-open.c:663<br>#7  0x00007ffff75edfc9 in dlopen_doit (a=a@entry=0x7fffffffc720) at dlopen.c:66<br>#8  0x00007ffff7de94b4 in _dl_catch_error (objname=0x98b920, errstring=0x98b928, mallocedp=0x98b918, operate=0x7ffff75edf70 <dlopen_doit>, args=0x7fffffffc720) at dl-error.c:187<br>#9  0x00007ffff75ee62d in _dlerror_run (operate=operate@entry=0x7ffff75edf70 <dlopen_doit>, args=args@entry=0x7fffffffc720) at dlerror.c:163<br>#10 0x00007ffff75ee061 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87<br>#11 0x00007ffff4f08cd6 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4<br>#12 0x00007ffff4f0307d in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4<br>#13 0x00007ffff4f0370b in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4<br>#14 0x00007ffff4efc066 in QFactoryLoader::instance(QString const&) const () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4<br>#15 0x00007ffff575317d in QStyleFactory::create(QString const&) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4<br>#16 0x00007ffff54479ce in QApplication::style() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4<br>#17 0x00007ffff54b910a in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4<br>#18 0x00007ffff54bcc83 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4<br>#19 0x00007ffff5447fa2 in QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4<br>#20 0x00007ffff544824f in QApplication::QApplication(int&, char**, int) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4<br>#21 0x00007ffff64fbfae in sipQApplication::sipQApplication (this=0xba80d0, a0=<optimized out>, a1=<optimized out>) at sipQtGuipart9.cpp:36106<br>#22 0x00007ffff64fc196 in init_type_QApplication (sipSelf=0x7ffff1136938, sipArgs=<optimized out>, sipKwds=0x0, sipUnused=<optimized out>, sipParseErr=<optimized out>) at /build/python-qt4-DPZMhZ/python-qt4-4.11.4+dfsg/sip/QtGui/qapplication.sip:901<br>#23 0x00007ffff16901cb in sipSimpleWrapper_init (self=0x7ffff1136938, args=(['test.py'],), kwds=0x0) at siplib.c:9702<br>#24 0x00000000004a9efb in type_call.lto_priv () at ../Objects/typeobject.c:745<br>#25 0x00000000004bf3cc in PyObject_Call (kw=0x0, arg=(['test.py'],), func=<PyQt4.QtCore.pyqtWrapperType at remote 0xac4880>) at ../Objects/abstract.c:2529<br>#26 do_call (nk=<optimized out>, na=<optimized out>, pp_stack=0x7fffffffd9b0, func=<PyQt4.QtCore.pyqtWrapperType at remote 0xac4880>) at ../Python/ceval.c:4574<br>#27 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd9b0) at ../Python/ceval.c:4379<br>#28 PyEval_EvalFrameEx () at ../Python/ceval.c:2993<br>#29 0x00000000004b7986 in PyEval_EvalCodeEx () at ../Python/ceval.c:3588<br>#30 0x00000000004e8f3f in PyEval_EvalCode (<br>    locals={'QMainWindow': <PyQt4.QtCore.pyqtWrapperType at remote 0xb0d900>, 'QVTKRenderWindowInteractor': <PyQt4.QtCore.pyqtWrapperType at remote 0xba7cc0>, '__builtins__': <module at remote 0x7ffff7f79b08>, '__file__': 'test.py', 'QApplication': <PyQt4.QtCore.pyqtWrapperType at remote 0xac4880>, '__package__': None, 'sys': <module at remote 0x7ffff7f79bb0>, '__name__': '__main__', '__doc__': None}, <br>    globals={'QMainWindow': <PyQt4.QtCore.pyqtWrapperType at remote 0xb0d900>, 'QVTKRenderWindowInteractor': <PyQt4.QtCore.pyqtWrapperType at remote 0xba7cc0>, '__builtins__': <module at remote 0x7ffff7f79b08>, '__file__': 'test.py', 'QApplication': <PyQt4.QtCore.pyqtWrapperType at remote 0xac4880>, '__package__': None, 'sys': <module at remote 0x7ffff7f79bb0>, '__name__': '__main__', '__doc__': None}, co=0x7ffff7edfe30) at ../Python/ceval.c:669<br>#31 run_mod.lto_priv () at ../Python/pythonrun.c:1370<br>#32 0x00000000004e3b02 in PyRun_FileExFlags () at ../Python/pythonrun.c:1356<br>#33 0x00000000004e22e6 in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:948<br>#34 0x0000000000490fe1 in Py_Main () at ../Modules/main.c:640<br>#35 0x00007ffff7811a40 in __libc_start_main (main=0x4909f0 <main>, argc=2, argv=0x7fffffffddf8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdde8) at libc-start.c:289<br>#36 0x0000000000490919 in _start ()<br><br><br></div>Just removing the<br><br>   from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor<br><br></div>from the above minimal test and the segmentation fault goes away.<br><br></div>So something seems quite broken :/<br><br></div>I'm surprised, as I've had VTK + PyQt4 programs working fine before.<br><br></div>Thankful for any advice / ideas.<br><br></div>Elvis<br></div>