Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Cannot binarize bitmap on device running Android L #58

Closed
tasti opened this issue Aug 1, 2014 · 6 comments
Closed

Cannot binarize bitmap on device running Android L #58

tasti opened this issue Aug 1, 2014 · 6 comments

Comments

@tasti
Copy link

tasti commented Aug 1, 2014

I'm getting an error when running Leptonica:

07-31 12:52:33.406    6216-6753/com.domain.name E/art﹕ dlopen("/data/app-lib/com.domain.name-2/liblept.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "__sfp" referenced by "liblept.so"...
07-31 12:52:33.408    6216-6753/com.domain.name E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
    Process: com.domain.name, PID: 6216
    java.lang.RuntimeException: An error occured while executing doInBackground()
            at android.os.AsyncTask$3.done(AsyncTask.java:300)
            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
            at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
            at java.util.concurrent.FutureTask.run(FutureTask.java:242)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__sfp" referenced by "liblept.so"...
            at java.lang.Runtime.loadLibrary(Runtime.java:364)
            at java.lang.System.loadLibrary(System.java:610)
            at com.googlecode.leptonica.android.ReadFile.<clinit>(ReadFile.java:31)
            at com.domain.name.BinarizeImageTask.doInBackground(BinarizeImageTask.java:42)
            at com.domain.name.BinarizeImageTask.doInBackground(BinarizeImageTask.java:18)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)

Where BinarizeImageTask.java:42 is Pix pix = ReadFile.readBitmap(bitmap);

This issue only happens on my Nexus 5 running Android L Developer Preview. All other devices work without any issues.

@rmtheis
Copy link
Owner

rmtheis commented Aug 1, 2014

Thanks for the report. Did you build with version r10 of the NDK? And is running the tests sufficient to get this error?

@tasti
Copy link
Author

tasti commented Aug 1, 2014

Yes, I downloaded NDK r10 yesterday and built it on the latest commit on master. I haven't ran the tests, but I'll check it out and give you a heads up later today.

@tasti
Copy link
Author

tasti commented Aug 1, 2014

How do I run the tests on Android Studio?

Running it as an Android Test results in Empty test suite, and running it as a single JUnit test results in Error running PixTest: Class 'com.googlecode.leptonica.android.test.PixTest' not found in module 'tess-two-test'

@rmtheis
Copy link
Owner

rmtheis commented Aug 11, 2014

You can run the tests on the command line:

curl -O https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.eng.tar.gz
tar xvf tesseract-ocr-3.02.eng.tar.gz
adb shell mkdir mnt/sdcard/tesseract
adb shell mkdir mnt/sdcard/tesseract/tessdata
adb push tesseract-ocr mnt/sdcard/tesseract
adb install tess-two-test/bin/tess-two-test.apk
adb shell am instrument -w -e package com.googlecode.tesseract.android.test \
com.googlecode.tesseract.android.test/android.test.InstrumentationTestRunner

@rmtheis
Copy link
Owner

rmtheis commented Aug 11, 2014

The error also occurs on an emulator when running the unit tests:

com.googlecode.tesseract.android.test.TessBaseAPITest:
Error in testGetUTF8Text:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__sfp" referenced by "liblept.so"...
        at java.lang.Runtime.loadLibrary(Runtime.java:364)
        at java.lang.System.loadLibrary(System.java:610)
        at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:44)
        at com.googlecode.tesseract.android.test.TessBaseAPITest.testGetUTF8Text(TessBaseAPITest.java:101)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
        at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1763)

Error in testInit:
java.lang.UnsatisfiedLinkError: com.googlecode.tesseract.android.TessBaseAPI
        at com.googlecode.tesseract.android.test.TessBaseAPITest.testInit(TessBaseAPITest.java:49)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
        at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1763)

Error in testSetImage:
java.lang.UnsatisfiedLinkError: com.googlecode.tesseract.android.TessBaseAPI
        at com.googlecode.tesseract.android.test.TessBaseAPITest.testSetImage(TessBaseAPITest.java:63)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
        at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1763)

Test results for InstrumentationTestRunner=.E.E.E
Time: 0.217

FAILURES!!!
Tests run: 3,  Failures: 0,  Errors: 3

@tasti
Copy link
Author

tasti commented Aug 13, 2014

Confirmed, works on Android L. Thanks!

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

No branches or pull requests

2 participants