opencv-rust icon indicating copy to clipboard operation
opencv-rust copied to clipboard

Opencv breaks tensorflow and tesseract

Open slavb18 opened this issue 3 years ago • 2 comments

Problem initially started here

I have separate projects rustmtcnn, rusttess, rustopencv All fo them work idependently But any combination with opencv fail

  • tesseract+ tensorflow: work
  • tesseract : work
  • opencv + tensorflow : error
  • opencv + tensorflow + tesseract: error

For example project rustmtcnn works, but if I add line use opencv::{self as cv, prelude::*}; to main.rs, I receive SIGSEGV :

(gdb) r
Starting program: /rustmtcnn/target/debug/rustmtcnn 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5a79a53 in google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable const*) () from /usr/lib/libtensorflow_framework.so.2
(gdb) bt
#0  0x00007ffff5a79a53 in google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable const*) () at /usr/lib/libtensorflow_framework.so.2
#1  0x00007ffff7fe1fe2 in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffec78, env=env@entry=0x7fffffffec88) at dl-init.c:72
#2  0x00007ffff7fe20e9 in call_init (env=0x7fffffffec88, argv=0x7fffffffec78, argc=1, l=<optimized out>) at dl-init.c:30
#3  _dl_init (main_map=0x7ffff7ffe180, argc=1, argv=0x7fffffffec78, env=0x7fffffffec88) at dl-init.c:119
#4  0x00007ffff7fd30ca in _dl_start_user () at /lib64/ld-linux-x86-64.so.2
#5  0x0000000000000001 in  ()
#6  0x00007fffffffee7e in  ()
#7  0x0000000000000000 in  ()
(gdb) 
  1. Operating system: OS: KUbuntu 22.04
  2. The way you installed OpenCV: package (apt-get install -y clang libclang-dev libopencv-dev)
  3. OpenCV version: 4.5.1+dfsg-5
  4. rustc version (rustc --version) rustc 1.62.0 (a8314ef7d 2022-06-27) host, rustc 1.62.0 (a8314ef7d 2022-06-27) docker build.log

slavb18 avatar Jul 21 '22 06:07 slavb18

Hi, it's been reported previously in https://github.com/twistedfall/opencv-rust/issues/260 too. I haven't managed to find out what exactly is causing this problem so far. I'll try to give it another spin. As a workaround you can try building OpenCV from source.

twistedfall avatar Jul 21 '22 15:07 twistedfall

Thank you, building OpenCV from source helped

slavb18 avatar Jul 22 '22 10:07 slavb18