Android NDK-Build 错误

4
我正在尝试为Android构建Tesseract。 我已经将Tesseract放在samples文件夹中,路径为 C:\Android_NDK\android-ndk-r8\samples\tesseract, 其中tesseract文件夹包含tesseract-3.00leptonlib-1.66libjpeg文件夹。 每当我尝试使用ndk-build构建代码时, 都会出现以下错误: C:/Android_NDK/android-ndk-r8/build/core/build-binary.mk:240: *** target pattern contains no '%'. Stop. 我在命令提示符中像这样使用ndk-build: C:\Android_NDK\android-ndk-r8\samples\tesseract\jni>C:\Android_NDK\android-ndk-r8/ndk-build tesseract/jni文件夹中的Application.mk文件的内容如下: # 由于使用了硬件FPU,ARMv7显著更快 APP_STL := gnustl_static APP_ABI := armeabi armeabi-v7a APP_OPTIM := release APP_CPPFLAGS += -fexceptions -frtti
 Android.mk file contents in tesseract/jni folder  
# NOTE: You must set these variables to their respective source paths before
# compiling. For example, set LEPTONICA_PATH to the directory containing
# the Leptonica configure file and source folders. Directories must be
# root-relative, e.g. TESSERACT_PATH := /home/username/tesseract-3.00
#
# To set the variables, you can run the following shell commands:
# export TESSERACT_PATH=<path-to-tesseract>
# export LEPTONICA_PATH=<path-to-leptonica>
# export LIBJPEG_PATH=<path-to-libjpeg>
#
# Or you can fill out and uncomment the following definitions:
# TESSERACT_PATH := <path-to-tesseract>
# LEPTONICA_PATH := <path-to-leptonica>
# LIBJPEG_PATH := <path-to-libjpeg>

ifeq "$(TESSERACT_PATH)" ""
  $(error You must set the TESSERACT_PATH variable to the Tesseract source \
      directory. See README and jni/Android.mk for details)
endif

ifeq "$(LEPTONICA_PATH)" ""
  $(error You must set the LEPTONICA_PATH variable to the Leptonica source \
      directory. See README and jni/Android.mk for details)
endif

ifeq "$(LIBJPEG_PATH)" ""
  $(error You must set the LIBJPEG_PATH variable to the Android JPEG \
      source directory. See README and jni/Android.mk for details)
endif

# Just build the Android.mk files in the subdirs
include $(call all-subdir-makefiles) $(LIBJPEG_PATH)/Android.mk

我曾用Cygwin尝试过,但出现了同样的问题。

期待您的回复。

谢谢。


你能否发布你的mk文件,这样我们就可以看到更多信息。 - codetiger
@codetiger 我已经附上了mk文件的详细信息。 - Mukunda
1
请查看这个问题和一个论坛帖子。你的错误似乎与Windows路径中的“:”符号有关,该符号被视为模式匹配。 - Andrey Ermakov
@AndreyErmakov 我们如何在Windows中避免使用“:”符号? - M. Usman Khan
1个回答

2
我认为您没有在build.gradle文件中添加以下代码。这是针对Android Studio的解决方案。
 sourceSets.main {
    jniLibs.srcDir 'src/main/libs'
    jni.srcDirs = [] //disable automatic ndk-build call
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接