android library linking

3.5k views Asked by At

I don't if what I am trying to do is possible :

I am trying to build the tesseract project (libocr) with the ndk. Compilation is ok but linking is wrong...

with a lot of error like this :

Android NDK: WARNING: Unsupported source file extensions in /home/jpprade/dev/tesseract3/jni/Android.mk for module ocr    
Android NDK:   ccstruct/detlinefit ccmain/tessembedded textord/strokewidth    
SharedLibrary  : libocr.so
/home/jpprade/dev/tesseract3/obj/local/armeabi/objs/ocr/ccutil/basedir.o: In function `getpath(char const*, STRING&)':
/home/jpprade/dev/tesseract3/jni/ccutil/basedir.cpp:59: undefined reference to `STRING::operator=(char const*)'
...

It seems that I have this error becaus stl is not supported in the ndk. Is that right ?

I thought that I could solve this issue by using STLport. So I compiled it and I got a file libstlport.so.

But now I don't know what to do to finish building libocr and where I have to put the libstlport.so

I guess that in the end I ll have two file to load in java : libocr.so and libstlport.so but I don't if it is possible and how to achive that .

Thanks for any help !

1

There are 1 answers

0
SomeCallMeTim On

You need to add a line of the form:

LOCAL_SHARED_LIBRARIES=libstlport.so

AND you should add libstlport.so to your Application.mk APP_MODULES list, if you want it to be built as part of the same build process.

OR you can do it the easy way and use the Crystax build of the NDK, which makes STL work correctly. See: http://www.crystax.net/android/ndk.php