[vtkusers] vtkpython:Linux SMP:SIGSEGV upon import vtk

donna at v1.wustl.edu donna at v1.wustl.edu
Tue Feb 25 15:23:51 EST 2003


My vtkpython seems to run fine on several flavors of uni-processor
Linux, but a user running SuSE Linux 7.1 (i386) 2.2.18-SMP #1 SMP is
crashing with SIGSEGV.

My build environment was as follows:

Red Hat Linux release 6.1 (Cartman) Kernel 2.2.12-20 uni-processor
gcc-3.0.4
Python 2.1.3
vtk 4.1.1, 1.1358 vintage 2002/10/05 (without parallel)

I can start vtkpython, but when I import vtk, I crash:

gdb vtkpython
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) run
Starting program: /home/donna/SUREfit.occipital/bin/vtkpython 
[New Thread 1024 (LWP 2038)]
vtk version 4.1.1, vtk source $Revision: 1.1358 $, $Date: 2002/10/05
02:45:03 $ (GMT)
Python 2.1.3 (#1, Jan 21 2003, 14:10:19) 
[GCC 3.0.4] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> import os   
>>> import vtk

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 2038)]
0x4000ba79 in _dl_relocate_object () from /lib/ld-linux.so.2
(gdb) where
#0  0x4000ba79 in _dl_relocate_object () from /lib/ld-linux.so.2
#1  0x426e8fa4 in dl_open_worker () from /lib/libc.so.6
#2  0x4000d332 in _dl_catch_error () from /lib/ld-linux.so.2
#3  0x426e915e in _dl_open () from /lib/libc.so.6
#4  0x40038354 in dlopen_doit () from /lib/libdl.so.2
#5  0x4000d332 in _dl_catch_error () from /lib/ld-linux.so.2
#6  0x40038790 in _dlerror_run () from /lib/libdl.so.2
#7  0x40038393 in dlopen@@GLIBC_2.1 () from /lib/libdl.so.2
#8  0x08075b21 in _PyImport_GetDynLoadFunc (
    fqname=0xbfffccc4 "libvtkCommonPython", 
    shortname=0xbfffccc4 "libvtkCommonPython", 
    pathname=0xbfffc830 "/home/donna/SUREfit/lib/libvtkCommonPython.so", 
    fp=0x8127890) at Python/dynload_shlib.c:90
#9  0x0806e431 in _PyImport_LoadDynamicModule (
    name=0xbfffccc4 "libvtkCommonPython", 
    pathname=0xbfffc830 "/home/donna/SUREfit/lib/libvtkCommonPython.so", 
    fp=0x8127890) at Python/importdl.c:42
#10 0x0806c852 in load_module (name=0xbfffccc4 "libvtkCommonPython", 
    fp=0x8127890, 
    buf=0xbfffc830 "/home/donna/SUREfit/lib/libvtkCommonPython.so",
type=3)
    at Python/import.c:1310
#11 0x0806d4e3 in import_submodule (mod=0x80cc5ac, 
    subname=0xbfffccc4 "libvtkCommonPython", 
    fullname=0xbfffccc4 "libvtkCommonPython") at Python/import.c:1829
#12 0x0806d136 in load_next (mod=0x812331c, altmod=0x80cc5ac, 
    p_name=0xbfffd0f0, buf=0xbfffccc0 "vtk.libvtkCommonPython", 
    p_buflen=0xbfffccbc) at Python/import.c:1689
#13 0x0806ccf4 in import_module_ex (name=0x0, globals=0x8123a94, 
    locals=0x8123a94, fromlist=0x80fcf0c) at Python/import.c:1536
#14 0x0806ce61 in PyImport_ImportModuleEx (
    name=0x8127b74 "libvtkCommonPython", globals=0x8123a94,
locals=0x8123a94, 
    fromlist=0x80fcf0c) at Python/import.c:1577
#15 0x080a94d5 in builtin___import__ (self=0x0, args=0x80ff9b4)
    at Python/bltinmodule.c:31
#16 0x0805d7c2 in call_cfunction (func=0x80e2940, arg=0x80ff9b4, kw=0x0)
    at Python/ceval.c:2858
#17 0x0805d71b in call_object (func=0x80e2940, arg=0x80ff9b4, kw=0x0)
    at Python/ceval.c:2820
#18 0x0805d544 in PyEval_CallObjectWithKeywords (func=0x80e2940, 
    arg=0x80ff9b4, kw=0x0) at Python/ceval.c:2753
#19 0x0805b8ec in eval_code2 (co=0x8127720, globals=0x8123a94, 
    locals=0x8123a94, args=0x0, argcount=0, kws=0x0, kwcount=0,
defs=0x0, 
    defcount=0, closure=0x0) at Python/ceval.c:1832
#20 0x08058db5 in PyEval_EvalCode (co=0x8127720, globals=0x8123a94, 
    locals=0x8123a94) at Python/ceval.c:341
#21 0x0806ba33 in PyImport_ExecCodeModuleEx (name=0xbfffdbe0
"vtk.common", 
---Type <return> to continue, or q <return> to quit---
    co=0x8127720, 
    pathname=0xbfffd2e0
"/home/donna/SUREfit/lib/python2.1/site-packages/vtkpython/vtk/common.pyc")
at Python/import.c:490
#22 0x0806bfab in load_source_module (name=0xbfffdbe0 "vtk.common", 
    pathname=0xbfffd750
"/home/donna/SUREfit/lib/python2.1/site-packages/vtkpython/vtk/common.py",
fp=0x80e8690) at Python/import.c:754
#23 0x0806c82d in load_module (name=0xbfffdbe0 "vtk.common",
fp=0x80e8690, 
    buf=0xbfffd750
"/home/donna/SUREfit/lib/python2.1/site-packages/vtkpython/vtk/common.py",
type=1) at Python/import.c:1301
#24 0x0806d4e3 in import_submodule (mod=0x812331c, 
    subname=0xbfffdbe4 "common", fullname=0xbfffdbe0 "vtk.common")
    at Python/import.c:1829
#25 0x0806d0ba in load_next (mod=0x812331c, altmod=0x80cc5ac, 
    p_name=0xbfffe010, buf=0xbfffdbe0 "vtk.common", p_buflen=0xbfffdbdc)
    at Python/import.c:1685
#26 0x0806ccf4 in import_module_ex (name=0x0, globals=0x80e8f0c, 
    locals=0x80e8f0c, fromlist=0x80ff2ac) at Python/import.c:1536
#27 0x0806ce61 in PyImport_ImportModuleEx (name=0x80ffec4 "common", 
    globals=0x80e8f0c, locals=0x80e8f0c, fromlist=0x80ff2ac)
    at Python/import.c:1577
#28 0x080a94d5 in builtin___import__ (self=0x0, args=0x80f4ca4)
    at Python/bltinmodule.c:31
#29 0x0805d7c2 in call_cfunction (func=0x80e2940, arg=0x80f4ca4, kw=0x0)
    at Python/ceval.c:2858
#30 0x0805d71b in call_object (func=0x80e2940, arg=0x80f4ca4, kw=0x0)
    at Python/ceval.c:2820
#31 0x0805d544 in PyEval_CallObjectWithKeywords (func=0x80e2940, 
    arg=0x80f4ca4, kw=0x0) at Python/ceval.c:2753
#32 0x0805b8ec in eval_code2 (co=0x80f4a38, globals=0x80e8f0c, 
    locals=0x80e8f0c, args=0x0, argcount=0, kws=0x0, kwcount=0,
defs=0x0, 
    defcount=0, closure=0x0) at Python/ceval.c:1832
#33 0x08058db5 in PyEval_EvalCode (co=0x80f4a38, globals=0x80e8f0c, 
    locals=0x80e8f0c) at Python/ceval.c:341
#34 0x0806ba33 in PyImport_ExecCodeModuleEx (name=0xbfffef70 "vtk", 
    co=0x80f4a38, 
    pathname=0xbfffe200
"/home/donna/SUREfit/lib/python2.1/site-packages/vtkpython/vtk/__init__.pyc")
at Python/import.c:490
#35 0x0806bfab in load_source_module (name=0xbfffef70 "vtk", 
    pathname=0xbfffe670
"/home/donna/SUREfit/lib/python2.1/site-packages/vtkpython/vtk/__init__.py",
fp=0x80e8fc8) at Python/import.c:754
#36 0x0806c82d in load_module (name=0xbfffef70 "vtk", fp=0x80e8fc8, 
    buf=0xbfffe670
"/home/donna/SUREfit/lib/python2.1/site-packages/vtkpython/vtk/__init__.py",
type=1) at Python/import.c:1301
#37 0x0806c17f in load_package (name=0xbfffef70 "vtk", 
    pathname=0xbfffeae0
"/home/donna/SUREfit/lib/python2.1/site-packages/vtkpython/vtk") at
Python/import.c:811
---Type <return> to continue, or q <return> to quit---
#38 0x0806c87b in load_module (name=0xbfffef70 "vtk", fp=0x0, 
    buf=0xbfffeae0
"/home/donna/SUREfit/lib/python2.1/site-packages/vtkpython/vtk", type=5)
at Python/import.c:1324
#39 0x0806d4e3 in import_submodule (mod=0x80cc5ac, subname=0xbfffef70
"vtk", 
    fullname=0xbfffef70 "vtk") at Python/import.c:1829
#40 0x0806d0ba in load_next (mod=0x80cc5ac, altmod=0x80cc5ac, 
    p_name=0xbffff3a0, buf=0xbfffef70 "vtk", p_buflen=0xbfffef6c)
    at Python/import.c:1685
#41 0x0806ccf4 in import_module_ex (name=0x0, globals=0x80e8edc, 
    locals=0x80e8edc, fromlist=0x80cc5ac) at Python/import.c:1536
#42 0x0806ce61 in PyImport_ImportModuleEx (name=0x81162ac "vtk", 
    globals=0x80e8edc, locals=0x80e8edc, fromlist=0x80cc5ac)
    at Python/import.c:1577
#43 0x080a94d5 in builtin___import__ (self=0x0, args=0x80e9f5c)
    at Python/bltinmodule.c:31
#44 0x0805d7c2 in call_cfunction (func=0x80e2940, arg=0x80e9f5c, kw=0x0)
    at Python/ceval.c:2858
#45 0x0805d71b in call_object (func=0x80e2940, arg=0x80e9f5c, kw=0x0)
    at Python/ceval.c:2820
#46 0x0805d544 in PyEval_CallObjectWithKeywords (func=0x80e2940, 
    arg=0x80e9f5c, kw=0x0) at Python/ceval.c:2753
#47 0x0805b8ec in eval_code2 (co=0x80e9368, globals=0x80e8edc, 
    locals=0x80e8edc, args=0x0, argcount=0, kws=0x0, kwcount=0,
defs=0x0, 
    defcount=0, closure=0x0) at Python/ceval.c:1832
#48 0x08058db5 in PyEval_EvalCode (co=0x80e9368, globals=0x80e8edc, 
    locals=0x80e8edc) at Python/ceval.c:341
#49 0x0807312b in run_node (n=0x80e8f00, filename=0x80b105f "<stdin>", 
    globals=0x80e8edc, locals=0x80e8edc, flags=0xbffff668)
    at Python/pythonrun.c:1049
#50 0x0807202c in PyRun_InteractiveOneFlags (fp=0x427006e0, 
    filename=0x80b105f "<stdin>", flags=0xbffff668) at
Python/pythonrun.c:571
#51 0x08071e5e in PyRun_InteractiveLoopFlags (fp=0x427006e0, 
    filename=0x80b105f "<stdin>", flags=0xbffff668) at
Python/pythonrun.c:511
#52 0x08071d88 in PyRun_AnyFileExFlags (fp=0x427006e0, 
    filename=0x80b105f "<stdin>", closeit=0, flags=0xbffff668)
    at Python/pythonrun.c:474
#53 0x080557ca in Py_Main (argc=1, argv=0xbffff714) at
Modules/main.c:320
#54 0x0805525f in main (argc=1, argv=0xbffff714)
    at /surface/donna/Linux/VTK/Wrapping/Python/vtkpython.cxx:36
#55 0x42611baf in __libc_start_main () from /lib/libc.so.6
(gdb) quit

A yahoo search turned up the following links, which seemed relevant, but
I'm not able to translate them into a solution:

http://www.dssd.ca/wine/Winelib-Apps-0.2.html#visual-mingw
http://www.winehq.org/Docs/winelib-user/init-problems.shtml

Also, Andy Cedelnik once explained to me:

> Anyway, the reason why vtkpython works is because when python loads
> shared libraries, on some platforms it does not initialize c++ classess
> correctly. On platforms such as windows or linux, these classes are
> initialized, while on Suns, HPs, SGIs, they are not.
> 
> The trick of vtkpython is that it is actually a C++ program which is
> linked to python library. Since it is a C++ program, it does initialize
> c++ classes.

Again -- helpful, but I'm not sure what to do.

Why not use python instead of vtkpython?  Well, I tried that, and I can
import the vtk libraries successfully; however, when I try to write a
vtk file, python crashes with:

Program received signal SIGABRT, Aborted.
[Switching to Thread 1024 (LWP 1002)]
0x402e1bc1 in __kill () at __kill:-1
-1      __kill: No such file or directory.
        in __kill
(gdb) where
#0  0x402e1bc1 in __kill () at __kill:-1
#1  0x4002a7ac in pthread_kill () from /lib/libpthread.so.0
#2  0x4002ac96 in raise () from /lib/libpthread.so.0
#3  0x402e2fe1 in abort () from /lib/libc.so.6
#4  0x40afe8b5 in __cxxabiv1::__terminate(void (*)()) (
    handler=0x8051de0 <abort>) at eh_terminate.cc:47
#5  0x40afe8a0 in std::terminate() () at eh_terminate.cc:57
#6  0x40afe790 in __cxa_throw (obj=0x8736d90, tinfo=0x40b0bf60, 
    dest=0x40afe340 <std::bad_cast::~bad_cast()>) at eh_throw.cc:77
#7  0x40b08d4f in std::__throw_bad_cast() () at functexcept.cc:50
#8  0x40cfac77 in std::basic_ios<char, std::char_traits<char>
>::_M_check_facet(std::locale::facet const*) () from /home/donna/SUREfit/lib/libvtkIOPython.so
#9  0x40cfaa32 in std::ostream::operator<<(long) ()
   from /home/donna/SUREfit/lib/libvtkIOPython.so
#10 0x40cf9eee in std::ostream::operator<<(int) ()
   from /home/donna/SUREfit/lib/libvtkIOPython.so
#11 0x40e03ea3 in vtkDataWriter::WritePoints(std::ostream*, vtkPoints*)
()
   from /home/donna/SUREfit/lib/libvtkIO.so
#12 0x40e881a1 in vtkPolyDataWriter::WriteData() ()
   from /home/donna/SUREfit/lib/libvtkIO.so
#13 0x40ea9204 in vtkWriter::Write() ()
   from /home/donna/SUREfit/lib/libvtkIO.so
#14 0x40cf90f5 in PyVTKClass_vtkVolumeReaderNew ()
   from /home/donna/SUREfit/lib/libvtkIOPython.so

I had run into this runtime problem with python on my build host, too,
which is why I switched to vtkpython on Linux.

Any ideas as to why I'm having runtime trouble linking to the vtk
libraries are appreciated.

Thanks,

Donna Hanlon
http://surefit.sourceforge.net/



More information about the vtkusers mailing list