Python - 程序接收信号SIGSEGV,分段错误

时间:2015-11-15 12:09:21

标签: python c++ c numpy tesseract

我正在为我的学位论文吃午餐。我知道它可以工作......但不是在我的电脑上!

我正在使用Ubuntu 14.04,首先我收到此错误:

  

分段错误(核心转储)

我试图启动

  

gbd python   (gbd)运行MainLogic.py

结果如下:

Starting program: /usr/bin/python MainLogic.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
[New Thread 0x7fffe13a9700 (LWP 10347)]
[New Thread 0x7fffda0a4700 (LWP 10349)]
[New Thread 0x7fffcfc29700 (LWP 10350)]
[New Thread 0x7fffcf428700 (LWP 10351)]
[New Thread 0x7fffcec27700 (LWP 10352)]
[New Thread 0x7fffce426700 (LWP 10353)]
[New Thread 0x7fffcdc25700 (LWP 10354)]
[New Thread 0x7fffcd424700 (LWP 10355)]
[New Thread 0x7fffccc23700 (LWP 10356)]
[New Thread 0x7fffb7fff700 (LWP 10357)]

Program received signal SIGSEGV, Segmentation fault.
0x00007fffd1f0f379 in convert_to_IplImage (dst=<synthetic pointer>, 
    o=<numpy.ndarray at remote 0x2169870>, o@entry=< at remote 0x21672d0>)
    at main.cpp:255
255     if (PyString_Check(ipl->data)) {

我启动了“bt”命令以进行回溯:

`   0x00007fffd1f0f379 in convert_to_IplImage (dst=<synthetic pointer>, 
o=<numpy.ndarray at remote 0x2169870>, o@entry=< at remote 0x21672d0>)
at main.cpp:255

SetCvImage (o=o@entry=<numpy.ndarray at remote 0x2169870>,api=0x21672d0)
at main.cpp:285

0x00007fffd1ec11c0 in _wrap_SetCvImage (args=<optimized out>)
at tesseract_wrap.cpp:158558

0x000000000049968d in call_function (oparg=<optimized out>, 
pp_stack=0x7fffffffd210) at ../Python/ceval.c:4020

PyEval_EvalFrameEx (
f=f@entry=Frame 0xa04db0, for file /home/mypc/Model/image.py, line 404, in Methods_Text_Recognition_Based_Analysis_cc (self=<Image(max_tink_wall=0, numberDoors=0, image_run_pixel=None, file_name='13.png', list_door=[], labels=<numpy.ndarray at remote 0x14f9e90>, height=717, image_rect=None, graph_wall=<Graph(_nodes=[], _indices={}) at remote 0x7fffd23cef10>, color_image=<numpy.ndarray at remote 0x14db170>, dic_scale={}, list_cc=[<CC(numPixel=29, list_obl=[], list_rect=[], y_min=1, list_print_obl=[], image=<numpy.ndarray at remote 0xebaab0>, y_max=17, height=17, width=6, x_max=183, x_min=178, image_dist_tran=<numpy.ndarray at remote 0x1abb480>, id=1) at remote 0x7fffd0204cf8>, <CC(numPixel=78, list_obl=[], list_rect=[], y_min=1, list_print_obl=[], image=<numpy.ndarray at remote 0x1ab0940>, y_max=17, height=17, width=14, x_max=252, x_min=239, image_dist_tran=<numpy.ndarray at remote 0x1abb580>, id=2) at remote 0x7fffd0204dd0>, <CC(numPixel=95, list_obl=[], list_rect=[], y_min=1, list_print_..`

也许我的软件包和我的Ubuntu设置有问题,因为在其他电脑中代码工作正常。 如何修复此分段错误?

1 个答案:

答案 0 :(得分:0)

尝试更新到最新的gcc版本。它应该从4.8.2或4.8.3的某个地方开始修复 您也可以尝试更新为gcc 5。*。

如果这些都不起作用,你可以尝试修补/libstdc++v3/python/hook.in的hackish方式,如here所述。