构建tesseract Android工具的错误

时间:2015-04-23 17:27:14

标签: android android-ndk ocr tesseract

我正在尝试为Android构建Tesseract并且一直在遇到问题。我正在关注tutorial,其中已经给出了以下说明来构建Tesseract。

cd <project-directory>
curl -O https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz
curl -O http://leptonica.googlecode.com/files/leptonica-1.69.tar.gz
tar -zxvf tesseract-ocr-3.02.02.tar.gz
tar -zxvf leptonica-1.69.tar.gz
rm -f tesseract-ocr-3.02.02.tar.gz
rm -f leptonica-1.69.tar.gz
mv tesseract-3.02.02 jni/com_googlecode_tesseract_android/src
mv leptonica-1.69 jni/com_googlecode_leptonica_android/src
ndk-build -j8
android update project --target 1 --path .
ant debug (release)

首先,没有路径(即没有src目录)

jni/com_googlecode_tesseract_android/src
jni/com_googlecode_leptonica_android/src

所以我不太确定他们应该去哪里,所以我把它们留在了他们提取的文件夹中。 还在运行时

ndk-build -j8 

我收到以下错误

In file included from jni/com_googlecode_leptonica_android/pixa.cpp:17:0:
jni/com_googlecode_leptonica_android/common.h:22:24: fatal error: allheaders.h: No such file or directory
#include <allheaders.h>
                       ^
In file included from jni/com_googlecode_leptonica_android/pix.cpp:17:0:
jni/com_googlecode_leptonica_android/common.h:22:24: fatal error: allheaders.h: No such file or directory
#include <allheaders.h>
                       ^
compilation terminated.
In file included from jni/com_googlecode_leptonica_android/readfile.cpp:17:0:
jni/com_googlecode_leptonica_android/common.h:22:24: fatal error: allheaders.h: No such file or directory
#include <allheaders.h>
                       ^
compilation terminated.
compilation terminated.
In file included from jni/com_googlecode_leptonica_android/jni.cpp:17:0:
jni/com_googlecode_leptonica_android/common.h:22:24: fatal error: allheaders.h: No such file or directory
#include <allheaders.h>
                       ^
compilation terminated.
In file included from jni/com_googlecode_leptonica_android/utilities.cpp:17:0:
jni/com_googlecode_leptonica_android/common.h:22:24: fatal error:   allheaders.h: No such file or directory
#include <allheaders.h>
                       ^
compilation terminated.
In file included from jni/com_googlecode_leptonica_android/writefile.cpp:17:0:
jni/com_googlecode_leptonica_android/common.h:22:24: fatal error: allheaders.h: No such file or directory
#include <allheaders.h>
                       ^
compilation terminated.
In file included from jni/com_googlecode_leptonica_android/box.cpp:17:0:
jni/com_googlecode_leptonica_android/common.h:22:24: fatal error: allheaders.h: No such file or directory
#include <allheaders.h>
                       ^
compilation terminated.
make: *** [obj/local/armeabi/objs/lept/pix.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [obj/local/armeabi/objs/lept/readfile.o] Error 1
make: *** [obj/local/armeabi/objs/lept/utilities.o] Error 1
make: *** [obj/local/armeabi/objs/lept/jni.o] Error 1
make: *** [obj/local/armeabi/objs/lept/writefile.o] Error 1
make: *** [obj/local/armeabi/objs/lept/pixa.o] Error 1
make: *** [obj/local/armeabi/objs/lept/box.o] Error 1

更新:

有趣的是在重新开始之后

mv tesseract-ocr jni/com_googlecode_tesseract_android/src
mv leptonica-1.69 jni/com_googlecode_leptonica_android/src

正在运作。

在构建过程中,我收到以下错误:

jni/com_googlecode_tesseract_android/src/dict/permdawg.cpp: In member function 'void tesseract::Dict::go_deeper_dawg_fxn(const char*, const BLOB_CHOICE_LIST_VECTOR&, int, const CHAR_FRAGMENT_INFO*, bool, WERD_CHOICE*, float*, float*, WERD_CHOICE*, int*, void*)':
jni/com_googlecode_tesseract_android/src/dict/permdawg.cpp:208:62: error: format not a string literal and no format arguments [-Werror=format-security]
       fprintf(output_ambig_words_file_, word_str.string());
                                                          ^
cc1plus: some warnings being treated as errors
make: *** [obj/local/armeabi/objs/tess/src/dict/permdawg.o] Error 1
make: *** Waiting for unfinished jobs....

1 个答案:

答案 0 :(得分:0)

我也有同样的问题。 这些是我遵循的步骤:

  • 从github.com/alanv/tesseract-android-tools
  • 下载了tesseract_android_tools项目
  • 提取它并通过终端
  • 移至tesseract-android-tools
  • curl -O https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz
  • curl -O http://leptonica.googlecode.com/files/leptonica-1.69.tar.gz
  • tar -zxvf tesseract-ocr-3.02.02.tar.gz
  • tar -zxvf leptonica-1.69.tar.gz
  • rm -f tesseract-ocr-3.02.02.tar.gz
  • rm -f leptonica-1.69.tar.gz
  • mv tesseract-3.02.02 jni / com_googlecode_tesseract_android / src
  • mv leptonica-1.69 jni / com_googlecode_leptonica_android / src
  • 我尝试了android-ndk-r9,但它继续抛出错误jni/com_googlecode_tesseract_android/src/dict/permdawg.cpp:208:62: error: format not a string literal and no format arguments [-Werror=format-security] cc1plus.exe: some warnings being treated as errors
  • 我将jni / com_googlecode_tesseract_android / src / dict / permdawg.cpp第208行从fprintf(output_ambig_words_file_, word_str.string());修改为fprintf(output_ambig_words_file_, "%s", word_str.string());
  • 我尝试了android.bat update project -p .,但一直抱怨Error: The project either has no target set or the target is invalid. Please provide a --target to the 'android.bat update' command.
  • 我提供了目标,首先运行android list targets以获取我拥有的目标,然后android update project -t 7 -p .,因为7是我的首选目标
  • 那很有用。
  • 对不起,迟到的回复