Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime crash on Android #63

Open
skident opened this issue Jan 21, 2018 · 17 comments
Open

Runtime crash on Android #63

skident opened this issue Jan 21, 2018 · 17 comments

Comments

@skident
Copy link

skident commented Jan 21, 2018

Hello everyone,

I use the QZxing library with openCV in my application. It works fine on Linux, macOS and Android x86, but unfortunately not on Android ARMv7, it fails with the next error
F libc : Fatal signal 6 (SIGABRT), code -6 in tid 29269 (ThreadQrReader)

This crash happens when openCV has detected QR code and propagate it to the QZXing library. If QR, then QZXing library tries to decode QImage with QR and crashes (not always but in 80-90%).

I tried to narrow the problem context and started to use only decoder for QR - DecoderFormat_QR_CODE. So, it helped a bit but still I have some crashes on decoding.

Then I done another test and fully removed openCV library from my application. I use prepared images (with correct QR codes and some images without QR or corrupted QR) and pass the to a QZXing library. All works fine, when image doesn't contain QR or QR corrupted the QZXing library returns empty string - which is nice, otherwise it returns decoded text.

So, my assumption that openCV and QZXing library works unstable on Android ARMv7 and I don't know how to fix it.

I thought that the problem can be in emitting exceptions from QZXing lib, but I can't prove it and not sure why it works fine on Android x86.

@majuca
Copy link

majuca commented Jul 12, 2018

I have the same problem. The problem happens in zxing when the library is doing "throw" exception. I tried to compile my project with the -fexceptions without success. Any idees?

@majuca
Copy link

majuca commented Jul 13, 2018

When I use the .pri in my project, I obtain the problem described above, the application crash on the first "throw" done by zxing (not QZXing). So I tried to compile the library as share library and now my application don't crash anymore. I really can't explain this, so if somebody has an idea, I am interested.

@ftylitak
Copy link
Owner

Hello @skident , @majuca,

could you provide me an example project of OpenCV + QZXing? I am a bit tight in time so it would be very useful if you could provide such a same project to test on. If such a project works well, I am interested in integrating such a solution in the library itself.

@jrlopezvila
Copy link

Hello every one,
I have the same problem. seems that when you add the opencv dependency when zxing throws an exception the application crash if you works in Android ARMV7. Like said majuca I tried to not use the pri, but crash anywhere.

@ftylitak
Copy link
Owner

ftylitak commented Aug 7, 2018

hello @jrlopezvila

could you provide a sample project with OpenCV and QZXing where i could work on?

@jrlopezvila
Copy link

http://fromsmash.com/88bd188d-9ade-11e8-b1ff-06d04ae87646

you can download a test proyect from this link. This is a simple proyect that decode Qr and works fine. But if you include the opencv.pri that now is commented in the .pro file the application crash. It's very extrange becouse seems like when zxing throws a exception this is not catched.
Thanks in advance

@ftylitak
Copy link
Owner

ftylitak commented Aug 8, 2018

@jrlopezvila
thank you very much! I can not make promises for this month as holidays are comming but starting from the end of August I will try to look at it.
Thanks again for the project!

@jrlopezvila
Copy link

Hi @ftylitak
do you have any idea why it fails?
Thanks

@f-sys
Copy link

f-sys commented Oct 28, 2018

By default exceptions in native code on Android is not allowed. All exceptions generate SIGABRT during throw. Zxing uses exceptions for driving program, for example when no code is detected, it throws an exception.

These settings in pro file works for me:

CONFIG+=exceptions
QMAKE_CXXFLAGS += -fexceptions -frtti
DEFINES += ANDROID_CPP_FEATURES="rtti\ exceptions"
DEFINES += ANDROID_STL=c++_shared

@jrlopezvila
Copy link

Thanks a lot, works for me to

@DanteMigoni1986
Copy link

I have found this post after having a similar problem on android with qt:

how could I implement a multiple barcode reader using QZXing on Android. Let´s say add functionality for decoding 10 barcodes on single frame? I already tried to combine opencv for barcode detection (which works great) and QZXing for decoding, but it keeps showing me the same error "Fatal signal 6 (SIGABRT), code -6 in tid 2091 (QtThread)" that @jrlopezvila already described. How did you managed to solve the problem?? I already added these settings

CONFIG+=exceptions
QMAKE_CXXFLAGS += -fexceptions -frtti
DEFINES += ANDROID_CPP_FEATURES="rtti\ exceptions"
DEFINES += ANDROID_STL=c++_shared

but that didn´t make any better, my app keeps crashing!!

@DanteMigoni1986
Copy link

By the way, this happens when I use decodeImage from QZXing project on a segmented QImage containing QR or barcode pattern...

@DanteMigoni1986
Copy link

@jrlopezvila or @f-sys , could you please share yor .pro with me?

@jrlopezvila
Copy link

I'm sorry @DanteMigoni1986 I've been very busy. When I've tested my project it seemed to work but now I have tried it again and it is failing me too.

@awesomeerictech
Copy link

for you to use QZXing you must load it as a shared library because it utilizing threads , the reason for the crash is because the app is running on the main thread, in other words the app is doing a lot of work on it's main thread

@awesomeerictech
Copy link

As a shred library it will only be loaded when necessary, please close the issue

@awesomeerictech
Copy link

This has nothing to do with compiler flags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants