[Python-modules-team] Bug#926351: python3-tesserocr: segfaults on import

Bernhard Übelacker bernhardu at mailbox.org
Fri Apr 5 22:26:55 BST 2019


Dear Maintainer,
just tried to help triaging this issue.

Seems this is "expected" behaviour with LC_ALL not
set to "C". In the end it leads to this upstream bug:

    https://github.com/sirfz/tesserocr/issues/165

It contains some workarounds and more information.

Kind regards,
Bernhard
-------------- next part --------------

# Buster amd64 qemu VM 2019-04-05


apt update
apt dist-upgrade


apt install dpkg-dev devscripts systemd-coredump gdb python3-tesserocr python3-dbg python3-tesserocr-dbgsym libtesseract4-dbgsym



mkdir /home/benutzer/source/libtesseract4/orig -p
cd    /home/benutzer/source/libtesseract4/orig
apt source libtesseract4
cd

mkdir /home/benutzer/source/libc6/orig -p
cd    /home/benutzer/source/libc6/orig
apt source libc6
cd

mkdir /home/benutzer/source/python3-tesserocr/orig -p
cd    /home/benutzer/source/python3-tesserocr/orig
apt source python3-tesserocr
cd





#############


benutzer at debian:~$ echo $LANG
de_DE.UTF-8
benutzer at debian:~$ python3
Python 3.7.3rc1 (default, Mar 13 2019, 11:01:15) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tesserocr
!strcmp(locale, "C"):Error:Assert failed:in file baseapi.cpp, line 209
Speicherzugriffsfehler (Speicherabzug geschrieben)



benutzer at debian:~$ LC_ALL=C python3
Python 3.7.3rc1 (default, Mar 13 2019, 11:01:15) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tesserocr
>>> quit()



benutzer at debian:~$ python3
Python 3.7.3rc1 (default, Mar 13 2019, 11:01:15) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'C')
'C'
>>> import tesserocr
>>> quit()





#############


dmesg
[  212.933342] python3[14744]: segfault at 0 ip 00007fcfe93279d2 sp 00007ffc7c947e20 error 6 in libtesseract.so.4.0.0[7fcfe913e000+1fa000]
[  212.933352] Code: 15 03 00 31 c0 48 8d 3d 5c d9 31 00 e8 57 fe ff ff eb b7 0f 1f 44 00 00 b8 0a 00 00 00 66 89 03 e9 7c ff ff ff e8 9e da e1 ff <c7> 04 25 00 00 00 00 00 00 00 00 0f 0b 90 48 8b 36 48 8b 3f e9 65


root at debian:~# coredumpctl list
TIME                            PID   UID   GID SIG COREFILE  EXE
Fri 2019-04-05 22:44:14 CEST  14744  1000  1000  11 present   /usr/bin/python3.7


root at debian:~# coredumpctl gdb 14744
           PID: 14744 (python3)
           UID: 1000 (benutzer)
           GID: 1000 (benutzer)
        Signal: 11 (SEGV)
     Timestamp: Fri 2019-04-05 22:44:14 CEST (1min 49s ago)
  Command Line: python3
    Executable: /usr/bin/python3.7
 Control Group: /user.slice/user-1000.slice/session-3.scope
          Unit: session-3.scope
         Slice: user-1000.slice
       Session: 3
     Owner UID: 1000 (benutzer)
       Boot ID: 3194a9e501f04eda9f2e24fc8030724b
    Machine ID: 32f43b50ac8c4b21941bc0b02f8e7811
      Hostname: debian
       Storage: /var/lib/systemd/coredump/core.python3.1000.3194a9e501f04eda9f2e24fc8030724b.14744.1554497054000000.lz4
       Message: Process 14744 (python3) of user 1000 dumped core.
                
                Stack trace of thread 14744:
                #0  0x00007fcfe93279d2 _ZNK7ERRCODE5errorEPKc16TessErrorLogCodeS1_z (libtesseract.so.4)
                #1  0x00007fcfe915f59e _ZN9tesseract11TessBaseAPIC1Ev (libtesseract.so.4)
                #2  0x00007fcfe96ac680 n/a (tesserocr.cpython-37m-x86_64-linux-gnu.so)
                #3  0x00007fcfea43c30a n/a (ld-linux-x86-64.so.2)
                #4  0x00007fcfea43c406 n/a (ld-linux-x86-64.so.2)
                #5  0x00007fcfea440263 n/a (ld-linux-x86-64.so.2)
                #6  0x00007fcfe9f52eaf _dl_catch_exception (libc.so.6)
                #7  0x00007fcfea43fb4a n/a (ld-linux-x86-64.so.2)
                #8  0x00007fcfea3c5256 n/a (libdl.so.2)
                #9  0x00007fcfe9f52eaf _dl_catch_exception (libc.so.6)
                #10 0x00007fcfe9f52f3f _dl_catch_error (libc.so.6)
                #11 0x00007fcfea3c5975 n/a (libdl.so.2)
                #12 0x00007fcfea3c52e6 dlopen (libdl.so.2)
                #13 0x0000000000626fdc _PyImport_FindSharedFuncptr (python3.7)
                #14 0x00000000006329b8 _PyImport_LoadDynamicModuleWithSpec (python3.7)
                #15 0x0000000000632d8b n/a (python3.7)
                #16 0x00000000005c8a37 _PyMethodDef_RawFastCallDict (python3.7)
                #17 0x00000000005c8bfa PyCFunction_Call (python3.7)
                #18 0x0000000000544aa5 _PyEval_EvalFrameDefault (python3.7)
                #19 0x000000000053cfb2 _PyEval_EvalCodeWithName (python3.7)
                #20 0x00000000005c9222 _PyFunction_FastCallKeywords (python3.7)
                #21 0x000000000053c430 n/a (python3.7)
                #22 0x0000000000543d9b _PyEval_EvalFrameDefault (python3.7)
                #23 0x00000000005c8f1c _PyFunction_FastCallKeywords (python3.7)
                #24 0x000000000053fa6c _PyEval_EvalFrameDefault (python3.7)
                #25 0x00000000005c8f1c _PyFunction_FastCallKeywords (python3.7)
                #26 0x000000000053f8cc _PyEval_EvalFrameDefault (python3.7)
                #27 0x00000000005c8f1c _PyFunction_FastCallKeywords (python3.7)
                #28 0x000000000053f8cc _PyEval_EvalFrameDefault (python3.7)
                #29 0x00000000005c8f1c _PyFunction_FastCallKeywords (python3.7)
                #30 0x000000000053f8cc _PyEval_EvalFrameDefault (python3.7)
                #31 0x00000000005ca277 _PyFunction_FastCallDict (python3.7)
                #32 0x00000000005cc294 n/a (python3.7)
                #33 0x00000000005cc6dd _PyObject_CallMethodIdObjArgs (python3.7)
                #34 0x000000000052ad9b PyImport_ImportModuleLevelObject (python3.7)
                #35 0x0000000000541491 _PyEval_EvalFrameDefault (python3.7)
                #36 0x000000000053cfb2 _PyEval_EvalCodeWithName (python3.7)
                #37 0x000000000053f3c3 PyEval_EvalCode (python3.7)
                #38 0x000000000062bcfe n/a (python3.7)
                #39 0x0000000000471cbb n/a (python3.7)
                #40 0x0000000000471e3d PyRun_InteractiveLoopFlags (python3.7)
                #41 0x000000000062ce33 PyRun_AnyFileExFlags (python3.7)
                #42 0x0000000000652c7e n/a (python3.7)
                #43 0x0000000000652fde _Py_UnixMain (python3.7)
                #44 0x00007fcfe9e4209b __libc_start_main (libc.so.6)
                #45 0x00000000005d108a _start (python3.7)

GNU gdb (Debian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/python3.7...(no debugging symbols found)...done.

warning: core file may not match specified executable file.
[New LWP 14744]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `python3'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fcfe93279d2 in ERRCODE::error(char const*, TessErrorLogCode, char const*, ...) const () from /usr/lib/x86_64-linux-gnu/libtesseract.so.4
(gdb) set width 0
(gdb) set pagination off
(gdb) bt
#0  0x00007fcfe93279d2 in ERRCODE::error(char const*, TessErrorLogCode, char const*, ...) const () from /usr/lib/x86_64-linux-gnu/libtesseract.so.4
#1  0x00007fcfe915f59e in tesseract::TessBaseAPI::TessBaseAPI() () from /usr/lib/x86_64-linux-gnu/libtesseract.so.4
#2  0x00007fcfe96ac680 in ?? () from /usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so
#3  0x00007fcfea43c30a in call_init (l=<optimized out>, argc=argc at entry=1, argv=argv at entry=0x7ffc7c949ea8, env=env at entry=0x212e350) at dl-init.c:72
#4  0x00007fcfea43c406 in call_init (env=0x212e350, argv=0x7ffc7c949ea8, argc=1, l=<optimized out>) at dl-init.c:30
#5  _dl_init (main_map=main_map at entry=0x21a6ea0, argc=1, argv=0x7ffc7c949ea8, env=0x212e350) at dl-init.c:119
#6  0x00007fcfea440263 in dl_open_worker (a=a at entry=0x7ffc7c948600) at dl-open.c:517
#7  0x00007fcfe9f52eaf in __GI__dl_catch_exception (exception=exception at entry=0x7ffc7c9485e0, operate=operate at entry=0x7fcfea43fef0 <dl_open_worker>, args=args at entry=0x7ffc7c948600) at dl-error-skeleton.c:196
#8  0x00007fcfea43fb4a in _dl_open (file=0x7fcfe9a0dd70 "/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so", mode=-2147483646, caller_dlopen=0x626fdc <_PyImport_FindSharedFuncptr+108>, nsid=<optimized out>, argc=1, argv=0x7ffc7c949ea8, env=0x212e350) at dl-open.c:599
#9  0x00007fcfea3c5256 in dlopen_doit (a=a at entry=0x7ffc7c948820) at dlopen.c:66
#10 0x00007fcfe9f52eaf in __GI__dl_catch_exception (exception=exception at entry=0x7ffc7c9487c0, operate=operate at entry=0x7fcfea3c5200 <dlopen_doit>, args=args at entry=0x7ffc7c948820) at dl-error-skeleton.c:196
#11 0x00007fcfe9f52f3f in __GI__dl_catch_error (objname=objname at entry=0x21736f0, errstring=errstring at entry=0x21736f8, mallocedp=mallocedp at entry=0x21736e8, operate=operate at entry=0x7fcfea3c5200 <dlopen_doit>, args=args at entry=0x7ffc7c948820) at dl-error-skeleton.c:215
#12 0x00007fcfea3c5975 in _dlerror_run (operate=operate at entry=0x7fcfea3c5200 <dlopen_doit>, args=args at entry=0x7ffc7c948820) at dlerror.c:163
#13 0x00007fcfea3c52e6 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#14 0x0000000000626fdc in _PyImport_FindSharedFuncptr ()
#15 0x00000000006329b8 in _PyImport_LoadDynamicModuleWithSpec ()
#16 0x0000000000632d8b in ?? ()
#17 0x00000000005c8a37 in _PyMethodDef_RawFastCallDict ()
#18 0x00000000005c8bfa in PyCFunction_Call ()
#19 0x0000000000544aa5 in _PyEval_EvalFrameDefault ()
#20 0x000000000053cfb2 in _PyEval_EvalCodeWithName ()
#21 0x00000000005c9222 in _PyFunction_FastCallKeywords ()
#22 0x000000000053c430 in ?? ()
#23 0x0000000000543d9b in _PyEval_EvalFrameDefault ()
#24 0x00000000005c8f1c in _PyFunction_FastCallKeywords ()
#25 0x000000000053fa6c in _PyEval_EvalFrameDefault ()
#26 0x00000000005c8f1c in _PyFunction_FastCallKeywords ()
#27 0x000000000053f8cc in _PyEval_EvalFrameDefault ()
#28 0x00000000005c8f1c in _PyFunction_FastCallKeywords ()
#29 0x000000000053f8cc in _PyEval_EvalFrameDefault ()
#30 0x00000000005c8f1c in _PyFunction_FastCallKeywords ()
#31 0x000000000053f8cc in _PyEval_EvalFrameDefault ()
#32 0x00000000005ca277 in _PyFunction_FastCallDict ()
#33 0x00000000005cc294 in ?? ()
#34 0x00000000005cc6dd in _PyObject_CallMethodIdObjArgs ()
#35 0x000000000052ad9b in PyImport_ImportModuleLevelObject ()
#36 0x0000000000541491 in _PyEval_EvalFrameDefault ()
#37 0x000000000053cfb2 in _PyEval_EvalCodeWithName ()
#38 0x000000000053f3c3 in PyEval_EvalCode ()
#39 0x000000000062bcfe in ?? ()
#40 0x0000000000471cbb in ?? ()
#41 0x0000000000471e3d in PyRun_InteractiveLoopFlags ()
#42 0x000000000062ce33 in PyRun_AnyFileExFlags ()
#43 0x0000000000652c7e in ?? ()
#44 0x0000000000652fde in _Py_UnixMain ()
#45 0x00007fcfe9e4209b in __libc_start_main (main=0x4a97f0 <main>, argc=1, argv=0x7ffc7c949ea8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc7c949e98) at ../csu/libc-start.c:308
#46 0x00000000005d108a in _start ()



Core was generated by `python3'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  ERRCODE::error (this=this at entry=0x7fcfe93f1480 <ASSERT_FAILED>, caller=caller at entry=0x7fcfe9338094 "!strcmp(locale, \"C\")", action=action at entry=ABORT, 
    format=format at entry=0x7fcfe9338080 "in file %s, line %d") at errcode.cpp:85
85      errcode.cpp: Datei oder Verzeichnis nicht gefunden.
(gdb) set width 0
(gdb) set pagination off
(gdb) directory /home/benutzer/source/libtesseract4/orig/tesseract-4.0.0/src/api
Source directories searched: /home/benutzer/source/libtesseract4/orig/tesseract-4.0.0/src/api:$cdir:$cwd
(gdb) bt
#0  ERRCODE::error (this=this at entry=0x7fcfe93f1480 <ASSERT_FAILED>, caller=caller at entry=0x7fcfe9338094 "!strcmp(locale, \"C\")", action=action at entry=ABORT, format=format at entry=0x7fcfe9338080 "in file %s, line %d") at errcode.cpp:85
#1  0x00007fcfe915f59e in tesseract::TessBaseAPI::TessBaseAPI (this=<optimized out>) at baseapi.cpp:209
#2  0x00007fcfe96ac680 in __static_initialization_and_destruction_0 (__priority=65535, __initialize_p=1) at tesserocr.cpp:40381
#3  _GLOBAL__sub_I_tesserocr.cpp(void) () at tesserocr.cpp:40381
#4  0x00007fcfea43c30a in call_init (l=<optimized out>, argc=argc at entry=1, argv=argv at entry=0x7ffc7c949ea8, env=env at entry=0x212e350) at dl-init.c:72
#5  0x00007fcfea43c406 in call_init (env=0x212e350, argv=0x7ffc7c949ea8, argc=1, l=<optimized out>) at dl-init.c:30
#6  _dl_init (main_map=main_map at entry=0x21a6ea0, argc=1, argv=0x7ffc7c949ea8, env=0x212e350) at dl-init.c:119
#7  0x00007fcfea440263 in dl_open_worker (a=a at entry=0x7ffc7c948600) at dl-open.c:517
#8  0x00007fcfe9f52eaf in __GI__dl_catch_exception (exception=exception at entry=0x7ffc7c9485e0, operate=operate at entry=0x7fcfea43fef0 <dl_open_worker>, args=args at entry=0x7ffc7c948600) at dl-error-skeleton.c:196
#9  0x00007fcfea43fb4a in _dl_open (file=0x7fcfe9a0dd70 "/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so", mode=-2147483646, caller_dlopen=0x626fdc <_PyImport_FindSharedFuncptr+108>, nsid=<optimized out>, argc=1, argv=0x7ffc7c949ea8, env=0x212e350) at dl-open.c:599
#10 0x00007fcfea3c5256 in dlopen_doit (a=a at entry=0x7ffc7c948820) at dlopen.c:66
#11 0x00007fcfe9f52eaf in __GI__dl_catch_exception (exception=exception at entry=0x7ffc7c9487c0, operate=operate at entry=0x7fcfea3c5200 <dlopen_doit>, args=args at entry=0x7ffc7c948820) at dl-error-skeleton.c:196
#12 0x00007fcfe9f52f3f in __GI__dl_catch_error (objname=objname at entry=0x21736f0, errstring=errstring at entry=0x21736f8, mallocedp=mallocedp at entry=0x21736e8, operate=operate at entry=0x7fcfea3c5200 <dlopen_doit>, args=args at entry=0x7ffc7c948820) at dl-error-skeleton.c:215
#13 0x00007fcfea3c5975 in _dlerror_run (operate=operate at entry=0x7fcfea3c5200 <dlopen_doit>, args=args at entry=0x7ffc7c948820) at dlerror.c:163
#14 0x00007fcfea3c52e6 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#15 0x0000000000626fdc in _PyImport_FindSharedFuncptr (prefix=0x778e92 "PyInit", shortname=0x7fcfe9a1fb90 "tesserocr", pathname=0x7fcfe9a0dd70 "/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so", fp=0x0) at ../Python/dynload_shlib.c:96
#16 0x00000000006329b8 in _PyImport_LoadDynamicModuleWithSpec (spec=<ModuleSpec(name='tesserocr', loader=<ExtensionFileLoader(name='tesserocr', path='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so') at remote 0x7fcfe99a26a0>, origin='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7fcfe99a26d8>, fp=0x0) at ../Python/importdl.c:129
#17 0x0000000000632d8b in _imp_create_dynamic_impl (module=<optimized out>, file=<optimized out>, spec=<ModuleSpec(name='tesserocr', loader=<ExtensionFileLoader(name='tesserocr', path='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so') at remote 0x7fcfe99a26a0>, origin='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7fcfe99a26d8>) at ../Python/import.c:2158
#18 _imp_create_dynamic (module=<optimized out>, args=<optimized out>, nargs=<optimized out>) at ../Python/clinic/import.c.h:289
#19 0x00000000005c8a37 in _PyMethodDef_RawFastCallDict (method=0x89a800 <imp_methods+320>, self=<module at remote 0x7fcfe9ae7778>, args=<optimized out>, nargs=1, kwargs={}) at ../Objects/call.c:530
#20 0x00000000005c8bfa in _PyCFunction_FastCallDict (kwargs=<optimized out>, nargs=<optimized out>, args=<optimized out>, func=<built-in method create_dynamic of module object at remote 0x7fcfe9ae7778>) at ../Objects/call.c:573
#21 PyCFunction_Call (func=<built-in method create_dynamic of module object at remote 0x7fcfe9ae7778>, args=<optimized out>, kwargs=<optimized out>) at ../Objects/call.c:787
#22 0x0000000000544aa5 in do_call_core (kwdict={}, callargs=(<ModuleSpec(name='tesserocr', loader=<ExtensionFileLoader(name='tesserocr', path='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so') at remote 0x7fcfe99a26a0>, origin='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7fcfe99a26d8>,), func=<built-in method create_dynamic of module object at remote 0x7fcfe9ae7778>) at ../Python/ceval.c:4641
#23 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:3191
#24 0x000000000053cfb2 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7fcfe9a4f3b8, for file <frozen importlib._bootstrap>, line 219, in _call_with_frames_removed (f=<built-in method create_dynamic of module object at remote 0x7fcfe9ae7778>, args=(<ModuleSpec(name='tesserocr', loader=<ExtensionFileLoader(name='tesserocr', path='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so') at remote 0x7fcfe99a26a0>, origin='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7fcfe99a26d8>,), kwds={})) at ../Python/ceval.c:547
#25 _PyEval_EvalCodeWithName (_co=<optimized out>, globals=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=<optimized out>, kwnames=0x0, kwargs=0x2172aa8, kwcount=<optimized out>, kwstep=1, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name='_call_with_frames_removed', qualname='_call_with_frames_removed') at ../Python/ceval.c:3930
#26 0x00000000005c9222 in _PyFunction_FastCallKeywords (func=<optimized out>, stack=0x2172a98, nargs=2, kwnames=<optimized out>) at ../Objects/call.c:433
#27 0x000000000053c430 in call_function (pp_stack=0x7ffc7c948fc0, oparg=<optimized out>, kwnames=<optimized out>) at ../Python/ceval.c:4616
#28 0x0000000000543d9b in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:3093
#29 0x00000000005c8f1c in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x2172908, for file <frozen importlib._bootstrap_external>, line 1043, in create_module (self=<ExtensionFileLoader(name='tesserocr', path='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so') at remote 0x7fcfe99a26a0>, spec=<ModuleSpec(name='tesserocr', loader=<...>, origin='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7fcfe99a26d8>)) at ../Python/ceval.c:547
#30 function_code_fastcall (globals={'__name__': '_frozen_importlib_external', '__doc__': 'Core implementation of path-based import.\n\nThis module is NOT meant to be directly imported! It has been designed such\nthat it can be bootstrapped into Python as the implementation of import. As\nsuch it requires the injection of specific modules and attributes in order to\nwork. One should use importlib as the public-facing version of this module.\n\n', '__package__': '', '__loader__': <type at remote 0x212b428>, '__spec__': <ModuleSpec(name='_frozen_importlib_external', loader=<type at remote 0x212b428>, origin='frozen', loader_state=None, submodule_search_locations=None, _set_fileattr=False, _cached=None, _initializing=False) at remote 0x7fcfe9a7b1d0>, '__builtins__': {'__name__': 'builtins', '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", '__package__': '', '__loader__': <type at remote 0x212ab48>, '__spec__': <ModuleSpec(name='builtins', loader=<type at ...(truncated), nargs=<optimized out>, args=<optimized out>, co=<optimized out>) at ../Objects/call.c:283
#31 _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at ../Objects/call.c:408
#32 0x000000000053fa6c in call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=0x7ffc7c949150) at ../Python/ceval.c:4616
#33 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:3110
#34 0x00000000005c8f1c in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7fcfe9aeb3a8, for file <frozen importlib._bootstrap>, line 583, in module_from_spec (spec=<ModuleSpec(name='tesserocr', loader=<ExtensionFileLoader(name='tesserocr', path='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so') at remote 0x7fcfe99a26a0>, origin='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7fcfe99a26d8>, module=None)) at ../Python/ceval.c:547
#35 function_code_fastcall (globals={'__name__': '_frozen_importlib', '__doc__': 'Core implementation of import.\n\nThis module is NOT meant to be directly imported! It has been designed such\nthat it can be bootstrapped into Python as the implementation of import. As\nsuch it requires the injection of specific modules and attributes in order to\nwork. One should use importlib as the public-facing version of this module.\n\n', '__package__': '', '__loader__': <type at remote 0x212b428>, '__spec__': <ModuleSpec(name='_frozen_importlib', loader=<type at remote 0x212b428>, origin=None, loader_state=None, submodule_search_locations=None, _set_fileattr=False, _cached=None) at remote 0x7fcfe9ae6ac8>, '__builtins__': {'__name__': 'builtins', '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", '__package__': '', '__loader__': <type at remote 0x212ab48>, '__spec__': <ModuleSpec(name='builtins', loader=<type at remote 0x212ab48>, origin=None, loader_state=None, sub...(truncated), nargs=<optimized out>, args=<optimized out>, co=<optimized out>) at ../Objects/call.c:283
#36 _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at ../Objects/call.c:408
#37 0x000000000053f8cc in call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>) at ../Python/ceval.c:4616
#38 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:3124
#39 0x00000000005c8f1c in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7fcfe9a38b88, for file <frozen importlib._bootstrap>, line 670, in _load_unlocked (spec=<ModuleSpec(name='tesserocr', loader=<ExtensionFileLoader(name='tesserocr', path='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so') at remote 0x7fcfe99a26a0>, origin='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7fcfe99a26d8>)) at ../Python/ceval.c:547
#40 function_code_fastcall (globals={'__name__': '_frozen_importlib', '__doc__': 'Core implementation of import.\n\nThis module is NOT meant to be directly imported! It has been designed such\nthat it can be bootstrapped into Python as the implementation of import. As\nsuch it requires the injection of specific modules and attributes in order to\nwork. One should use importlib as the public-facing version of this module.\n\n', '__package__': '', '__loader__': <type at remote 0x212b428>, '__spec__': <ModuleSpec(name='_frozen_importlib', loader=<type at remote 0x212b428>, origin=None, loader_state=None, submodule_search_locations=None, _set_fileattr=False, _cached=None) at remote 0x7fcfe9ae6ac8>, '__builtins__': {'__name__': 'builtins', '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", '__package__': '', '__loader__': <type at remote 0x212ab48>, '__spec__': <ModuleSpec(name='builtins', loader=<type at remote 0x212ab48>, origin=None, loader_state=None, sub...(truncated), nargs=<optimized out>, args=<optimized out>, co=<optimized out>) at ../Objects/call.c:283
#41 _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at ../Objects/call.c:408
#42 0x000000000053f8cc in call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>) at ../Python/ceval.c:4616
#43 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:3124
#44 0x00000000005c8f1c in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x21386f8, for file <frozen importlib._bootstrap>, line 967, in _find_and_load_unlocked (name='tesserocr', import_=<built-in method __import__ of module object at remote 0x7fcfe9b2ac28>, path=None, parent='', spec=<ModuleSpec(name='tesserocr', loader=<ExtensionFileLoader(name='tesserocr', path='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so') at remote 0x7fcfe99a26a0>, origin='/usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7fcfe99a26d8>)) at ../Python/ceval.c:547
#45 function_code_fastcall (globals={'__name__': '_frozen_importlib', '__doc__': 'Core implementation of import.\n\nThis module is NOT meant to be directly imported! It has been designed such\nthat it can be bootstrapped into Python as the implementation of import. As\nsuch it requires the injection of specific modules and attributes in order to\nwork. One should use importlib as the public-facing version of this module.\n\n', '__package__': '', '__loader__': <type at remote 0x212b428>, '__spec__': <ModuleSpec(name='_frozen_importlib', loader=<type at remote 0x212b428>, origin=None, loader_state=None, submodule_search_locations=None, _set_fileattr=False, _cached=None) at remote 0x7fcfe9ae6ac8>, '__builtins__': {'__name__': 'builtins', '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", '__package__': '', '__loader__': <type at remote 0x212ab48>, '__spec__': <ModuleSpec(name='builtins', loader=<type at remote 0x212ab48>, origin=None, loader_state=None, sub...(truncated), nargs=<optimized out>, args=<optimized out>, co=<optimized out>) at ../Objects/call.c:283
#46 _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at ../Objects/call.c:408
#47 0x000000000053f8cc in call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>) at ../Python/ceval.c:4616
#48 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:3124
#49 0x00000000005ca277 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7fcfe999d048, for file <frozen importlib._bootstrap>, line 983, in _find_and_load (name='tesserocr', import_=<built-in method __import__ of module object at remote 0x7fcfe9b2ac28>, module=<object at remote 0x7fcfe9ad2040>)) at ../Python/ceval.c:547
#50 function_code_fastcall (globals=<optimized out>, nargs=<optimized out>, args=<optimized out>, co=<optimized out>) at ../Objects/call.c:283
#51 _PyFunction_FastCallDict (func=<optimized out>, args=<optimized out>, nargs=<optimized out>, kwargs=<optimized out>) at ../Objects/call.c:322
#52 0x00000000005cc294 in _PyObject_FastCallDict (kwargs=0x0, nargs=<optimized out>, args=0x7ffc7c949760, callable=<function at remote 0x7fcfe9af0d90>) at ../Objects/call.c:1198
#53 object_vacall (callable=<function at remote 0x7fcfe9af0d90>, vargs=<optimized out>) at ../Objects/call.c:1198
#54 0x00000000005cc6dd in _PyObject_CallMethodIdObjArgs (obj=<optimized out>, name=<optimized out>) at ../Objects/call.c:1248
#55 0x000000000052ad9b in import_find_and_load (abs_name='tesserocr') at ../Python/import.c:1646
#56 PyImport_ImportModuleLevelObject (name='tesserocr', globals=<optimized out>, locals=<optimized out>, fromlist=None, level=0) at ../Python/import.c:1754
#57 0x0000000000541491 in import_name (level=0, fromlist=None, name='tesserocr', f=Frame 0x7fcfe9af3840, for file <stdin>, line 1, in <module> ()) at ../Python/ceval.c:4770
#58 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:2600
#59 0x000000000053cfb2 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7fcfe9af3840, for file <stdin>, line 1, in <module> ()) at ../Python/ceval.c:547
#60 _PyEval_EvalCodeWithName (_co=<optimized out>, globals=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=<optimized out>, kwnames=0x0, kwargs=0x0, kwcount=<optimized out>, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0) at ../Python/ceval.c:3930
#61 0x000000000053f3c3 in PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, defcount=0, defs=0x0, kwcount=0, kws=0x0, argcount=0, args=0x0, locals=<optimized out>, globals=<optimized out>, _co=<optimized out>) at ../Python/ceval.c:3959
#62 PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:524
#63 0x000000000062bcfe in run_mod (mod=mod at entry=0x21a4ae8, filename=filename at entry='<stdin>', globals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <type at remote 0x212ab48>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7fcfe9b2ac28>}, locals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <type at remote 0x212ab48>, '__spec__': None, '__annotations__': {}, '__builtins__': <module at remote 0x7fcfe9b2ac28>}, flags=flags at entry=0x7ffc7c949c8c, arena=arena at entry=0x7fcfe9b311c8) at ../Python/pythonrun.c:1035
#64 0x0000000000471cbb in PyRun_InteractiveOneObjectEx (fp=fp at entry=0x7fcfe9fd9a00 <_IO_2_1_stdin_>, filename=filename at entry='<stdin>', flags=flags at entry=0x7ffc7c949c8c) at ../Python/pythonrun.c:256
#65 0x0000000000471e3d in PyRun_InteractiveLoopFlags (fp=fp at entry=0x7fcfe9fd9a00 <_IO_2_1_stdin_>, filename_str=filename_str at entry=0x773372 "<stdin>", flags=flags at entry=0x7ffc7c949c8c) at ../Python/pythonrun.c:120
#66 0x000000000062ce33 in PyRun_AnyFileExFlags (fp=0x7fcfe9fd9a00 <_IO_2_1_stdin_>, filename=0x773372 "<stdin>", closeit=0, flags=0x7ffc7c949c8c) at ../Python/pythonrun.c:78
#67 0x0000000000652c7e in pymain_run_file (p_cf=0x7ffc7c949c8c, filename=<optimized out>, fp=0x7fcfe9fd9a00 <_IO_2_1_stdin_>) at ../Modules/main.c:427
#68 pymain_run_filename (cf=0x7ffc7c949c8c, pymain=0x7ffc7c949d60) at ../Modules/main.c:1627
#69 pymain_run_python (pymain=0x7ffc7c949d60) at ../Modules/main.c:2877
#70 pymain_main (pymain=<optimized out>, pymain=<optimized out>) at ../Modules/main.c:3038
#71 0x0000000000652fde in _Py_UnixMain (argc=<optimized out>, argv=<optimized out>) at ../Modules/main.c:3073
#72 0x00007fcfe9e4209b in __libc_start_main (main=0x4a97f0 <main>, argc=1, argv=0x7ffc7c949ea8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc7c949e98) at ../csu/libc-start.c:308
#73 0x00000000005d108a in _start () at ../Modules/main.c:725


(gdb) up
#1  0x00007fcfe915f59e in tesseract::TessBaseAPI::TessBaseAPI (this=<optimized out>) at baseapi.cpp:209
209       ASSERT_HOST(!strcmp(locale, "C"));
(gdb) display/i $pc
1: x/i $pc
=> 0x7fcfe915f59e <tesseract::TessBaseAPI::TessBaseAPI()+334>:  jmp    0x7fcfe915f527 <tesseract::TessBaseAPI::TessBaseAPI()+215>
(gdb) print locale
$1 = <optimized out>


(gdb) list

181
182     TessBaseAPI::TessBaseAPI()
183         : tesseract_(nullptr),
184           osd_tesseract_(nullptr),
185           equ_detect_(nullptr),
186           reader_(nullptr),
187           // Thresholder is initialized to nullptr here, but will be set before use by:
188           // A constructor of a derived API,  SetThresholder(), or
189           // created implicitly when used in InternalSetImage.
190           thresholder_(nullptr),
191           paragraph_models_(nullptr),
192           block_list_(nullptr),
193           page_res_(nullptr),
194           input_file_(nullptr),
195           output_file_(nullptr),
196           datapath_(nullptr),
197           language_(nullptr),
198           last_oem_requested_(OEM_DEFAULT),
199           recognition_done_(false),
200           truth_cb_(nullptr),
201           rect_left_(0),
202           rect_top_(0),
203           rect_width_(0),
204           rect_height_(0),
205           image_width_(0),
206           image_height_(0) {
207       const char *locale;
208       locale = std::setlocale(LC_ALL, nullptr);
209       ASSERT_HOST(!strcmp(locale, "C"));
210       locale = std::setlocale(LC_CTYPE, nullptr);
211       ASSERT_HOST(!strcmp(locale, "C"));
212       locale = std::setlocale(LC_NUMERIC, nullptr);
213       ASSERT_HOST(!strcmp(locale, "C"));

(gdb) disassemble tesseract::TessBaseAPI::TessBaseAPI
Dump of assembler code for function tesseract::TessBaseAPI::TessBaseAPI():
   0x00007fcfe915f450 <+0>:     mov    0x2910b1(%rip),%rax        # 0x7fcfe93f0508
   0x00007fcfe915f457 <+7>:     push   %rbx
   0x00007fcfe915f458 <+8>:     xor    %esi,%esi
   0x00007fcfe915f45a <+10>:    lea    0x1f8ad9(%rip),%rbx        # 0x7fcfe9357f3a
   0x00007fcfe915f461 <+17>:    movq   $0x0,0x8(%rdi)
   0x00007fcfe915f469 <+25>:    add    $0x10,%rax
   0x00007fcfe915f46d <+29>:    movq   $0x0,0x10(%rdi)
   0x00007fcfe915f475 <+37>:    mov    %rax,(%rdi)
   0x00007fcfe915f478 <+40>:    lea    0x1f07f8(%rip),%rax        # 0x7fcfe934fc77
   0x00007fcfe915f47f <+47>:    movq   $0x0,0x18(%rdi)
   0x00007fcfe915f487 <+55>:    movq   $0x0,0x20(%rdi)
   0x00007fcfe915f48f <+63>:    movq   $0x0,0x28(%rdi)
   0x00007fcfe915f497 <+71>:    movq   $0x0,0x30(%rdi)
   0x00007fcfe915f49f <+79>:    movq   $0x0,0x38(%rdi)
   0x00007fcfe915f4a7 <+87>:    movq   $0x0,0x40(%rdi)
   0x00007fcfe915f4af <+95>:    movq   $0x0,0x48(%rdi)
   0x00007fcfe915f4b7 <+103>:   movq   $0x0,0x50(%rdi)
   0x00007fcfe915f4bf <+111>:   movq   $0x0,0x58(%rdi)
   0x00007fcfe915f4c7 <+119>:   movq   $0x0,0x60(%rdi)
   0x00007fcfe915f4cf <+127>:   movl   $0x3,0x68(%rdi)
   0x00007fcfe915f4d6 <+134>:   movb   $0x0,0x6c(%rdi)
   0x00007fcfe915f4da <+138>:   movq   $0x0,0x70(%rdi)
   0x00007fcfe915f4e2 <+146>:   movq   $0x0,0x78(%rdi)
   0x00007fcfe915f4ea <+154>:   movq   $0x0,0x80(%rdi)
   0x00007fcfe915f4f5 <+165>:   movq   $0x0,0x88(%rdi)
   0x00007fcfe915f500 <+176>:   mov    %rax,0x90(%rdi)
   0x00007fcfe915f507 <+183>:   mov    $0x6,%edi
   0x00007fcfe915f50c <+188>:   callq  0x7fcfe9143d80 <setlocale at plt>
   0x00007fcfe915f511 <+193>:   mov    $0x2,%ecx
   0x00007fcfe915f516 <+198>:   mov    %rbx,%rdi
   0x00007fcfe915f519 <+201>:   mov    %rax,%rsi
   0x00007fcfe915f51c <+204>:   repz cmpsb %es:(%rdi),%ds:(%rsi)
   0x00007fcfe915f51e <+206>:   seta   %al
   0x00007fcfe915f521 <+209>:   sbb    $0x0,%al
   0x00007fcfe915f523 <+211>:   test   %al,%al
   0x00007fcfe915f525 <+213>:   jne    0x7fcfe915f570 <tesseract::TessBaseAPI::TessBaseAPI()+288>
   0x00007fcfe915f527 <+215>:   xor    %esi,%esi
   0x00007fcfe915f529 <+217>:   xor    %edi,%edi
   0x00007fcfe915f52b <+219>:   callq  0x7fcfe9143d80 <setlocale at plt>
   0x00007fcfe915f530 <+224>:   mov    $0x2,%ecx
   0x00007fcfe915f535 <+229>:   mov    %rbx,%rdi
   0x00007fcfe915f538 <+232>:   mov    %rax,%rsi
   0x00007fcfe915f53b <+235>:   repz cmpsb %es:(%rdi),%ds:(%rsi)
   0x00007fcfe915f53d <+237>:   seta   %al
   0x00007fcfe915f540 <+240>:   sbb    $0x0,%al
   0x00007fcfe915f542 <+242>:   test   %al,%al
   0x00007fcfe915f544 <+244>:   jne    0x7fcfe915f5d0 <tesseract::TessBaseAPI::TessBaseAPI()+384>
   0x00007fcfe915f54a <+250>:   xor    %esi,%esi
   0x00007fcfe915f54c <+252>:   mov    $0x1,%edi
   0x00007fcfe915f551 <+257>:   callq  0x7fcfe9143d80 <setlocale at plt>
   0x00007fcfe915f556 <+262>:   mov    $0x2,%ecx
   0x00007fcfe915f55b <+267>:   mov    %rbx,%rdi
   0x00007fcfe915f55e <+270>:   mov    %rax,%rsi
   0x00007fcfe915f561 <+273>:   repz cmpsb %es:(%rdi),%ds:(%rsi)
   0x00007fcfe915f563 <+275>:   seta   %al
   0x00007fcfe915f566 <+278>:   sbb    $0x0,%al
   0x00007fcfe915f568 <+280>:   test   %al,%al
   0x00007fcfe915f56a <+282>:   jne    0x7fcfe915f5a0 <tesseract::TessBaseAPI::TessBaseAPI()+336>
   0x00007fcfe915f56c <+284>:   pop    %rbx
   0x00007fcfe915f56d <+285>:   retq   
   0x00007fcfe915f56e <+286>:   xchg   %ax,%ax
   0x00007fcfe915f570 <+288>:   mov    $0xd1,%r9d
   0x00007fcfe915f576 <+294>:   lea    0x1d8af7(%rip),%r8        # 0x7fcfe9338074
   0x00007fcfe915f57d <+301>:   xor    %eax,%eax
   0x00007fcfe915f57f <+303>:   mov    $0x2,%edx
   0x00007fcfe915f584 <+308>:   lea    0x1d8af5(%rip),%rcx        # 0x7fcfe9338080
   0x00007fcfe915f58b <+315>:   lea    0x1d8b02(%rip),%rsi        # 0x7fcfe9338094
   0x00007fcfe915f592 <+322>:   lea    0x291ee7(%rip),%rdi        # 0x7fcfe93f1480 <_ZL13ASSERT_FAILED>
   0x00007fcfe915f599 <+329>:   callq  0x7fcfe914b050 <_ZNK7ERRCODE5errorEPKc16TessErrorLogCodeS1_z at plt>    <<<<<<<<<<<<<<<<<
   0x00007fcfe915f59e <+334>:   jmp    0x7fcfe915f527 <tesseract::TessBaseAPI::TessBaseAPI()+215>
   0x00007fcfe915f5a0 <+336>:   mov    $0xd5,%r9d
   0x00007fcfe915f5a6 <+342>:   lea    0x1d8ac7(%rip),%r8        # 0x7fcfe9338074
   0x00007fcfe915f5ad <+349>:   xor    %eax,%eax
   0x00007fcfe915f5af <+351>:   pop    %rbx
   0x00007fcfe915f5b0 <+352>:   lea    0x1d8ac9(%rip),%rcx        # 0x7fcfe9338080
   0x00007fcfe915f5b7 <+359>:   mov    $0x2,%edx
   0x00007fcfe915f5bc <+364>:   lea    0x1d8ad1(%rip),%rsi        # 0x7fcfe9338094
   0x00007fcfe915f5c3 <+371>:   lea    0x291eb6(%rip),%rdi        # 0x7fcfe93f1480 <_ZL13ASSERT_FAILED>
   0x00007fcfe915f5ca <+378>:   jmpq   0x7fcfe914b050 <_ZNK7ERRCODE5errorEPKc16TessErrorLogCodeS1_z at plt>
   0x00007fcfe915f5cf <+383>:   nop
   0x00007fcfe915f5d0 <+384>:   mov    $0xd3,%r9d
   0x00007fcfe915f5d6 <+390>:   lea    0x1d8a97(%rip),%r8        # 0x7fcfe9338074
   0x00007fcfe915f5dd <+397>:   xor    %eax,%eax
   0x00007fcfe915f5df <+399>:   mov    $0x2,%edx
   0x00007fcfe915f5e4 <+404>:   lea    0x1d8a95(%rip),%rcx        # 0x7fcfe9338080
   0x00007fcfe915f5eb <+411>:   lea    0x1d8aa2(%rip),%rsi        # 0x7fcfe9338094
   0x00007fcfe915f5f2 <+418>:   lea    0x291e87(%rip),%rdi        # 0x7fcfe93f1480 <_ZL13ASSERT_FAILED>
   0x00007fcfe915f5f9 <+425>:   callq  0x7fcfe914b050 <_ZNK7ERRCODE5errorEPKc16TessErrorLogCodeS1_z at plt>
   0x00007fcfe915f5fe <+430>:   jmpq   0x7fcfe915f54a <tesseract::TessBaseAPI::TessBaseAPI()+250>
End of assembler dump.



############




benutzer at debian:~/source/libtesseract4/orig/tesseract-4.0.0/src/api$ gdb -q --args python3
Reading symbols from python3...Reading symbols from /usr/lib/debug/.build-id/f7/a005959bee4603ae22a65fcdbd66280deb3b54.debug...done.
done.
(gdb) set width 0
(gdb) set pagination off
(gdb) directory /home/benutzer/source/libtesseract4/orig/tesseract-4.0.0/src/api
Source directories searched: /home/benutzer/source/libtesseract4/orig/tesseract-4.0.0/src/api:$cdir:$cwd
(gdb) directory /home/benutzer/source/libc6/orig/glibc-2.28/locale
Source directories searched: /home/benutzer/source/libc6/orig/glibc-2.28/locale:/home/benutzer/source/libtesseract4/orig/tesseract-4.0.0/src/api:$cdir:$cwd
(gdb) b tesseract::TessBaseAPI::TessBaseAPI
Function "tesseract::TessBaseAPI::TessBaseAPI" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (tesseract::TessBaseAPI::TessBaseAPI) pending.
(gdb) run
Starting program: /usr/bin/python3 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Python 3.7.3rc1 (default, Mar 13 2019, 11:01:15) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tesserocr

Breakpoint 1, 0x00007ffff72474e0 in tesseract::TessBaseAPI::TessBaseAPI()@plt () from /usr/lib/python3/dist-packages/tesserocr.cpython-37m-x86_64-linux-gnu.so
(gdb) disa 1.1
(gdb) disa 1.3
(gdb) cont
Continuing.

Breakpoint 1, tesseract::TessBaseAPI::TessBaseAPI (this=0x7ffff72a6980 <__pyx_v_9tesserocr__api>) at baseapi.cpp:182
182     TessBaseAPI::TessBaseAPI()
(gdb) next
208       locale = std::setlocale(LC_ALL, nullptr);
(gdb) display/i $pc
1: x/i $pc
=> 0x7ffff6d02507 <tesseract::TessBaseAPI::TessBaseAPI()+183>:  mov    $0x6,%edi
(gdb) stepi
0x00007ffff6d0250c      208       locale = std::setlocale(LC_ALL, nullptr);
1: x/i $pc
=> 0x7ffff6d0250c <tesseract::TessBaseAPI::TessBaseAPI()+188>:  callq  0x7ffff6ce6d80 <setlocale at plt>
(gdb) display locale
2: locale = <optimized out>
(gdb) nexti
0x00007ffff6d02511      208       locale = std::setlocale(LC_ALL, nullptr);
1: x/i $pc
=> 0x7ffff6d02511 <tesseract::TessBaseAPI::TessBaseAPI()+193>:  mov    $0x2,%ecx
2: locale = <optimized out>
(gdb) 
0x00007ffff6d02516      208       locale = std::setlocale(LC_ALL, nullptr);
1: x/i $pc
=> 0x7ffff6d02516 <tesseract::TessBaseAPI::TessBaseAPI()+198>:  mov    %rbx,%rdi
2: locale = <optimized out>
(gdb) 
0x00007ffff6d02519      208       locale = std::setlocale(LC_ALL, nullptr);
1: x/i $pc
=> 0x7ffff6d02519 <tesseract::TessBaseAPI::TessBaseAPI()+201>:  mov    %rax,%rsi
2: locale = <optimized out>
(gdb) 
209       ASSERT_HOST(!strcmp(locale, "C"));
1: x/i $pc
=> 0x7ffff6d0251c <tesseract::TessBaseAPI::TessBaseAPI()+204>:  repz cmpsb %es:(%rdi),%ds:(%rsi)
2: locale = 0x8df390 "LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C"
(gdb) print/x $es
$1 = 0x0
(gdb) print/x $rdi
$2 = 0x7ffff6efaf3a
(gdb) print/x $ds
$3 = 0x0
(gdb) print/x $rsi
$4 = 0x8df390
(gdb) x/s $rsi
0x8df390:       "LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C"
(gdb) x/s $rdi
0x7ffff6efaf3a: "C"







set width 0
set pagination off
directory /home/benutzer/source/libtesseract4/orig/tesseract-4.0.0/src/api
directory /home/benutzer/source/libc6/orig/glibc-2.28/locale
b tesseract::TessBaseAPI::TessBaseAPI
y
run
import tesserocr
disa 1.1
disa 1.3
cont
next
display/i $pc
stepi





https://github.com/tesseract-ocr/tesseract/blame/master/src/api/baseapi.cpp

https://github.com/sirfz/tesserocr/issues/165



More information about the Python-modules-team mailing list