通过android NDK编译tesseract

发布于 2024-12-03 03:46:19 字数 690 浏览 2 评论 0原文

我正在尝试使用 android ndk r5 编译适用于 android 的 tesseract,tesseract 的代码是通过查看 http://code.google.com/p/tesseract-android-tools/,我无法编译tesseract并出现错误,

Install        : libjpeg.so => libs/armeabi/libjpeg.so
make: *** No rule to make target `//cygdrive/e/DemoExamples_WorkSpace/tesseract-android-tools/jni/../external/leptonlib-1.66/src/adaptmap.c', needed b
y `/cygdrive/e/DemoExamples_WorkSpace/tesseract-android-tools/obj/local/armeabi/objs/lept//cygdrive/e/DemoExamples_WorkSpace/tesseract-android-tools/j
ni/../external/leptonlib-1.66/src/adaptmap.o'.  Stop.

请帮我解决这个问题。

I am trying to compile tesseract for android using android ndk r5, code of tesseract is obtained by checking out http://code.google.com/p/tesseract-android-tools/, i am unable to compile tesseract and got errors,

Install        : libjpeg.so => libs/armeabi/libjpeg.so
make: *** No rule to make target `//cygdrive/e/DemoExamples_WorkSpace/tesseract-android-tools/jni/../external/leptonlib-1.66/src/adaptmap.c', needed b
y `/cygdrive/e/DemoExamples_WorkSpace/tesseract-android-tools/obj/local/armeabi/objs/lept//cygdrive/e/DemoExamples_WorkSpace/tesseract-android-tools/j
ni/../external/leptonlib-1.66/src/adaptmap.o'.  Stop.

Please help me to sort out this problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

╰沐子 2024-12-10 03:46:19

我有同样的问题,我想我已经解决了。可能对那些遇到类似错误的人有帮助:

在 OSX 上,我只是通过给出绝对路径来更改 Android.mk 文件,如下所示

:首先:jni/Android.mk

TESSERACT_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/external/tesseract-3.00
LEPTONICA_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/external/leptonlib-1.66
LIBJPEG_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/external/libjpeg

然后:jni/com_googlecode_leptonica_android /Android.mk

REAL_LOCAL_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/jni/com_googlecode_leptonica_android

jni/com_googlecode_tesseract_android/Android.mk 相应。

我相信问题是由以下命令返回的相对路径引起的:

$(call my-dir)

然后我需要以超级用户身份运行 ndk-build 并且所有编译都很好。

I had the same issue and I think I solved it. May be helpful for those who get similar errors:

On OSX, I just changed the Android.mk files by giving the absolute paths as follows

First: jni/Android.mk

TESSERACT_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/external/tesseract-3.00
LEPTONICA_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/external/leptonlib-1.66
LIBJPEG_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/external/libjpeg

Then: jni/com_googlecode_leptonica_android/Android.mk

REAL_LOCAL_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/jni/com_googlecode_leptonica_android

and jni/com_googlecode_tesseract_android/Android.mk accordingly.

I believe the problem is caused by the relative path which is returned by the following command:

$(call my-dir)

Then I needed to run the ndk-build as superuser and all compiled just fine.

伴我心暖 2024-12-10 03:46:19

在 makefile 中搜索 Adaptmap。首先构建创建此模块的 makefile。

Search for adaptmap among the makefiles. Build the makefile that creates this module first.

只是在用心讲痛 2024-12-10 03:46:19

所以,我在 Windows 7 和 Windows XP 中进行了编译,但这是一个丑陋的解决方法。

基本问题是“LOCAL_PATH :=”带有空白值,我不知道为什么 cygwin 有这个问题,所以你必须更改 Android.mk 文件上的路径才能工作。

我将使用数字引用Android.mk,我的jni路径是:

-jni
    Android.mk(1)
    Aplication.Mk
    -com_googlecode_tesseract_android(dir)
        Android.mk(2)
                tesseract(dir) 
    -com_googlecode_leptonica_android(dir)
        Android.mk(3)
                leptonlib(dir)
    -libjpeg
        Android.mk(4)

===================================

Android.mk(1)
Put tesseract and leptonica sources on googlecode subdirectories like this:

TESSERACT_PATH := $(call my-dir)/com_googlecode_tesseract_android/tesseract -- directory to source, change for respective name
LEPTONICA_PATH := $(call my-dir)/com_googlecode_leptonica_android/leptonlib -- directory to source, change for respective name
LIBJPEG_PATH := $(call my-dir)/libjpeg

== ===================================================

Android.mk(2)

1 - Change:

LOCAL_PATH:= 

to

LOCAL_PATH:= $(call my-dir)

2 - Change:

BLACKLIST_SRC_FILES := \
  %endiantest.c \
  %freetype.c \
  %xtractprotos.c
LOCAL_SRC_FILES := \
  $(filter-out $(BLACKLIST_SRC_FILES),$(wildcard $(LEPTONICA_PATH)/src/*.c))

to

LOCAL_SRC_FILES := \
    leptonlib/src/adaptmap.c \
    leptonlib/src/affine.c \
    leptonlib/src/affinecompose.c \ ... continue (Put all the files on src directory, without files listed on blacklist).
Note: replace leptonlib for subrectory name of leptonlib source.


3- Change:

ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SRC_FILES += \
  $(REAL_LOCAL_PATH)/stdio/open_memstream.c \
  $(REAL_LOCAL_PATH)/stdio/fopencookie.c \
  $(REAL_LOCAL_PATH)/stdio/fmemopen.c
LOCAL_C_INCLUDES += \
  $(REAL_LOCAL_PATH)/stdio
endif

# jni

LOCAL_SRC_FILES += \
  $(REAL_LOCAL_PATH)/box.cpp \
  $(REAL_LOCAL_PATH)/pix.cpp \
  $(REAL_LOCAL_PATH)/pixa.cpp \
  $(REAL_LOCAL_PATH)/utilities.cpp \
  $(REAL_LOCAL_PATH)/readfile.cpp \
  $(REAL_LOCAL_PATH)/writefile.cpp \
  $(REAL_LOCAL_PATH)/jni.cpp

LOCAL_C_INCLUDES += \
  $(REAL_LOCAL_PATH) \
  $(LEPTONICA_PATH)/src


to 

ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SRC_FILES += \
  stdio/open_memstream.c \
  stdio/fopencookie.c \
  stdio/fmemopen.c
LOCAL_C_INCLUDES += \
  stdio
endif

# jni

LOCAL_SRC_FILES += \
  box.cpp \
  pix.cpp \
  pixa.cpp \
  utilities.cpp \
  jni.cpp

LOCAL_C_INCLUDES += \
  leptonlib/src

​==============

Android.mk(3)

1 - Change:

LOCAL_PATH:= 

to

LOCAL_PATH:= $(call my-dir)


2 - Change

On LOCAL_SRC_FILES change $(TESSERACT_PATH) to tesseract --Note: replace tesseract for subrectory name of tesseract source.

DON´T REPLACE $(TESSERACT_PATH) on LOCAL_C_INCLUDES only LOCAL_SRC_FILES.
DON´T REPLACE $(LEPTONICA_PATH) on LOCAL_C_INCLUDES.

3 - Change:

    In #jni

    LOCAL_SRC_FILES += \
      $(REAL_LOCAL_PATH)/tessbaseapi.cpp

    LOCAL_C_INCLUDES += \
      $(REAL_LOCAL_PATH) \
      $(TESSERACT_PATH)/api \
      $(LEPTONICA_PATH)/src

    to 

    LOCAL_SRC_FILES += \
      tessbaseapi.cpp

    LOCAL_C_INCLUDES += \
      $(LOCAL_PATH) \
      $(TESSERACT_PATH)/api \
      $(LEPTONICA_PATH)/src

对于我在 Windows 7、Windows XP、Mac 和 Ubuntu 上工作。

So, I have compiled in windows 7 and windows xp, but it´s an ugly workaround.

The basic problem is "LOCAL_PATH := "with blank value, I don´t know why cygwin have problem with this, so you have to change paths on Android.mk files to work.

I will refer for Android.mk using numbers, my jni path is:

-jni
    Android.mk(1)
    Aplication.Mk
    -com_googlecode_tesseract_android(dir)
        Android.mk(2)
                tesseract(dir) 
    -com_googlecode_leptonica_android(dir)
        Android.mk(3)
                leptonlib(dir)
    -libjpeg
        Android.mk(4)

=================================

Android.mk(1)
Put tesseract and leptonica sources on googlecode subdirectories like this:

TESSERACT_PATH := $(call my-dir)/com_googlecode_tesseract_android/tesseract -- directory to source, change for respective name
LEPTONICA_PATH := $(call my-dir)/com_googlecode_leptonica_android/leptonlib -- directory to source, change for respective name
LIBJPEG_PATH := $(call my-dir)/libjpeg

=================================

Android.mk(2)

1 - Change:

LOCAL_PATH:= 

to

LOCAL_PATH:= $(call my-dir)

2 - Change:

BLACKLIST_SRC_FILES := \
  %endiantest.c \
  %freetype.c \
  %xtractprotos.c
LOCAL_SRC_FILES := \
  $(filter-out $(BLACKLIST_SRC_FILES),$(wildcard $(LEPTONICA_PATH)/src/*.c))

to

LOCAL_SRC_FILES := \
    leptonlib/src/adaptmap.c \
    leptonlib/src/affine.c \
    leptonlib/src/affinecompose.c \ ... continue (Put all the files on src directory, without files listed on blacklist).
Note: replace leptonlib for subrectory name of leptonlib source.


3- Change:

ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SRC_FILES += \
  $(REAL_LOCAL_PATH)/stdio/open_memstream.c \
  $(REAL_LOCAL_PATH)/stdio/fopencookie.c \
  $(REAL_LOCAL_PATH)/stdio/fmemopen.c
LOCAL_C_INCLUDES += \
  $(REAL_LOCAL_PATH)/stdio
endif

# jni

LOCAL_SRC_FILES += \
  $(REAL_LOCAL_PATH)/box.cpp \
  $(REAL_LOCAL_PATH)/pix.cpp \
  $(REAL_LOCAL_PATH)/pixa.cpp \
  $(REAL_LOCAL_PATH)/utilities.cpp \
  $(REAL_LOCAL_PATH)/readfile.cpp \
  $(REAL_LOCAL_PATH)/writefile.cpp \
  $(REAL_LOCAL_PATH)/jni.cpp

LOCAL_C_INCLUDES += \
  $(REAL_LOCAL_PATH) \
  $(LEPTONICA_PATH)/src


to 

ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SRC_FILES += \
  stdio/open_memstream.c \
  stdio/fopencookie.c \
  stdio/fmemopen.c
LOCAL_C_INCLUDES += \
  stdio
endif

# jni

LOCAL_SRC_FILES += \
  box.cpp \
  pix.cpp \
  pixa.cpp \
  utilities.cpp \
  jni.cpp

LOCAL_C_INCLUDES += \
  leptonlib/src

=================================

Android.mk(3)

1 - Change:

LOCAL_PATH:= 

to

LOCAL_PATH:= $(call my-dir)


2 - Change

On LOCAL_SRC_FILES change $(TESSERACT_PATH) to tesseract --Note: replace tesseract for subrectory name of tesseract source.

DON´T REPLACE $(TESSERACT_PATH) on LOCAL_C_INCLUDES only LOCAL_SRC_FILES.
DON´T REPLACE $(LEPTONICA_PATH) on LOCAL_C_INCLUDES.

3 - Change:

    In #jni

    LOCAL_SRC_FILES += \
      $(REAL_LOCAL_PATH)/tessbaseapi.cpp

    LOCAL_C_INCLUDES += \
      $(REAL_LOCAL_PATH) \
      $(TESSERACT_PATH)/api \
      $(LEPTONICA_PATH)/src

    to 

    LOCAL_SRC_FILES += \
      tessbaseapi.cpp

    LOCAL_C_INCLUDES += \
      $(LOCAL_PATH) \
      $(TESSERACT_PATH)/api \
      $(LEPTONICA_PATH)/src

For me working on windows 7, windows xp, Mac and Ubuntu.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文