rmtheis / tess-two

Fork of Tesseract Tools for Android
Apache License 2.0
3.76k stars 1.38k forks source link

Build failure with Android Studio 3 and NDK ver. 15.x #215

Closed ivankolev closed 7 years ago

ivankolev commented 7 years ago

Summary: command gradlew assemble fails with:

17:58:09.616 [QUIET] [system.out] [armeabi] Compile++ thumb: imageutils <= blur.cpp 17:58:09.850 [ERROR] [system.err] jni/imageutils/blur.cpp:76:3: error: use of undeclared identifier 'memcpy'

17:58:09.850 [QUIET] [system.out] [armeabi] Compile++ thumb: imageutils <= similar.cpp

17:58:09.856 [ERROR] [system.err] memcpy(ptr_matrix, ptr_a, sizeof(int32) * num_columns); 17:58:09.856 [ERROR] [system.err] ^ 17:58:09.863 [ERROR] [system.err] 1 error generated. 17:58:09.878 [ERROR] [system.err] make: [obj/local/armeabi/objs/imageutils/blur.o] Error 1 17:58:09.879 [ERROR] [system.err] make: Waiting for unfinished jobs.... 17:58:09.916 [ERROR] [system.err] jni/imageutils/similar.cpp:56:3: error: use of undeclared identifier 'memset' 17:58:09.916 [ERROR] [system.err] memset(_signature, 0, sizeof(int32) num_colors 2); 17:58:09.916 [ERROR] [system.err] ^ 17:58:09.925 [ERROR] [system.err] 1 error generated. 17:58:09.937 [ERROR] [system.err] make: *** [obj/local/armeabi/objs/imageutils/similar.o] Error 1

Steps to reproduce the issue:

  1. Clone repository
  2. run gradlew assemble --debug
  3. observe quoted errors

Expected result: build is successful

Actual result: build fails

Tess-two version: master branch (at this time 6.3.0)

Android version: not applicable

Phone/device model: not applicable

Phone/device architecture (armeabi, armeabi-v7a, x86, mips, arm64-v8a, x86_64, mips64): The error happens when compiling armeabi target

Additional notes: I am using the latest canary of Android Studio: Android Studio 3.0 Canary 3 Build #AI-171.4056697, built on May 31, 2017 JRE: 1.8.0_112-release-736 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0

and NDK version 15.0.4075724

I have tried with both the default gradle wrapper config:

'com.android.tools.build:gradle:2.3.1'
and distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

and with the recommended for 3.0 Canary 3

'com.android.tools.build:gradle:3.0.0-alpha3'
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip

I have a proposed solution of including the header files explicitly in blur.cpp and similar.cpp and will create a pull request shortly

rmtheis commented 7 years ago

Fixed in 16321305362b2f2c0650053d2d6ed427c8c8755e. Thank you!