1

我正在尝试使用 android ndk r5 为 android 编译 tesseract,通过查看http://code.google.com/p/tesseract-android-tools/获得 tesseract 的代码,我无法编译 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.

请帮我解决这个问题。

4

3 回答 3

1

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

在 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并且所有编译都很好。

于 2012-03-19T04:14:13.533 回答
0

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

于 2011-09-09T07:06:31.010 回答
0

所以,我已经在 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 上工作的我来说。

于 2011-10-05T19:13:18.207 回答