我正在尝试为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....
答案 0 :(得分:0)
我也有同样的问题。 这些是我遵循的步骤:
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
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是我的首选目标