I’m working on a OCR Android App, but I’m having lots of problems with the Tesseract-ocr library. I’ve followed every step included in the README file in order to build the library, but I’m only getting the libjpeg.so compiled 🙁
Now, I’m gonna explain every step I’ve taken so it will help you know what i’m doing wrong
I run without problems:
cd <project-directory>
mkdir external; cd external
wget http://tesseract-ocr.googlecode.com/files/tesseract-3.00.tar.gz
tar -zxvf tesseract-3.00.tar.gz
rm -f tesseract-3.00.tar.gz
wget http://leptonica.googlecode.com/files/leptonlib-1.66.tar.gz
tar -zxvf leptonlib-1.66.tar.gz
rm -f leptonlib-1.66.tar.gz
When running:
git clone git://android.git.kernel.org/platform/external/jpeg.git libjpeg
I get:
Cloning into 'libjpeg'...
fatal: unable to connect to android.git.kernel.org:
android.git.kernel.org[0: 149.20.4.77]: errno=Connection timed out
To solve it, I use the mirror and run:
git clone git:https://github.com/android/platform_external_jpeg libjpeg
Ok, It seems to work. I get:
Cloning into 'libjpeg'...
remote: Counting objects: 324, done.
remote: Compressing objects: 100% (229/229), done.
remote: Total 324 (delta 142), reused 269 (delta 93)
Receiving objects: 100% (324/324), 756.37 KiB | 412 KiB/s, done.
Resolving deltas: 100% (142/142), done.
No problems while running:
cd libjpeg
git checkout e0eadaa39b72e33f032220246c771d7302ebeaf8
cd ..
export TESSERACT_PATH=${PWD}/tesseract-3.00
export LEPTONICA_PATH=${PWD}/leptonlib-1.66
export LIBJPEG_PATH=${PWD}/libjpeg
cd ..
but, after running ndk-build I get an error:
/cygdrive/c/Android_NDK/build/core/build-local.mk:40: build/core/init.mk: No such file or directory
/cygdrive/c/Android_NDK/build/core/build-local.mk:122: *** falta un `endif'. Alto.
Where “ falta un `endif’. Alto.” means “missing ‘endif’. Stop.“
OK, here I use the Android.mk from tesseract project and introduce minor changes to adapt it to my project directory. [Here it is][4]
Now I run
ndk-build
and I only get
libs/armeabi/libjpg.so
I think that’s because the Android.mk needs the next lines to be added to it:
include $(call all-subdir-makefiles) $(TESSERACT_PATH)/Android.mk
include $(call all-subdir-makefiles) $(LEPTONICA_PATH)/Android.mk
I do so, and, since there’s no Android.mk file at LEPTONICA_PATH and TESSERACT_PATH I take them from the tesseract-android-tools project – as I did before:
- [tesseract’s Android.mk][5],
- leptonica’s Android.mk]
Then I execute
C:\tesseract\jni>ndk-build
C:/Android_NDK/build/core/build-binary.mk:240: *** target pattern contains no `%'. Stop.
And there I got stuck. I’ve tried to solved and so I tried some things (among them, some suggestions I found here at stackoverflow) but none of them solved the problem.
I gave you every detail so it will be easier for you to find the mistake I’m making.
(Ah! I’m on WinXP+Cygwin)
Thanks in advance
I actually had the same problem. I ended up making a lot of changes to both the make files and even some of the C code within the library but was only able to get limited functionality from it. I would recommend using this tess-two library instead. I was able to compile it without any problems. However, I ended up switching before Ubuntu doing this. Give it a shot. Hope this helps!