14

I want to import tess-two library in android studio and after compilation it show error in ndk build. I have already tries solution given on stackoverflow. like , Execution failed for task ':app:compileDebugNdk' but it did not resolved my issue. please suggest me where i am doing wrong.

It show the following error :

Error:error: undefined reference to 'isnanf'

Error:error: undefined reference to '__isinff'
Error:error: undefined reference to 'isnanf'
[arm64-v8a] Install        : libtess.so => libs/arm64-v8a/libtess.so
Error:error: undefined reference to 'isnanf'
Error:error: undefined reference to '__isinff'
Error:error: undefined reference to 'isnanf'
[x86_64] Install        : libjpgt.so => libs/x86_64/libjpgt.so
Error:error: linker command failed with exit code 1 (use -v to see invocation)
Error:error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/armeabi-v7a/libtess.so] Error 1

make: *** Waiting for unfinished jobs....
make: *** [obj/local/armeabi/libtess.so] Error 1
make: Leaving directory `D:/OCR/tess-two-master/tess-two-master/tess-two'
:tess-two:ndkBuild FAILED

Error:Execution failed for task ':tess-two:ndkBuild'.
Process 'command 'D:\SDK\sdk\ndk-bundle/ndk-build.cmd'' finished with non-zero exit value 2  
Community
  • 1
  • 1
Rajan1404930
  • 422
  • 5
  • 15
  • 2
    If you just want a working library, you can use the precompiled version (see "Usage" [here](https://github.com/rmtheis/tess-two#usage)) or build with NDK r10e. – rmtheis Mar 17 '16 at 14:04
  • Thank u ,it has compiled with r10e. – Rajan1404930 Mar 18 '16 at 06:00
  • Hi im using the same library in ubuntu, But i got this error Error:Execution failed for task ':tess-two:ndkBuild'. > A problem occurred starting process 'command 'ndk-build''. Please Help me ASAP.Thanks in Advance. – Naveen Aug 02 '16 at 06:20
  • @rmtheis Hello, Do you mean we just need to go to [link](https://github.com/rmtheis/tess-two#usage) and then clone `tess-two` and get a training file and create a new `Android Studio` project and just edit the app module's `build.gradle` file to add `tess-two` as an external dependency (by adding that single line)? Is this what you mean? –  Jul 06 '17 at 07:56
  • First compile your tess-two library with ndk n then import as library. – Rajan1404930 Jul 06 '17 at 10:02

1 Answers1

11

It turns out that the root cause of this error is that NDK r11 doesn't support android-8 (Android 2.2.x), whereas NDK r10 did.

Changing the Application.mk file to use APP_PLATFORM := android-9 fixes this.

rmtheis
  • 5,992
  • 12
  • 61
  • 78
  • Do you know where this change is documented? – bleater Mar 29 '16 at 00:38
  • 1
    Actually, the NDK still includes android-3 as the earliest targetable platform. The reason that changing to android-9 works for isnan/isnanf is that precisely these symbols were removed from libm.so by this changeset: https://android.googlesource.com/platform/development/+/977bf483813dd117c149880a389c97df1b881805%5E!/ – bleater Mar 29 '16 at 00:45