【问题标题】:Errors building tesseract Android tools构建 tesseract Android 工具时出错
【发布时间】:2015-04-23 17:27:13
【问题描述】:

我正在尝试为 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....

【问题讨论】:

  • 有人请帮帮我,已经有一段时间了
  • 如果jni/com_googlecode_tesseract_android/src 为空,这意味着至少这一步:mv tesseract-3.02.02 jni/com_googlecode_tesseract_android/src 失败。当您运行教程中的所有命令时,您收到了哪些错误消息?
  • 我没有运行所有命令。当我到达ndk-build -j8 时我停下来,因为我遇到了上述错误(原始帖子的下半部分)。
  • 如果您的 src 目录不存在,这意味着实际上失败的步骤在 ndk-build 之前。
  • 我该如何解决这个问题?

标签: android android-ndk ocr tesseract


【解决方案1】:

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

  • 从 github.com/alanv/tesseract-android-tools 下载了 tesseract_android_tools 项目
  • 提取并通过终端移动到 tesseract-android-tools
  • 卷曲 -O https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz
  • 卷曲-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 是我的首选目标
  • 成功了。
  • 抱歉回复晚了

【讨论】:

    猜你喜欢
    • 2012-03-15
    • 2018-12-18
    • 1970-01-01
    • 1970-01-01
    • 2020-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多