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

Compile #3

Open
winstonschen opened this issue Apr 23, 2019 · 10 comments
Open

Compile #3

winstonschen opened this issue Apr 23, 2019 · 10 comments

Comments

@winstonschen
Copy link

This repo is so helpful because of its support for Tesseract 4.0.

I'm try to compile this again with the latest Tesseract release using Xcode 10.2 and got stuck. I'm rebuilding because many of the latest trained models do not work.

But when I followed the instructions and running make, when building Leptonica, this error appears:

../../src/gplot.c:402:18: error: 'system' is unavailable: not available on iOS

Can you please give me some guidance? Or, can you update to the latest Tesseract?

Thanks.

@xwal
Copy link
Owner

xwal commented Apr 23, 2019

Hi, You need comment system function code in Leptonica project with gplot.c:402.

@scubess
Copy link

scubess commented Apr 24, 2019

Hi @chaoskyme ,
Thanks for amazing work in tesseract 4.0. following your comment above, i tried to compile after commenting the system function code in gplot.c at line 402. It throwed me the same error in thewritefile.c:1028:14 . which i believe it needs to be commented too.
But that didn't solved the problem, it throwed me error as below,

 _pixWriteStreamJp2k in liblept.a(jp2kio.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [tesseract] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2

I attached the full error for you.
error.txt

Can you provide me with some advice please ?

Thank you

@xwal
Copy link
Owner

xwal commented Apr 25, 2019

@scubess You need keep your Mac OS environment is clean, let the compilation process isn't reference the library of Mac. Maybe your Mac OS install webp library.

@scubess
Copy link

scubess commented Apr 26, 2019

Hi @chaoskyme ,

Sorry this is my first time trying to cross compile. I am very new and am not that much clear about the compilation process. Sorry to trouble you. I still have the problem. It will so good if i got this compiled in my system.
I do have webp 1.0.2 installed already. i cleaned my Mac environment and also i have tried on my other mac. It gives me same error like this,

Making all in src/lstm
Making all in src/ccmain
Making all in src/api
libtool: link: g++ -I/Users/lshiva/Current/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/x86_64-apple-darwin/ -Qunused-arguments -arch x86_64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk -miphoneos-version-min=7.0 -O2 -Wno-deprecated-register -std=c++11 -o tesseract tesseract-tesseractmain.o -Wl,-bind_at_load  -L/Users/lshiva/Current/Tesseract-OCR-iOS/TesseractOCR/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/usr/lib/ -L/Users/lshiva/Current/Tesseract-OCR-iOS/TesseractOCR/leptonica-1.76.0/x86_64-apple-darwin/src/.libs ./.libs/libtesseract.a -llept -lz -lpng -ljpeg -ltiff
Undefined symbols for architecture x86_64: 

...

 _pixWriteStreamJp2k in liblept.a(jp2kio.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [tesseract] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [/Users/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/x86_64-apple-darwin//lib/libtesseract.a] Error 2

can you help me with this error please? what wrong i am doing or advise me what makes this error please ?
thank you

@scubess
Copy link

scubess commented Apr 30, 2019

@chaoskyme Any advice on the above error please ?

@hejtmii
Copy link

hejtmii commented Oct 20, 2019

Hi @scubess @chaoskyme and future visitors

The problem above and one more similar can be resolved by adding --without-libwebp --without-libopenjpeg to the ../configure call for the Leptonica library in makefile (unless you really need that Leptonica API)

Anyway, I am just upgrading the library to Tesseract 4.1 while facing similar compilation issues (and more). You can find my observations here including the one above here

Current work in progress is here if anyone is interested. The demo project runs, but didn't test it in my own app yet: https://github.com/kenticomartinh/Tesseract-OCR-iOS/tree/4.1

If anyone has additional observations or knows more about topics in my notes above, let me know.

One thing I still need to investigate is why tests in the demo project are not loading in XCode.

@selvaw3w
Copy link

selvaw3w commented Dec 4, 2019

Hi @kenticomartinh ,
Sorry to come back to late. when I add the flags --without-libwebp --without-libopenjpeg to letonica build, it fixed the problem. Thank you

But as you mentioned , when leptonica API's called, it throw errors linking errors in libwebpio.a etc,.

Even though it built successfully, I need to call letponica APIs.

thank you so much for your help !

@hejtmii
Copy link

hejtmii commented Dec 5, 2019

Hi @selvaw3w

That is why I said "unless you really need that Leptonica API" :-) Anyway, in your case you should probably look at how the other linked libraries are handled in the makefile, and replicate that for the libwebp library. I am not that proficient in makefiles, so I can't give you an exact advice on that.

@xwal
Copy link
Owner

xwal commented Mar 24, 2020

@kenticomartinh Thanks for the solution.
@winstonschen @scubess @selvaw3w I have fixed Leptonica building error, upgraded Tesseract from 4.0.0 to 4.1.1 and merged the gali8/Tesseract-OCR-iOS master .
This is change log.

Upgrade tesseract 4.0.0 -> 4.1.1
Upgrade library version:
jpeg: 9a -> 9d
tiff: 4.0.9 -> 4.1.0
Leptonica: 1.76.0 -> 1.79.0
curl: 7.69.1
Upgrade minimum iOS version:
iOS: 7.0 -> 8.0

@hejtmii
Copy link

hejtmii commented Mar 24, 2020

Hi @chaoskyme do tests work for you? I had to make some additional cleanup of some old things that prevented them from running, see this commit.

I was also changing the default mode because TesseractOCROnly is not supported by these versions anymore. See my commit:

hejtmii@78db08e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants