Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android NDK: LOCAL_MODULE definition in jni/Android.mk must not contain space #1393

Closed
rezaee opened this issue Mar 16, 2018 · 19 comments
Closed

Comments

@rezaee
Copy link

rezaee commented Mar 16, 2018

I use Ubuntu 16.04 and tried to compile tesseract4, by ndk-build to use it inside Android Studio. But I get this result:


jni/Application.mk:6: /home/m/tesseract/android/jni/READONLY/google3/mobile/build/common.mk: No such file or directory
Traceback (most recent call last):
  File "/home/m/android-ndk-r16b/build/extract_manifest.py", line 106, in <module>
    main()
  File "/home/m/android-ndk-r16b/build/extract_manifest.py", line 96, in main
    tree = xml.etree.ElementTree.parse(args.manifest_file)
  File "/home/m/android-ndk-r16b/prebuilt/linux-x86_64/lib/python2.7/xml/etree/ElementTree.py", line 1182, in parse
    tree.parse(source, parser)
  File "/home/m/android-ndk-r16b/prebuilt/linux-x86_64/lib/python2.7/xml/etree/ElementTree.py", line 657, in parse
    self._root = parser.close()
  File "/home/m/android-ndk-r16b/prebuilt/linux-x86_64/lib/python2.7/xml/etree/ElementTree.py", line 1654, in close
    self._raiseerror(v)
  File "/home/m/android-ndk-r16b/prebuilt/linux-x86_64/lib/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: no element found: line 4, column 3
Android NDK: WARNING: APP_PLATFORM android-16 is higher than android:minSdkVersion 1 in ./AndroidManifest.xml. NDK binaries will *not* be comptible with devices older than android-16. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.    
Traceback (most recent call last):
  File "/home/m/android-ndk-r16b/build/extract_manifest.py", line 106, in <module>
    main()
  File "/home/m/android-ndk-r16b/build/extract_manifest.py", line 96, in main
    tree = xml.etree.ElementTree.parse(args.manifest_file)
  File "/home/m/android-ndk-r16b/prebuilt/linux-x86_64/lib/python2.7/xml/etree/ElementTree.py", line 1182, in parse
    tree.parse(source, parser)
  File "/home/m/android-ndk-r16b/prebuilt/linux-x86_64/lib/python2.7/xml/etree/ElementTree.py", line 657, in parse
    self._root = parser.close()
  File "/home/m/android-ndk-r16b/prebuilt/linux-x86_64/lib/python2.7/xml/etree/ElementTree.py", line 1654, in close
    self._raiseerror(v)
  File "/home/m/android-ndk-r16b/prebuilt/linux-x86_64/lib/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: no element found: line 4, column 3
local c includes= jni/../../api jni/../../ccmain jni/../../ccstruct jni/../../ccutil jni/../../classify jni/../../cutil jni/../../dict jni/../../image jni/../../textord jni/../../third_party jni/../../wordrec jni/../../opencl jni/../../viewer jni/../../../leptonica/include
local path=jni
local src files  = ../../api/baseapi.cpp ../../api/capi.cpp ../../api/renderer.cpp ../../ccmain/adaptions.cpp ../../ccmain/applybox.cpp ../../ccmain/control.cpp ../../ccmain/docqual.cpp ../../ccmain/equationdetect.cpp ../../ccmain/fixspace.cpp ../../ccmain/fixxht.cpp ../../ccmain/linerec.cpp ../../ccmain/ltrresultiterator.cpp ../../ccmain/osdetect.cpp ../../ccmain/output.cpp ../../ccmain/pageiterator.cpp ../../ccmain/pagesegmain.cpp ../../ccmain/pagewalk.cpp ../../ccmain/paragraphs.cpp ../../ccmain/paramsd.cpp ../../ccmain/par_control.cpp ../../ccmain/pgedit.cpp ../../ccmain/recogtraining.cpp ../../ccmain/reject.cpp ../../ccmain/resultiterator.cpp ../../ccmain/superscript.cpp ../../ccmain/tessbox.cpp ../../ccmain/tessedit.cpp ../../ccmain/tesseractclass.cpp ../../ccmain/tessvars.cpp ../../ccmain/tfacepp.cpp ../../ccmain/thresholder.cpp ../../ccmain/werdit.cpp ../../ccstruct/blamer.cpp ../../ccstruct/blobbox.cpp ../../ccstruct/blobs.cpp ../../ccstruct/blread.cpp ../../ccstruct/boxread.cpp ../../ccstruct/boxword.cpp ../../ccstruct/ccstruct.cpp ../../ccstruct/coutln.cpp ../../ccstruct/detlinefit.cpp ../../ccstruct/dppoint.cpp ../../ccstruct/fontinfo.cpp ../../ccstruct/genblob.cpp ../../ccstruct/imagedata.cpp ../../ccstruct/linlsq.cpp ../../ccstruct/matrix.cpp ../../ccstruct/mod128.cpp ../../ccstruct/normalis.cpp ../../ccstruct/ocrblock.cpp ../../ccstruct/ocrpara.cpp ../../ccstruct/ocrrow.cpp ../../ccstruct/otsuthr.cpp ../../ccstruct/pageres.cpp ../../ccstruct/params_training_featdef.cpp ../../ccstruct/pdblock.cpp ../../ccstruct/points.cpp ../../ccstruct/polyaprx.cpp ../../ccstruct/polyblk.cpp ../../ccstruct/publictypes.cpp ../../ccstruct/quadlsq.cpp ../../ccstruct/quspline.cpp ../../ccstruct/ratngs.cpp ../../ccstruct/rect.cpp ../../ccstruct/rejctmap.cpp ../../ccstruct/seam.cpp ../../ccstruct/split.cpp ../../ccstruct/statistc.cpp ../../ccstruct/stepblob.cpp ../../ccstruct/vecfuncs.cpp ../../ccstruct/werd.cpp ../../ccutil/ambigs.cpp ../../ccutil/basedir.cpp ../../ccutil/bits16.cpp ../../ccutil/bitvector.cpp ../../ccutil/ccutil.cpp ../../ccutil/clst.cpp ../../ccutil/elst2.cpp ../../ccutil/elst.cpp ../../ccutil/errcode.cpp ../../ccutil/globaloc.cpp ../../ccutil/indexmapbidi.cpp ../../ccutil/mainblk.cpp ../../ccutil/memry.cpp ../../ccutil/params.cpp ../../ccutil/scanutils.cpp ../../ccutil/serialis.cpp ../../ccutil/strngs.cpp ../../ccutil/tessdatamanager.cpp ../../ccutil/tprintf.cpp ../../ccutil/unicharcompress.cpp ../../ccutil/unichar.cpp ../../ccutil/unicharmap.cpp ../../ccutil/unicharset.cpp ../../ccutil/unicodes.cpp ../../ccutil/universalambigs.cpp ../../classify/adaptive.cpp ../../classify/adaptmatch.cpp ../../classify/blobclass.cpp ../../classify/classify.cpp ../../classify/cluster.cpp ../../classify/clusttool.cpp ../../classify/cutoffs.cpp ../../classify/errorcounter.cpp ../../classify/featdefs.cpp ../../classify/float2int.cpp ../../classify/fpoint.cpp ../../classify/intfeaturedist.cpp ../../classify/intfeaturemap.cpp ../../classify/intfeaturespace.cpp ../../classify/intfx.cpp ../../classify/intmatcher.cpp ../../classify/intproto.cpp ../../classify/kdtree.cpp ../../classify/mastertrainer.cpp ../../classify/mf.cpp ../../classify/mfdefs.cpp ../../classify/mfoutline.cpp ../../classify/mfx.cpp ../../classify/normfeat.cpp ../../classify/normmatch.cpp ../../classify/ocrfeatures.cpp ../../classify/outfeat.cpp ../../classify/picofeat.cpp ../../classify/protos.cpp ../../classify/sampleiterator.cpp ../../classify/shapeclassifier.cpp ../../classify/shapetable.cpp ../../classify/tessclassifier.cpp ../../classify/trainingsample.cpp ../../classify/trainingsampleset.cpp ../../cutil/bitvec.cpp ../../cutil/callcpp.cpp ../../cutil/cutil_class.cpp ../../cutil/cutil.cpp ../../cutil/danerror.cpp ../../cutil/efio.cpp ../../cutil/emalloc.cpp ../../cutil/oldlist.cpp ../../cutil/structures.cpp ../../dict/context.cpp ../../dict/dawg_cache.cpp ../../dict/dawg.cpp ../../dict/dict.cpp ../../dict/hyphen.cpp ../../dict/permdawg.cpp ../../dict/stopper.cpp ../../dict/trie.cpp ../../textord/alignedblob.cpp ../../textord/baselinedetect.cpp ../../textord/bbgrid.cpp ../../textord/blkocc.cpp ../../textord/blobgrid.cpp ../../textord/ccnontextdetect.cpp ../../textord/cjkpitch.cpp ../../textord/colfind.cpp ../../textord/colpartition.cpp ../../textord/colpartitiongrid.cpp ../../textord/colpartitionset.cpp ../../textord/devanagari_processing.cpp ../../textord/drawedg.cpp ../../textord/drawtord.cpp ../../textord/edgblob.cpp ../../textord/edgloop.cpp ../../textord/equationdetectbase.cpp ../../textord/fpchop.cpp ../../textord/gap_map.cpp ../../textord/imagefind.cpp ../../textord/linefind.cpp ../../textord/makerow.cpp ../../textord/oldbasel.cpp ../../textord/pithsync.cpp ../../textord/pitsync1.cpp ../../textord/scanedg.cpp ../../textord/sortflts.cpp ../../textord/strokewidth.cpp ../../textord/tabfind.cpp ../../textord/tablefind.cpp ../../textord/tablerecog.cpp ../../textord/tabvector.cpp ../../textord/textlineprojection.cpp ../../textord/textord.cpp ../../textord/topitch.cpp ../../textord/tordmain.cpp ../../textord/tospace.cpp ../../textord/tovars.cpp ../../textord/underlin.cpp ../../textord/wordseg.cpp ../../textord/workingpartset.cpp ../../viewer/scrollview.cpp ../../viewer/svmnode.cpp ../../viewer/svpaint.cpp ../../viewer/svutil.cpp ../../wordrec/associate.cpp ../../wordrec/chop.cpp ../../wordrec/chopper.cpp ../../wordrec/drawfx.cpp ../../wordrec/findseam.cpp ../../wordrec/gradechop.cpp ../../wordrec/language_model.cpp ../../wordrec/lm_consistency.cpp ../../wordrec/lm_pain_points.cpp ../../wordrec/lm_state.cpp ../../wordrec/outlines.cpp ../../wordrec/params_model.cpp ../../wordrec/pieces.cpp ../../wordrec/plotedges.cpp ../../wordrec/render.cpp ../../wordrec/segsearch.cpp ../../wordrec/tface.cpp ../../wordrec/wordclass.cpp ../../wordrec/wordrec.cpp
Android NDK: LOCAL_MODULE definition in jni/Android.mk must not contain space    
/home/m/android-ndk-r16b/build/core/build-shared-library.mk:23: *** Android NDK: Please correct error. Aborting    .  Stop.

``
How can I fix this?`
@wenfeifeifei
Copy link

I have the same problem。Did you solve this problem?
Thanks~

@duanju
Copy link

duanju commented May 25, 2018

same error

@amitdo
Copy link
Collaborator

amitdo commented May 25, 2018

https://github.com/tesseract-ocr/tesseract/wiki/User-Projects-%E2%80%93-3rdParty#mobile

@JamesZhang-Nauto
Copy link

Does anybody know what READONLY/google3/mobile/build/common.mk is? It looks like it needs to be downloaded from somewhere else?

@zdenop
Copy link
Contributor

zdenop commented Jun 24, 2019

@duanju , @rezaee : can you provide information how did you tried make android build?
There are other experiences that it is possible to compile tesseract for android.

@Jingzhe88 : I believe READONLY/google3/mobile/build/common.mk is some internal google file, not needed for tesseract build.

@alexcohn
Copy link

alexcohn commented Jul 3, 2019

I have fixed this in my fork, which uses Tesseract 4.0. The executable is built with CMake in Android Studio (or on command line). Here is my Windows command for arm64-v8a:

cmake -HD:\git\Tesseract4Android\tesseract4android\src\main\cpp
-BD:\git\Tesseract4Android\tesseract4android\.externalNativeBuild\cmake\debug\arm64-v8a
-DANDROID_ABI=arm64-v8a
-DANDROID_PLATFORM=android-16
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\git\Tesseract4Android\tesseract4android\build\intermediates\cmake\debug\obj\arm64-v8a
-DCMAKE_BUILD_TYPE=Debug
-DANDROID_NDK=C:\local\Android\sdk\ndk-bundle
-DCMAKE_CXX_FLAGS=
-DCMAKE_TOOLCHAIN_FILE=C:\local\Android\sdk\ndk-bundle\build\cmake\android.toolchain.cmake
-DCMAKE_MAKE_PROGRAM=C:\local\Android\sdk\cmake\3.6.4111459\bin\ninja.exe
-GAndroid Gradle - Ninja

@stweil
Copy link
Contributor

stweil commented Jul 3, 2019

Is there anything which needs to be fixed in the Tesseract code base? If not, I suggest to close this issue.

Of course all relevant information how to build for Android can be added to the Tesseract Wiki.

@alexcohn
Copy link

alexcohn commented Jul 3, 2019

Is there anything which needs to be fixed in the Tesseract code base? If not, I suggest to close this issue.

I would say, yes, there is. The android directory with all its files can (should) be deleted.

Of course all relevant information how to build for Android can be added to the Tesseract Wiki.

Should I add this info to Wiki?

@stweil
Copy link
Contributor

stweil commented Jul 4, 2019

Should I add this info to Wiki?

Yes, please. I suggest to add a new page for Android and refer to it from https://github.com/tesseract-ocr/tesseract/wiki/Compiling.

@alexcohn
Copy link

alexcohn commented Jul 4, 2019

Will do, probably next week.

@alexcohn
Copy link

alexcohn commented Jul 21, 2019

Actually, build for Android is so easy, it can be a short section in Compilation guide for various platforms.

Done.

@stweil
Copy link
Contributor

stweil commented Jul 22, 2019

It looks like the tess-two project is still based on Tesseract 3.05, or am I wrong? Is there support for the latest Tesseract (4.1 or newer), too?

@alexcohn
Copy link

alexcohn commented Jul 24, 2019

@stweil see https://github.com/alexcohn/tess-two/tree/4.1. Here is what it says on my device:

./tesseract --version
tesseract 4.1.0
 leptonica-1.79.0
  libjpeg 9b : libpng 1.6.25 : zlib 1.2.8

The eurotext.png is OCRed correctly, but there are still some glitches:

  • Error in pixReadMemTiff: function not present
  • Error in pixReadMem: tiff: no pix returned
  • Error in pixaGenerateFontFromString: pix not made
  • Error in bmfCreate: font pixa not made
  • Warning: Parameter not found: enable_new_segsearch

I will look into these in the next days, as well as running the Java tests.

@zdenop
Copy link
Contributor

zdenop commented Jul 25, 2019

  1. This has nothing to do with original reported issue.
  2. Search for answer - it was discussed many times.

@alexcohn
Copy link

@zdenop I posted these 5 glitches not to hijack this thread for unrelated build issues, but as a "progresses report" for @stweil, to show that my tess-two fork is close to completing 4.1 support for Android.

@stweil
Copy link
Contributor

stweil commented Jul 26, 2019

Thank you, @alexcohn, for the information on the 4.1 branch of tess-two. The README in that branch still refers to Tesseract 3.05, so it needs an update, too.

@alexcohn
Copy link

That's what happens when you push work in progress ;)

@alexcohn
Copy link

Thank you, @alexcohn, for the information on the 4.1 branch of tess-two. The README in that branch still refers to Tesseract 3.05, so it needs an update, too.

Fixed.

@zdenop
Copy link
Contributor

zdenop commented Oct 6, 2019

Closing as Android.mk does not exists in current code anymore.

@zdenop zdenop closed this as completed Oct 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants