Issue
I have tried quite a lot of suggestions regarding this problem, but none seem to solve my problem.
This is what I am giving as a command:
C:\Users\{name}\Desktop\MyApplication\libraries\tess-two-master\tess-two\jni> C:\Users\{name}\AppData\Local\Android\Sdk\android-ndk-r19\ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk
I am not able to compile com_googlecode_tesseract_android/./src/api/baseapi.cpp It gives me this error:
Android NDK: WARNING:com_googlecode_tesseract_android/Android.mk:tess: non-system libraries in linker flags: -latomic
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
com_googlecode_tesseract_android/./src/api/baseapi.cpp:45:10: fatal error
'iostream' file not found
#include <iostream>
^~~~~~~~~~
1 error generated.
make: *** [obj/local/arm64-v8a/objs/tess/./src/api/baseapi.o] Error 1
Here is my Application.mk
APP_STL:= c++_shared
APP_ABI := armeabi-v7a x86 arm64-v8a x86_64
APP_OPTIM := release
APP_PLATFORM := android-16
APP_CPPFLAGS += -fexceptions -frtti
NDK_TOOLCHAIN_VERSION := clang
Here is my Android.mk
LOCAL_PATH := $(call my-dir)
TESSERACT_PATH := $(LOCAL_PATH)/com_googlecode_tesseract_android/src
LEPTONICA_PATH := $(LOCAL_PATH)/com_googlecode_leptonica_android/src
LIBJPEG_PATH := $(LOCAL_PATH)/libjpeg
LIBPNG_PATH := $(LOCAL_PATH)/libpng
# Just build the Android.mk files in the subdirs
include $(call all-subdir-makefiles)
The same error shows up for all 4 headers in baseapi.cpp -
#include <iostream>
#include <string>
#include <iterator>
#include <fstream>
If anyone can help me figure out what is the problem here, it'll be great. Thank you.
PS: I am using NDK r19
Solution
In this situation, your ndk-build
does not load the Application.mk file automatically. You must specify it explicitly:
…ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk NDK_APPLICATION_MK=./Application.mk
Or you can run ndk-build
from the tess-two directory (the one above jni). In this case, ndk-build
will find both .mk files, and you don't need to specify NDK_PROJECT_PATH
:
…ndk-build
The only difference is that the output (obj and libs directories) will be created near, not in the jni directory.
Answered By - Alex Cohn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.